alicezetion 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"nonce":
|
1
|
+
{"nonce":1696146174280555217,"last_updated":{"seconds":1692340746,"nanos":363140000}}
|
package/package.json
CHANGED
package/src/getUserInfo.js
CHANGED
@@ -27,40 +27,46 @@ function formatData(data) {
|
|
27
27
|
return retObj;
|
28
28
|
}
|
29
29
|
|
30
|
-
module.exports = function
|
30
|
+
module.exports = function(defaultFuncs, api, ctx) {
|
31
31
|
return function getUserInfo(id, callback) {
|
32
|
-
var resolveFunc = function
|
33
|
-
var rejectFunc = function
|
32
|
+
var resolveFunc = function(){};
|
33
|
+
var rejectFunc = function(){};
|
34
34
|
var returnPromise = new Promise(function (resolve, reject) {
|
35
35
|
resolveFunc = resolve;
|
36
36
|
rejectFunc = reject;
|
37
37
|
});
|
38
38
|
|
39
39
|
if (!callback) {
|
40
|
-
callback = function (err,
|
41
|
-
if (err)
|
42
|
-
|
40
|
+
callback = function (err, friendList) {
|
41
|
+
if (err) {
|
42
|
+
return rejectFunc(err);
|
43
|
+
}
|
44
|
+
resolveFunc(friendList);
|
43
45
|
};
|
44
46
|
}
|
45
47
|
|
46
|
-
if (utils.getType(id) !== "Array")
|
48
|
+
if (utils.getType(id) !== "Array") {
|
49
|
+
id = [id];
|
50
|
+
}
|
47
51
|
|
48
52
|
var form = {};
|
49
|
-
id.map(function
|
53
|
+
id.map(function(v, i) {
|
50
54
|
form["ids[" + i + "]"] = v;
|
51
55
|
});
|
52
56
|
defaultFuncs
|
53
57
|
.post("https://www.facebook.com/chat/user_info/", ctx.jar, form)
|
54
58
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
55
|
-
.then(function
|
56
|
-
if (resData.error)
|
59
|
+
.then(function(resData) {
|
60
|
+
if (resData.error) {
|
61
|
+
throw resData;
|
62
|
+
}
|
57
63
|
return callback(null, formatData(resData.payload.profiles));
|
58
64
|
})
|
59
|
-
.catch(function
|
60
|
-
log.error("getUserInfo",
|
65
|
+
.catch(function(err) {
|
66
|
+
log.error("getUserInfo", err);
|
61
67
|
return callback(err);
|
62
68
|
});
|
63
69
|
|
64
70
|
return returnPromise;
|
65
71
|
};
|
66
|
-
};
|
72
|
+
};
|