fca-nx 6.6.6 → 6.6.7
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/package.json +1 -1
- package/src/api/action/addfriend.js +143 -0
- package/src/api/http/httpPost.js +14 -10
- package/src/api/messaging/editMessage.js +50 -34
- package/src/api/messaging/sendMessage.js +18 -7
- package/src/api/users/getUserInfoV2.js +145 -786
- package/src/app/createFcaClient.js +0 -1
- package/src/api/action/addFriend.js +0 -145
- /package/{LICENCE → LICENSE} +0 -0
|
@@ -83,7 +83,6 @@ function createFallbackNamespaces(api) {
|
|
|
83
83
|
account: compactNamespace({
|
|
84
84
|
addExternalModule: bindOptionalMethod(api, "addExternalModule"),
|
|
85
85
|
addFriend: bindOptionalMethod(api, "addFriend"),
|
|
86
|
-
sendFriendRequest: bindOptionalMethod(api, "sendFriendRequest"),
|
|
87
86
|
changeAvatar: bindOptionalMethod(api, "changeAvatar"),
|
|
88
87
|
changeCover: bindOptionalMethod(api, "changeCover"),
|
|
89
88
|
changeBio: bindOptionalMethod(api, "changeBio"),
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { parseAndCheckLogin } = require("../../utils/client");
|
|
4
|
-
const { getSignatureID } = require("../../utils");
|
|
5
|
-
const log = require("../../../func/logAdapter");
|
|
6
|
-
|
|
7
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
|
8
|
-
return function addFriend(userID, callback) {
|
|
9
|
-
let resolveFunc;
|
|
10
|
-
let rejectFunc;
|
|
11
|
-
|
|
12
|
-
const returnPromise = new Promise((resolve, reject) => {
|
|
13
|
-
resolveFunc = resolve;
|
|
14
|
-
rejectFunc = reject;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
if (typeof callback !== "function") {
|
|
18
|
-
callback = (error, data) => {
|
|
19
|
-
if (error) {
|
|
20
|
-
rejectFunc(error);
|
|
21
|
-
} else {
|
|
22
|
-
resolveFunc(data);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (!userID) {
|
|
28
|
-
const error = new Error("User ID is required");
|
|
29
|
-
callback(error);
|
|
30
|
-
return returnPromise;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const id = String(userID);
|
|
34
|
-
|
|
35
|
-
const form = {
|
|
36
|
-
av: String(ctx.userID),
|
|
37
|
-
__aaid: "0",
|
|
38
|
-
__user: String(ctx.userID),
|
|
39
|
-
__a: "1",
|
|
40
|
-
__req: getSignatureID(),
|
|
41
|
-
__hs: "20353.HYP:comet_pkg.2.1...0",
|
|
42
|
-
dpr: "1",
|
|
43
|
-
__ccg: "EXCELLENT",
|
|
44
|
-
__rev: "1027405870",
|
|
45
|
-
__s: getSignatureID(),
|
|
46
|
-
__hsi: "7552782279085106329",
|
|
47
|
-
__comet_req: "15",
|
|
48
|
-
fb_dtsg: ctx.fb_dtsg,
|
|
49
|
-
jazoest: ctx.ttstamp,
|
|
50
|
-
lsd: ctx.fb_dtsg,
|
|
51
|
-
__spin_r: "1027405870",
|
|
52
|
-
__spin_b: "trunk",
|
|
53
|
-
__spin_t: String(Date.now()),
|
|
54
|
-
__crn: "comet.fbweb.CometFriendingRoute",
|
|
55
|
-
fb_api_caller_class: "RelayModern",
|
|
56
|
-
fb_api_req_friendly_name:
|
|
57
|
-
"FriendingCometFriendRequestSendMutation",
|
|
58
|
-
variables: JSON.stringify({
|
|
59
|
-
input: {
|
|
60
|
-
click_correlation_id: String(Date.now()),
|
|
61
|
-
click_proof_validation_result:
|
|
62
|
-
'{"validated":true}',
|
|
63
|
-
friend_requestee_ids: [id],
|
|
64
|
-
friending_channel:
|
|
65
|
-
"FRIENDS_HOME_MAIN",
|
|
66
|
-
warn_ack_for_ids: [],
|
|
67
|
-
actor_id: String(ctx.userID),
|
|
68
|
-
client_mutation_id:
|
|
69
|
-
String(Math.floor(Math.random() * 100000))
|
|
70
|
-
},
|
|
71
|
-
scale: 1
|
|
72
|
-
}),
|
|
73
|
-
server_timestamps: true,
|
|
74
|
-
doc_id: "24614631718227645"
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
defaultFuncs
|
|
78
|
-
.post(
|
|
79
|
-
"https://www.facebook.com/api/graphql/",
|
|
80
|
-
ctx.jar,
|
|
81
|
-
form
|
|
82
|
-
)
|
|
83
|
-
.then(
|
|
84
|
-
parseAndCheckLogin(ctx, defaultFuncs)
|
|
85
|
-
)
|
|
86
|
-
.then((res) => {
|
|
87
|
-
if (!res) {
|
|
88
|
-
throw new Error(
|
|
89
|
-
"Empty response received"
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (res.error || res.errors) {
|
|
94
|
-
throw res;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const data =
|
|
98
|
-
res?.data?.friend_request_send;
|
|
99
|
-
|
|
100
|
-
if (!data) {
|
|
101
|
-
throw new Error(
|
|
102
|
-
"Friend request response not found"
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const requestee =
|
|
107
|
-
Array.isArray(data.friend_requestees)
|
|
108
|
-
? data.friend_requestees[0]
|
|
109
|
-
: null;
|
|
110
|
-
|
|
111
|
-
if (!requestee) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
"No friend request data received"
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const friendshipStatus =
|
|
118
|
-
requestee.friendship_status || null;
|
|
119
|
-
|
|
120
|
-
const result = {
|
|
121
|
-
success:
|
|
122
|
-
friendshipStatus ===
|
|
123
|
-
"OUTGOING_REQUEST",
|
|
124
|
-
userID:
|
|
125
|
-
requestee.id || id,
|
|
126
|
-
friendshipStatus,
|
|
127
|
-
actionTitle:
|
|
128
|
-
requestee?.profile_action?.title?.text ||
|
|
129
|
-
null
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
return callback(null, result);
|
|
133
|
-
})
|
|
134
|
-
.catch((error) => {
|
|
135
|
-
log.error(
|
|
136
|
-
"addFriend",
|
|
137
|
-
error?.message || error
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
return callback(error);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return returnPromise;
|
|
144
|
-
};
|
|
145
|
-
};
|
/package/{LICENCE → LICENSE}
RENAMED
|
File without changes
|