fca-smart-shankar 12.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.replit +12 -3
- package/.upm/store.json +1 -0
- package/CHANGELOG.md +2 -0
- package/README.md +0 -1
- package/generated-icon.png +0 -0
- package/index.js +507 -437
- package/package.json +378 -42
- package/replit.nix +3 -1
- package/shankar-fca.json +4 -0
- package/src/addUserToGroup.js +3 -3
- package/src/changeAdminStatus.js +2 -2
- package/src/changeArchivedStatus.js +2 -2
- package/src/changeAvatar.js +8 -8
- package/src/changeAvatarV2.js +1 -1
- package/src/changeBio.js +4 -4
- package/src/changeBlockedStatus.js +2 -2
- package/src/changeCover.js +2 -2
- package/src/changeGroupImage.js +4 -4
- package/src/changeName.js +2 -2
- package/src/changeNickname.js +2 -2
- package/src/changeThreadColor.js +3 -3
- package/src/changeThreadEmoji.js +2 -2
- package/src/changeUsername.js +3 -3
- package/src/createCommentPost.js +5 -5
- package/src/createNewGroup.js +5 -5
- package/src/createPoll.js +2 -2
- package/src/createPost.js +6 -5
- package/src/deleteMessage.js +2 -2
- package/src/deleteThread.js +2 -2
- package/src/editMessage.js +30 -18
- package/src/follow.js +8 -8
- package/src/forwardAttachment.js +2 -2
- package/src/getAccess.js +2 -2
- package/src/getAvatarUser.js +2 -2
- package/src/getCurrentUserID.js +4 -4
- package/src/getFriendsList.js +3 -3
- package/src/getMessage.js +2 -2
- package/src/getThreadHistory.js +2 -2
- package/src/getThreadHistoryDeprecated.js +2 -2
- package/src/getThreadInfo.js +1 -1
- package/src/getThreadInfoDeprecated.js +2 -2
- package/src/getThreadList.js +3 -3
- package/src/getThreadListDeprecated.js +3 -3
- package/src/getThreadPictures.js +2 -2
- package/src/getUID.js +4 -4
- package/src/getUserID.js +3 -3
- package/src/getUserInfo.js +52 -18
- package/src/handleFriendRequest.js +5 -5
- package/src/handleMessageRequest.js +2 -2
- package/src/httpGet.js +3 -3
- package/src/httpPost.js +3 -3
- package/src/httpPostFormData.js +3 -3
- package/src/listenMqtt.js +648 -659
- package/src/listenNotification.js +1 -1
- package/src/logout.js +3 -3
- package/src/markAsDelivered.js +5 -2
- package/src/markAsRead.js +5 -2
- package/src/markAsReadAll.js +2 -2
- package/src/markAsSeen.js +2 -2
- package/src/muteThread.js +2 -2
- package/src/refreshFb_dtsg.js +3 -3
- package/src/removeUserFromGroup.js +2 -2
- package/src/resolvePhotoUrl.js +2 -2
- package/src/searchStickers.js +1 -1
- package/src/sendMessage.js +11 -8
- package/src/sendMessageMqtt.js +4 -4
- package/src/sendTypingIndicator.js +14 -5
- package/src/sendTypingIndicatorV2.js +1 -1
- package/src/setMessageReaction.js +3 -3
- package/src/setPostReaction.js +4 -4
- package/src/setProfileGuard.js +3 -3
- package/src/setStoryReaction.js +1 -1
- package/src/setTitle.js +3 -3
- package/src/shareContact.js +1 -1
- package/src/shareLink.js +1 -1
- package/src/stopListenMqtt.js +5 -2
- package/src/unfriend.js +2 -2
- package/src/unsendMessage.js +2 -2
- package/src/uploadAttachment.js +2 -2
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +7 -0
- package/test/test-page.js +1 -1
- package/utils.js +564 -391
- package/.cache/nix/binary-cache-v6.sqlite +0 -0
- package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
- package/.cache/replit/env/latest +0 -125
- package/.cache/replit/env/latest.json +0 -1
- package/.cache/replit/modules/nix.res +0 -1
- package/.cache/replit/modules/nodejs-20.res +0 -1
- package/.cache/replit/modules/replit.res +0 -1
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/replit/nix/env.json +0 -1
- package/.cache/typescript/5.6/node_modules/.package-lock.json +0 -171
- package/.cache/typescript/5.6/node_modules/@types/bluebird/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/bluebird/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/bluebird/index.d.ts +0 -1365
- package/.cache/typescript/5.6/node_modules/@types/bluebird/package.json +0 -25
- package/.cache/typescript/5.6/node_modules/@types/caseless/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/caseless/README.md +0 -48
- package/.cache/typescript/5.6/node_modules/@types/caseless/index.d.ts +0 -29
- package/.cache/typescript/5.6/node_modules/@types/caseless/package.json +0 -35
- package/.cache/typescript/5.6/node_modules/@types/cheerio/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/cheerio/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/cheerio/index.d.ts +0 -318
- package/.cache/typescript/5.6/node_modules/@types/cheerio/package.json +0 -71
- package/.cache/typescript/5.6/node_modules/@types/mocha/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/mocha/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/mocha/index.d.ts +0 -2929
- package/.cache/typescript/5.6/node_modules/@types/mocha/package.json +0 -56
- package/.cache/typescript/5.6/node_modules/@types/node/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/node/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/.cache/typescript/5.6/node_modules/@types/node/assert.d.ts +0 -1040
- package/.cache/typescript/5.6/node_modules/@types/node/async_hooks.d.ts +0 -541
- package/.cache/typescript/5.6/node_modules/@types/node/buffer.buffer.d.ts +0 -385
- package/.cache/typescript/5.6/node_modules/@types/node/buffer.d.ts +0 -1933
- package/.cache/typescript/5.6/node_modules/@types/node/child_process.d.ts +0 -1549
- package/.cache/typescript/5.6/node_modules/@types/node/cluster.d.ts +0 -579
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
- package/.cache/typescript/5.6/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/.cache/typescript/5.6/node_modules/@types/node/console.d.ts +0 -452
- package/.cache/typescript/5.6/node_modules/@types/node/constants.d.ts +0 -19
- package/.cache/typescript/5.6/node_modules/@types/node/crypto.d.ts +0 -4475
- package/.cache/typescript/5.6/node_modules/@types/node/dgram.d.ts +0 -596
- package/.cache/typescript/5.6/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
- package/.cache/typescript/5.6/node_modules/@types/node/dns/promises.d.ts +0 -476
- package/.cache/typescript/5.6/node_modules/@types/node/dns.d.ts +0 -865
- package/.cache/typescript/5.6/node_modules/@types/node/dom-events.d.ts +0 -124
- package/.cache/typescript/5.6/node_modules/@types/node/domain.d.ts +0 -170
- package/.cache/typescript/5.6/node_modules/@types/node/events.d.ts +0 -931
- package/.cache/typescript/5.6/node_modules/@types/node/fs/promises.d.ts +0 -1275
- package/.cache/typescript/5.6/node_modules/@types/node/fs.d.ts +0 -4396
- package/.cache/typescript/5.6/node_modules/@types/node/globals.d.ts +0 -566
- package/.cache/typescript/5.6/node_modules/@types/node/globals.typedarray.d.ts +0 -21
- package/.cache/typescript/5.6/node_modules/@types/node/http.d.ts +0 -1958
- package/.cache/typescript/5.6/node_modules/@types/node/http2.d.ts +0 -2558
- package/.cache/typescript/5.6/node_modules/@types/node/https.d.ts +0 -543
- package/.cache/typescript/5.6/node_modules/@types/node/index.d.ts +0 -92
- package/.cache/typescript/5.6/node_modules/@types/node/inspector.d.ts +0 -3966
- package/.cache/typescript/5.6/node_modules/@types/node/module.d.ts +0 -402
- package/.cache/typescript/5.6/node_modules/@types/node/net.d.ts +0 -1001
- package/.cache/typescript/5.6/node_modules/@types/node/os.d.ts +0 -495
- package/.cache/typescript/5.6/node_modules/@types/node/package.json +0 -220
- package/.cache/typescript/5.6/node_modules/@types/node/path.d.ts +0 -200
- package/.cache/typescript/5.6/node_modules/@types/node/perf_hooks.d.ts +0 -965
- package/.cache/typescript/5.6/node_modules/@types/node/process.d.ts +0 -1963
- package/.cache/typescript/5.6/node_modules/@types/node/punycode.d.ts +0 -117
- package/.cache/typescript/5.6/node_modules/@types/node/querystring.d.ts +0 -153
- package/.cache/typescript/5.6/node_modules/@types/node/readline/promises.d.ts +0 -162
- package/.cache/typescript/5.6/node_modules/@types/node/readline.d.ts +0 -589
- package/.cache/typescript/5.6/node_modules/@types/node/repl.d.ts +0 -430
- package/.cache/typescript/5.6/node_modules/@types/node/sea.d.ts +0 -153
- package/.cache/typescript/5.6/node_modules/@types/node/sqlite.d.ts +0 -213
- package/.cache/typescript/5.6/node_modules/@types/node/stream/consumers.d.ts +0 -12
- package/.cache/typescript/5.6/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/.cache/typescript/5.6/node_modules/@types/node/stream/web.d.ts +0 -609
- package/.cache/typescript/5.6/node_modules/@types/node/stream.d.ts +0 -1726
- package/.cache/typescript/5.6/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/.cache/typescript/5.6/node_modules/@types/node/test.d.ts +0 -2248
- package/.cache/typescript/5.6/node_modules/@types/node/timers/promises.d.ts +0 -97
- package/.cache/typescript/5.6/node_modules/@types/node/timers.d.ts +0 -240
- package/.cache/typescript/5.6/node_modules/@types/node/tls.d.ts +0 -1226
- package/.cache/typescript/5.6/node_modules/@types/node/trace_events.d.ts +0 -197
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -385
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
- package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/index.d.ts +0 -92
- package/.cache/typescript/5.6/node_modules/@types/node/tty.d.ts +0 -208
- package/.cache/typescript/5.6/node_modules/@types/node/url.d.ts +0 -972
- package/.cache/typescript/5.6/node_modules/@types/node/util.d.ts +0 -2371
- package/.cache/typescript/5.6/node_modules/@types/node/v8.d.ts +0 -808
- package/.cache/typescript/5.6/node_modules/@types/node/vm.d.ts +0 -976
- package/.cache/typescript/5.6/node_modules/@types/node/wasi.d.ts +0 -181
- package/.cache/typescript/5.6/node_modules/@types/node/worker_threads.d.ts +0 -745
- package/.cache/typescript/5.6/node_modules/@types/node/zlib.d.ts +0 -539
- package/.cache/typescript/5.6/node_modules/@types/request/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/request/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/request/index.d.ts +0 -395
- package/.cache/typescript/5.6/node_modules/@types/request/package.json +0 -70
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/README.md +0 -15
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/index.d.ts +0 -321
- package/.cache/typescript/5.6/node_modules/@types/tough-cookie/package.json +0 -35
- package/.cache/typescript/5.6/node_modules/asynckit/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/asynckit/README.md +0 -233
- package/.cache/typescript/5.6/node_modules/asynckit/bench.js +0 -76
- package/.cache/typescript/5.6/node_modules/asynckit/index.js +0 -6
- package/.cache/typescript/5.6/node_modules/asynckit/lib/abort.js +0 -29
- package/.cache/typescript/5.6/node_modules/asynckit/lib/async.js +0 -34
- package/.cache/typescript/5.6/node_modules/asynckit/lib/defer.js +0 -26
- package/.cache/typescript/5.6/node_modules/asynckit/lib/iterate.js +0 -75
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/.cache/typescript/5.6/node_modules/asynckit/lib/state.js +0 -37
- package/.cache/typescript/5.6/node_modules/asynckit/lib/streamify.js +0 -141
- package/.cache/typescript/5.6/node_modules/asynckit/lib/terminator.js +0 -29
- package/.cache/typescript/5.6/node_modules/asynckit/package.json +0 -63
- package/.cache/typescript/5.6/node_modules/asynckit/parallel.js +0 -43
- package/.cache/typescript/5.6/node_modules/asynckit/serial.js +0 -17
- package/.cache/typescript/5.6/node_modules/asynckit/serialOrdered.js +0 -75
- package/.cache/typescript/5.6/node_modules/asynckit/stream.js +0 -21
- package/.cache/typescript/5.6/node_modules/combined-stream/License +0 -19
- package/.cache/typescript/5.6/node_modules/combined-stream/Readme.md +0 -138
- package/.cache/typescript/5.6/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/.cache/typescript/5.6/node_modules/combined-stream/package.json +0 -25
- package/.cache/typescript/5.6/node_modules/combined-stream/yarn.lock +0 -17
- package/.cache/typescript/5.6/node_modules/delayed-stream/License +0 -19
- package/.cache/typescript/5.6/node_modules/delayed-stream/Makefile +0 -7
- package/.cache/typescript/5.6/node_modules/delayed-stream/Readme.md +0 -141
- package/.cache/typescript/5.6/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/.cache/typescript/5.6/node_modules/delayed-stream/package.json +0 -27
- package/.cache/typescript/5.6/node_modules/form-data/License +0 -19
- package/.cache/typescript/5.6/node_modules/form-data/Readme.md +0 -350
- package/.cache/typescript/5.6/node_modules/form-data/index.d.ts +0 -51
- package/.cache/typescript/5.6/node_modules/form-data/lib/browser.js +0 -2
- package/.cache/typescript/5.6/node_modules/form-data/lib/form_data.js +0 -484
- package/.cache/typescript/5.6/node_modules/form-data/lib/populate.js +0 -10
- package/.cache/typescript/5.6/node_modules/form-data/package.json +0 -72
- package/.cache/typescript/5.6/node_modules/mime-db/HISTORY.md +0 -507
- package/.cache/typescript/5.6/node_modules/mime-db/LICENSE +0 -23
- package/.cache/typescript/5.6/node_modules/mime-db/README.md +0 -100
- package/.cache/typescript/5.6/node_modules/mime-db/db.json +0 -8519
- package/.cache/typescript/5.6/node_modules/mime-db/index.js +0 -12
- package/.cache/typescript/5.6/node_modules/mime-db/package.json +0 -60
- package/.cache/typescript/5.6/node_modules/mime-types/HISTORY.md +0 -397
- package/.cache/typescript/5.6/node_modules/mime-types/LICENSE +0 -23
- package/.cache/typescript/5.6/node_modules/mime-types/README.md +0 -113
- package/.cache/typescript/5.6/node_modules/mime-types/index.js +0 -188
- package/.cache/typescript/5.6/node_modules/mime-types/package.json +0 -44
- package/.cache/typescript/5.6/node_modules/safe-buffer/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/safe-buffer/README.md +0 -584
- package/.cache/typescript/5.6/node_modules/safe-buffer/index.d.ts +0 -187
- package/.cache/typescript/5.6/node_modules/safe-buffer/index.js +0 -65
- package/.cache/typescript/5.6/node_modules/safe-buffer/package.json +0 -51
- package/.cache/typescript/5.6/node_modules/types-registry/README.md +0 -2
- package/.cache/typescript/5.6/node_modules/types-registry/index.json +0 -1
- package/.cache/typescript/5.6/node_modules/types-registry/package.json +0 -20
- package/.cache/typescript/5.6/node_modules/undici-types/LICENSE +0 -21
- package/.cache/typescript/5.6/node_modules/undici-types/README.md +0 -6
- package/.cache/typescript/5.6/node_modules/undici-types/agent.d.ts +0 -31
- package/.cache/typescript/5.6/node_modules/undici-types/api.d.ts +0 -43
- package/.cache/typescript/5.6/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/.cache/typescript/5.6/node_modules/undici-types/cache.d.ts +0 -36
- package/.cache/typescript/5.6/node_modules/undici-types/client.d.ts +0 -108
- package/.cache/typescript/5.6/node_modules/undici-types/connector.d.ts +0 -34
- package/.cache/typescript/5.6/node_modules/undici-types/content-type.d.ts +0 -21
- package/.cache/typescript/5.6/node_modules/undici-types/cookies.d.ts +0 -28
- package/.cache/typescript/5.6/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/.cache/typescript/5.6/node_modules/undici-types/dispatcher.d.ts +0 -255
- package/.cache/typescript/5.6/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/.cache/typescript/5.6/node_modules/undici-types/errors.d.ts +0 -149
- package/.cache/typescript/5.6/node_modules/undici-types/eventsource.d.ts +0 -61
- package/.cache/typescript/5.6/node_modules/undici-types/fetch.d.ts +0 -209
- package/.cache/typescript/5.6/node_modules/undici-types/file.d.ts +0 -39
- package/.cache/typescript/5.6/node_modules/undici-types/filereader.d.ts +0 -54
- package/.cache/typescript/5.6/node_modules/undici-types/formdata.d.ts +0 -108
- package/.cache/typescript/5.6/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/.cache/typescript/5.6/node_modules/undici-types/global-origin.d.ts +0 -7
- package/.cache/typescript/5.6/node_modules/undici-types/handlers.d.ts +0 -15
- package/.cache/typescript/5.6/node_modules/undici-types/header.d.ts +0 -4
- package/.cache/typescript/5.6/node_modules/undici-types/index.d.ts +0 -71
- package/.cache/typescript/5.6/node_modules/undici-types/interceptors.d.ts +0 -17
- package/.cache/typescript/5.6/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/.cache/typescript/5.6/node_modules/undici-types/mock-client.d.ts +0 -25
- package/.cache/typescript/5.6/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/.cache/typescript/5.6/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/.cache/typescript/5.6/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/.cache/typescript/5.6/node_modules/undici-types/package.json +0 -55
- package/.cache/typescript/5.6/node_modules/undici-types/patch.d.ts +0 -33
- package/.cache/typescript/5.6/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/.cache/typescript/5.6/node_modules/undici-types/pool.d.ts +0 -39
- package/.cache/typescript/5.6/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/.cache/typescript/5.6/node_modules/undici-types/readable.d.ts +0 -60
- package/.cache/typescript/5.6/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/.cache/typescript/5.6/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/.cache/typescript/5.6/node_modules/undici-types/util.d.ts +0 -18
- package/.cache/typescript/5.6/node_modules/undici-types/webidl.d.ts +0 -222
- package/.cache/typescript/5.6/node_modules/undici-types/websocket.d.ts +0 -150
- package/.cache/typescript/5.6/package-lock.json +0 -183
- package/.cache/typescript/5.6/package.json +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var utils = require("../utils");
|
4
|
-
|
4
|
+
var log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function(defaultFuncs, api, ctx) {
|
7
7
|
return function getThreadList(start, end, type, callback) {
|
@@ -61,14 +61,14 @@ module.exports = function(defaultFuncs, api, ctx) {
|
|
61
61
|
if (resData.error) {
|
62
62
|
throw resData;
|
63
63
|
}
|
64
|
-
|
64
|
+
log.verbose("getThreadList", JSON.stringify(resData.payload.threads));
|
65
65
|
return callback(
|
66
66
|
null,
|
67
67
|
(resData.payload.threads || []).map(utils.formatThread)
|
68
68
|
);
|
69
69
|
})
|
70
70
|
.catch(function(err) {
|
71
|
-
|
71
|
+
log.error("getThreadList", err);
|
72
72
|
return callback(err);
|
73
73
|
});
|
74
74
|
};
|
package/src/getThreadPictures.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function getThreadPictures(threadID, offset, limit, callback) {
|
@@ -71,7 +71,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
71
71
|
callback(null, resData);
|
72
72
|
})
|
73
73
|
.catch(function (err) {
|
74
|
-
|
74
|
+
log.error("Error in getThreadPictures", err);
|
75
75
|
callback(err);
|
76
76
|
});
|
77
77
|
return returnPromise;
|
package/src/getUID.js
CHANGED
@@ -33,7 +33,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
33
33
|
if (data.error) throw new Error(data.error);
|
34
34
|
return data.id || "Not found";
|
35
35
|
} catch (e) {
|
36
|
-
|
36
|
+
log.error('getUID', "Error: " + e.message);
|
37
37
|
throw new Error(e.message);
|
38
38
|
}
|
39
39
|
}
|
@@ -72,7 +72,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
72
72
|
if (typeof data.error === 'string') throw new Error(data.error);
|
73
73
|
return data.data.id || "Not found";
|
74
74
|
} catch (e) {
|
75
|
-
|
75
|
+
log.error('getUID', "Error: " + e.message);
|
76
76
|
throw new Error(e.message);
|
77
77
|
}
|
78
78
|
}
|
@@ -85,7 +85,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
85
85
|
if (!isNaN(uid)) return uid;
|
86
86
|
throw new Error("Unable to retrieve UID");
|
87
87
|
} catch (e) {
|
88
|
-
|
88
|
+
log.error('getUID', "Error: " + e.message);
|
89
89
|
throw new Error(e.message);
|
90
90
|
}
|
91
91
|
}
|
@@ -111,7 +111,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
111
111
|
throw new Error('Invalid link. The link should be a Facebook link.');
|
112
112
|
}
|
113
113
|
} catch (e) {
|
114
|
-
|
114
|
+
log.error('getUID', "Error: " + e.message);
|
115
115
|
return callback(null, e);
|
116
116
|
}
|
117
117
|
return returnPromise;
|
package/src/getUserID.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
function formatData(data) {
|
7
7
|
return {
|
@@ -37,7 +37,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
37
37
|
|
38
38
|
const form = {
|
39
39
|
value: name.toLowerCase(),
|
40
|
-
viewer: ctx.userID,
|
40
|
+
viewer: ctx.i_userID || ctx.userID,
|
41
41
|
rsp: "search",
|
42
42
|
context: "search",
|
43
43
|
path: "/home.php",
|
@@ -57,7 +57,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
57
57
|
callback(null, data.map(formatData));
|
58
58
|
})
|
59
59
|
.catch(function (err) {
|
60
|
-
|
60
|
+
log.error("getUserID", err);
|
61
61
|
return callback(err);
|
62
62
|
});
|
63
63
|
|
package/src/getUserInfo.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
|
+
const randomUserAgent = require("random-useragent");
|
5
6
|
|
6
7
|
function formatData(data) {
|
7
8
|
const retObj = {};
|
@@ -21,7 +22,7 @@ function formatData(data) {
|
|
21
22
|
isFriend: innerObj.is_friend,
|
22
23
|
isBirthday: !!innerObj.is_birthday,
|
23
24
|
searchTokens: innerObj.searchTokens,
|
24
|
-
alternateName: innerObj.alternateName
|
25
|
+
alternateName: innerObj.alternateName,
|
25
26
|
};
|
26
27
|
}
|
27
28
|
}
|
@@ -31,12 +32,13 @@ function formatData(data) {
|
|
31
32
|
|
32
33
|
module.exports = function (defaultFuncs, api, ctx) {
|
33
34
|
return function getUserInfo(id, callback) {
|
34
|
-
let resolveFunc = ()
|
35
|
-
let rejectFunc = ()
|
35
|
+
let resolveFunc = function () {};
|
36
|
+
let rejectFunc = function () {};
|
36
37
|
const returnPromise = new Promise(function (resolve, reject) {
|
37
38
|
resolveFunc = resolve;
|
38
39
|
rejectFunc = reject;
|
39
40
|
});
|
41
|
+
|
40
42
|
if (!callback) {
|
41
43
|
callback = function (err, friendList) {
|
42
44
|
if (err) {
|
@@ -45,28 +47,60 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
45
47
|
resolveFunc(friendList);
|
46
48
|
};
|
47
49
|
}
|
50
|
+
|
48
51
|
if (utils.getType(id) !== "Array") {
|
49
52
|
id = [id];
|
50
53
|
}
|
54
|
+
|
51
55
|
const form = {};
|
52
|
-
id.map((v, i)
|
56
|
+
id.map(function (v, i) {
|
53
57
|
form["ids[" + i + "]"] = v;
|
54
58
|
});
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
|
60
|
+
const performRequest = (retries = 3) => {
|
61
|
+
try {
|
62
|
+
const userAgent = randomUserAgent.getRandom(); // Get a random user-agent
|
63
|
+
|
64
|
+
if (!userAgent) {
|
65
|
+
throw new Error("Failed to generate a valid User-Agent.");
|
61
66
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
|
68
|
+
defaultFuncs
|
69
|
+
.post("https://www.facebook.com/chat/user_info/", ctx.jar, form, {
|
70
|
+
headers: {
|
71
|
+
"User-Agent": userAgent, // Ensure User-Agent is valid
|
72
|
+
}
|
73
|
+
})
|
74
|
+
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
75
|
+
.then(function (resData) {
|
76
|
+
if (resData.error) {
|
77
|
+
throw resData;
|
78
|
+
}
|
79
|
+
return callback(null, formatData(resData.payload.profiles));
|
80
|
+
})
|
81
|
+
.catch(function (err) {
|
82
|
+
log.error("getUserInfo", err);
|
83
|
+
if (retries > 0) {
|
84
|
+
log.info("Retrying Retrieve User Info... Remaining attempts: " + retries);
|
85
|
+
performRequest(retries - 1);
|
86
|
+
} else {
|
87
|
+
return callback(err);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
} catch (err) {
|
91
|
+
log.error("getUserInfo", err);
|
92
|
+
if (retries > 0) {
|
93
|
+
log.info("Retrying Retrieve User Info... Remaining attempts: " + retries);
|
94
|
+
performRequest(retries - 1);
|
95
|
+
} else {
|
96
|
+
return callback(err);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
performRequest();
|
68
102
|
|
69
103
|
return returnPromise;
|
70
104
|
};
|
71
105
|
};
|
72
|
-
|
106
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function handleFriendRequest(userID, accept, callback) {
|
@@ -28,7 +28,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
28
28
|
}
|
29
29
|
|
30
30
|
const form = {
|
31
|
-
viewer_id: ctx.userID,
|
31
|
+
viewer_id: ctx.i_userID || ctx.userID,
|
32
32
|
"frefs[0]": "jwl",
|
33
33
|
floc: "friend_center_requests",
|
34
34
|
ref: "/reqs.php",
|
@@ -39,16 +39,16 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
39
39
|
.post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
|
40
40
|
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
41
|
.then(function (resData) {
|
42
|
-
if (resData.err) {
|
42
|
+
if (resData.payload.err) {
|
43
43
|
throw {
|
44
|
-
err: resData.err
|
44
|
+
err: resData.payload.err,
|
45
45
|
};
|
46
46
|
}
|
47
47
|
|
48
48
|
return callback();
|
49
49
|
})
|
50
50
|
.catch(function (err) {
|
51
|
-
|
51
|
+
log.error("handleFriendRequest", err);
|
52
52
|
return callback(err);
|
53
53
|
});
|
54
54
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function handleMessageRequest(threadID, accept, callback) {
|
@@ -56,7 +56,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
56
56
|
return callback();
|
57
57
|
})
|
58
58
|
.catch(function (err) {
|
59
|
-
|
59
|
+
log.error("handleMessageRequest", err);
|
60
60
|
return callback(err);
|
61
61
|
});
|
62
62
|
|
package/src/httpGet.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function httpGet(url, form, customHeader, callback, notAPI) {
|
@@ -45,7 +45,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
45
45
|
callback(null, resData.body.toString());
|
46
46
|
})
|
47
47
|
.catch(function (err) {
|
48
|
-
|
48
|
+
log.error("httpGet", err);
|
49
49
|
return callback(err);
|
50
50
|
});
|
51
51
|
} else {
|
@@ -55,7 +55,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
55
55
|
callback(null, resData.body.toString());
|
56
56
|
})
|
57
57
|
.catch(function (err) {
|
58
|
-
|
58
|
+
log.error("httpGet", err);
|
59
59
|
return callback(err);
|
60
60
|
});
|
61
61
|
}
|
package/src/httpPost.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function httpPost(url, form, customHeader, callback, notAPI) {
|
@@ -45,7 +45,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
45
45
|
callback(null, resData.body.toString());
|
46
46
|
})
|
47
47
|
.catch(function (err) {
|
48
|
-
|
48
|
+
log.error("httpPost", err);
|
49
49
|
return callback(err);
|
50
50
|
});
|
51
51
|
} else {
|
@@ -55,7 +55,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
55
55
|
callback(null, resData.body.toString());
|
56
56
|
})
|
57
57
|
.catch(function (err) {
|
58
|
-
|
58
|
+
log.error("httpPost", err);
|
59
59
|
return callback(err);
|
60
60
|
});
|
61
61
|
}
|
package/src/httpPostFormData.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const utils = require("../utils");
|
4
|
-
|
4
|
+
const log = require("npmlog");
|
5
5
|
|
6
6
|
module.exports = function (defaultFuncs, api, ctx) {
|
7
7
|
return function httpPostFormData(url, form, customHeader, callback, notAPI) {
|
@@ -50,7 +50,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
50
50
|
callback(null, resData.body.toString());
|
51
51
|
})
|
52
52
|
.catch(function (err) {
|
53
|
-
|
53
|
+
log.error("httpPostFormData", err);
|
54
54
|
return callback(err);
|
55
55
|
});
|
56
56
|
} else {
|
@@ -60,7 +60,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
60
60
|
callback(null, resData.body.toString());
|
61
61
|
})
|
62
62
|
.catch(function (err) {
|
63
|
-
|
63
|
+
log.error("httpPostFormData", err);
|
64
64
|
return callback(err);
|
65
65
|
});
|
66
66
|
}
|