node-ainzfb-new 1.6.2431-test → 1.6.2702-test
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -2
- package/src/getUserID.js +14 -10
- package/utils.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-ainzfb-new",
|
3
|
-
"version": "1.6.
|
3
|
+
"version": "1.6.2702-test",
|
4
4
|
"description": "A Facebook chat API that doesn't rely on XMPP. Will NOT be deprecated after April 30th 2015.",
|
5
5
|
"scripts": {
|
6
6
|
"test": "mocha",
|
@@ -36,10 +36,11 @@
|
|
36
36
|
"is-hexcolor": "^1.0.0",
|
37
37
|
"lodash": "",
|
38
38
|
"mqtt": "^4.3.7",
|
39
|
+
"node-superfetch": "^0.2.3",
|
39
40
|
"npmlog": "^1.2.0",
|
40
41
|
"path": "latest",
|
41
42
|
"pretty-ms": "latest",
|
42
|
-
"request": "^2.
|
43
|
+
"request": "^2.88.2",
|
43
44
|
"semver": "latest",
|
44
45
|
"sus-support": "git+https://github.com/amogusdevlol/sus-support.git",
|
45
46
|
"websocket-stream": "latest"
|
package/src/getUserID.js
CHANGED
@@ -17,19 +17,21 @@ function formatData(data) {
|
|
17
17
|
};
|
18
18
|
}
|
19
19
|
|
20
|
-
module.exports = function
|
20
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
21
21
|
return function getUserID(name, callback) {
|
22
|
-
var resolveFunc = function
|
23
|
-
var rejectFunc = function
|
22
|
+
var resolveFunc = function(){};
|
23
|
+
var rejectFunc = function(){};
|
24
24
|
var returnPromise = new Promise(function (resolve, reject) {
|
25
25
|
resolveFunc = resolve;
|
26
26
|
rejectFunc = reject;
|
27
27
|
});
|
28
28
|
|
29
29
|
if (!callback) {
|
30
|
-
callback = function (err,
|
31
|
-
if (err)
|
32
|
-
|
30
|
+
callback = function (err, friendList) {
|
31
|
+
if (err) {
|
32
|
+
return rejectFunc(err);
|
33
|
+
}
|
34
|
+
resolveFunc(friendList);
|
33
35
|
};
|
34
36
|
}
|
35
37
|
|
@@ -45,18 +47,20 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
45
47
|
defaultFuncs
|
46
48
|
.get("https://www.facebook.com/ajax/typeahead/search.php", ctx.jar, form)
|
47
49
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
48
|
-
.then(function
|
49
|
-
if (resData.error)
|
50
|
+
.then(function(resData) {
|
51
|
+
if (resData.error) {
|
52
|
+
throw resData;
|
53
|
+
}
|
50
54
|
|
51
55
|
var data = resData.payload.entries;
|
52
56
|
|
53
57
|
callback(null, data.map(formatData));
|
54
58
|
})
|
55
|
-
.catch(function
|
59
|
+
.catch(function(err) {
|
56
60
|
log.error("getUserID", err);
|
57
61
|
return callback(err);
|
58
62
|
});
|
59
63
|
|
60
64
|
return returnPromise;
|
61
65
|
};
|
62
|
-
};
|
66
|
+
};
|
package/utils.js
CHANGED
@@ -1083,7 +1083,7 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
|
|
1083
1083
|
}
|
1084
1084
|
}
|
1085
1085
|
|
1086
|
-
if (res.error === 1357001) throw { error: "
|
1086
|
+
if (res.error === 1357001) throw { error: "Not logged in." };
|
1087
1087
|
return res;
|
1088
1088
|
});
|
1089
1089
|
};
|