@dongdev/fca-unofficial 1.0.20 → 2.0.1
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/.gitattributes +1 -0
- package/CHANGELOG.md +32 -29
- package/DOCS.md +727 -592
- package/README.md +94 -97
- package/func/logger.js +112 -0
- package/html.html +474 -0
- package/index.js +1 -379
- package/module/config.js +26 -0
- package/module/login.js +45 -0
- package/module/loginHelper.js +634 -0
- package/module/options.js +49 -0
- package/package.json +6 -39
- package/src/api/action/addExternalModule.js +25 -0
- package/src/api/action/changeAvatar.js +136 -0
- package/src/api/action/changeBio.js +76 -0
- package/src/api/action/getCurrentUserID.js +7 -0
- package/src/api/action/handleFriendRequest.js +57 -0
- package/src/api/action/logout.js +75 -0
- package/src/{refreshFb_dtsg.js → api/action/refreshFb_dtsg.js} +8 -8
- package/src/api/action/setPostReaction.js +107 -0
- package/src/api/action/unfriend.js +55 -0
- package/src/api/http/httpGet.js +65 -0
- package/src/api/http/httpPost.js +65 -0
- package/src/{postFormData.js → api/http/postFormData.js} +10 -10
- package/src/api/messaging/addUserToGroup.js +69 -0
- package/src/api/messaging/changeAdminStatus.js +103 -0
- package/src/api/messaging/changeArchivedStatus.js +55 -0
- package/src/api/messaging/changeBlockedStatus.js +49 -0
- package/src/api/messaging/changeGroupImage.js +135 -0
- package/src/api/messaging/changeNickname.js +59 -0
- package/src/api/messaging/changeThreadColor.js +65 -0
- package/src/api/messaging/createNewGroup.js +88 -0
- package/src/api/messaging/createPoll.js +70 -0
- package/src/api/messaging/deleteMessage.js +56 -0
- package/src/api/messaging/deleteThread.js +56 -0
- package/src/api/messaging/forwardAttachment.js +60 -0
- package/src/api/messaging/getEmojiUrl.js +29 -0
- package/src/api/messaging/getFriendsList.js +83 -0
- package/src/api/messaging/getMessage.js +834 -0
- package/src/api/messaging/getThreadHistory.js +681 -0
- package/src/api/messaging/handleMessageRequest.js +65 -0
- package/src/api/messaging/markAsDelivered.js +57 -0
- package/src/api/messaging/markAsRead.js +88 -0
- package/src/api/messaging/markAsReadAll.js +50 -0
- package/src/api/messaging/markAsSeen.js +61 -0
- package/src/api/messaging/muteThread.js +51 -0
- package/src/api/messaging/removeUserFromGroup.js +79 -0
- package/src/api/messaging/resolvePhotoUrl.js +44 -0
- package/src/api/messaging/searchForThread.js +53 -0
- package/src/api/messaging/sendMessage.js +306 -0
- package/src/api/messaging/sendMessageMqtt.js +321 -0
- package/src/api/messaging/sendTypingIndicator.js +110 -0
- package/src/{setMessageReaction.js → api/messaging/setMessageReaction.js} +20 -20
- package/src/api/messaging/setTitle.js +90 -0
- package/src/api/messaging/shareContact.js +51 -0
- package/src/api/messaging/threadColors.js +131 -0
- package/src/api/messaging/unsendMessage.js +44 -0
- package/src/api/messaging/uploadAttachment.js +93 -0
- package/src/api/socket/detail/buildStream.js +100 -0
- package/src/{listenMqtt.js → api/socket/listenMqtt.js} +122 -206
- package/src/api/threads/changeThreadEmoji.js +55 -0
- package/src/api/threads/getThreadInfo.js +572 -0
- package/src/{getThreadList.js → api/threads/getThreadList.js} +110 -54
- package/src/api/threads/getThreadPictures.js +79 -0
- package/src/api/users/getUserID.js +66 -0
- package/src/api/users/getUserInfo.js +88 -0
- package/src/core/sendReqMqtt.js +63 -0
- package/{lib → src}/database/models/index.js +12 -10
- package/{lib → src}/database/models/thread.js +5 -5
- package/{lib → src}/database/threadData.js +19 -14
- package/src/utils/client.js +159 -0
- package/src/utils/constants.js +13 -0
- package/src/utils/format.js +60 -0
- package/src/utils/headers.js +41 -0
- package/src/utils/index.js +1497 -0
- package/src/utils/request.js +147 -0
- package/lib/logger.js +0 -96
- package/src/addExternalModule.js +0 -19
- package/src/addUserToGroup.js +0 -113
- package/src/changeAdminStatus.js +0 -79
- package/src/changeArchivedStatus.js +0 -55
- package/src/changeAvatar.js +0 -126
- package/src/changeBio.js +0 -77
- package/src/changeBlockedStatus.js +0 -47
- package/src/changeGroupImage.js +0 -132
- package/src/changeNickname.js +0 -59
- package/src/changeThreadColor.js +0 -65
- package/src/changeThreadEmoji.js +0 -55
- package/src/createNewGroup.js +0 -86
- package/src/createPoll.js +0 -71
- package/src/deleteMessage.js +0 -56
- package/src/deleteThread.js +0 -56
- package/src/forwardAttachment.js +0 -60
- package/src/getCurrentUserID.js +0 -7
- package/src/getEmojiUrl.js +0 -29
- package/src/getFriendsList.js +0 -83
- package/src/getMessage.js +0 -796
- package/src/getThreadHistory.js +0 -666
- package/src/getThreadInfo.js +0 -535
- package/src/getThreadPictures.js +0 -79
- package/src/getUserID.js +0 -66
- package/src/getUserInfo.js +0 -80
- package/src/handleFriendRequest.js +0 -61
- package/src/handleMessageRequest.js +0 -65
- package/src/httpGet.js +0 -57
- package/src/httpPost.js +0 -57
- package/src/httpPostFormData.js +0 -63
- package/src/logout.js +0 -75
- package/src/markAsDelivered.js +0 -58
- package/src/markAsRead.js +0 -80
- package/src/markAsReadAll.js +0 -50
- package/src/markAsSeen.js +0 -59
- package/src/muteThread.js +0 -52
- package/src/removeUserFromGroup.js +0 -79
- package/src/resolvePhotoUrl.js +0 -45
- package/src/searchForThread.js +0 -53
- package/src/sendMessage.js +0 -328
- package/src/sendMessageMqtt.js +0 -316
- package/src/sendTypingIndicator.js +0 -103
- package/src/setPostReaction.js +0 -109
- package/src/setTitle.js +0 -86
- package/src/shareContact.js +0 -49
- package/src/threadColors.js +0 -131
- package/src/unfriend.js +0 -52
- package/src/unsendMessage.js +0 -49
- package/src/uploadAttachment.js +0 -95
- package/utils.js +0 -1387
- /package/{lib → func}/login.js +0 -0
@@ -1,18 +1,18 @@
|
|
1
|
-
const { Thread } = require(
|
1
|
+
const { Thread } = require("./models");
|
2
2
|
|
3
|
-
const validateThreadID =
|
4
|
-
if (typeof threadID !==
|
5
|
-
throw new Error(
|
3
|
+
const validateThreadID = threadID => {
|
4
|
+
if (typeof threadID !== "string" && typeof threadID !== "number") {
|
5
|
+
throw new Error("Invalid threadID: must be a string or number.");
|
6
6
|
}
|
7
7
|
return String(threadID);
|
8
8
|
};
|
9
|
-
const validateData =
|
10
|
-
if (!data || typeof data !==
|
11
|
-
throw new Error(
|
9
|
+
const validateData = data => {
|
10
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
11
|
+
throw new Error("Invalid data: must be a non-empty object.");
|
12
12
|
}
|
13
13
|
};
|
14
14
|
|
15
|
-
module.exports = function
|
15
|
+
module.exports = function(bot) {
|
16
16
|
return {
|
17
17
|
async create(threadID, data) {
|
18
18
|
try {
|
@@ -58,15 +58,15 @@ module.exports = function (bot) {
|
|
58
58
|
async del(threadID) {
|
59
59
|
try {
|
60
60
|
if (!threadID) {
|
61
|
-
throw new Error(
|
61
|
+
throw new Error("threadID is required and cannot be undefined");
|
62
62
|
}
|
63
63
|
threadID = validateThreadID(threadID);
|
64
64
|
if (!threadID) {
|
65
|
-
throw new Error(
|
65
|
+
throw new Error("Invalid threadID");
|
66
66
|
}
|
67
67
|
const result = await Thread.destroy({ where: { threadID } });
|
68
68
|
if (result === 0) {
|
69
|
-
throw new Error(
|
69
|
+
throw new Error("No thread found with the specified threadID");
|
70
70
|
}
|
71
71
|
return result;
|
72
72
|
} catch (error) {
|
@@ -82,12 +82,17 @@ module.exports = function (bot) {
|
|
82
82
|
},
|
83
83
|
async getAll(keys = null) {
|
84
84
|
try {
|
85
|
-
const attributes =
|
85
|
+
const attributes =
|
86
|
+
typeof keys === "string"
|
87
|
+
? [keys]
|
88
|
+
: Array.isArray(keys)
|
89
|
+
? keys
|
90
|
+
: undefined;
|
86
91
|
const threads = await Thread.findAll({ attributes });
|
87
92
|
return threads.map(thread => thread.get());
|
88
93
|
} catch (error) {
|
89
94
|
throw new Error(`Failed to get all threads: ${error.message}`);
|
90
95
|
}
|
91
|
-
}
|
96
|
+
}
|
92
97
|
};
|
93
|
-
};
|
98
|
+
};
|
@@ -0,0 +1,159 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function saveCookies(jar) {
|
4
|
+
return res => {
|
5
|
+
try {
|
6
|
+
const setCookie = res?.headers?.["set-cookie"];
|
7
|
+
if (Array.isArray(setCookie) && setCookie.length) {
|
8
|
+
const url = res?.request?.res?.responseUrl || (res?.config?.baseURL ? new URL(res.config.url || "/", res.config.baseURL).toString() : res?.config?.url || "https://www.facebook.com");
|
9
|
+
for (const c of setCookie) {
|
10
|
+
try {
|
11
|
+
jar.setCookieSync(c, url);
|
12
|
+
} catch { }
|
13
|
+
}
|
14
|
+
}
|
15
|
+
} catch { }
|
16
|
+
return res;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
function getAppState(jar) {
|
21
|
+
if (!jar || typeof jar.getCookiesSync !== "function") return [];
|
22
|
+
const urls = ["https://www.facebook.com", "https://www.messenger.com"];
|
23
|
+
const all = urls.flatMap(u => {
|
24
|
+
try { return jar.getCookiesSync(u) || []; } catch { return []; }
|
25
|
+
});
|
26
|
+
const seen = new Set();
|
27
|
+
const out = [];
|
28
|
+
for (const c of all) {
|
29
|
+
const key = c.key || c.name;
|
30
|
+
if (!key) continue;
|
31
|
+
const id = key + "|" + (c.domain || "") + "|" + (c.path || "/");
|
32
|
+
if (seen.has(id)) continue;
|
33
|
+
seen.add(id);
|
34
|
+
out.push({
|
35
|
+
key,
|
36
|
+
value: c.value,
|
37
|
+
domain: c.domain || ".facebook.com",
|
38
|
+
path: c.path || "/",
|
39
|
+
hostOnly: !!c.hostOnly,
|
40
|
+
creation: c.creation || new Date(),
|
41
|
+
lastAccessed: c.lastAccessed || new Date(),
|
42
|
+
secure: !!c.secure,
|
43
|
+
httpOnly: !!c.httpOnly,
|
44
|
+
expires: c.expires && c.expires !== "Infinity" ? c.expires : "Infinity"
|
45
|
+
});
|
46
|
+
}
|
47
|
+
return out;
|
48
|
+
}
|
49
|
+
|
50
|
+
function makeParsable(html) {
|
51
|
+
const raw = cleanXssi(String(html || ""));
|
52
|
+
const split = raw.split(/\}\r?\n\s*\{/);
|
53
|
+
if (split.length === 1) return raw;
|
54
|
+
return "[" + split.join("},{") + "]";
|
55
|
+
}
|
56
|
+
|
57
|
+
function cleanXssi(t) {
|
58
|
+
if (t == null) return "";
|
59
|
+
let s = String(t);
|
60
|
+
s = s.replace(/^[\uFEFF\xEF\xBB\xBF]+/, "");
|
61
|
+
s = s.replace(/^\)\]\}',?\s*/, "");
|
62
|
+
s = s.replace(/^\s*for\s*\(;;\);\s*/i, "");
|
63
|
+
return s;
|
64
|
+
}
|
65
|
+
|
66
|
+
function parseAndCheckLogin(ctx, http, retryCount = 0) {
|
67
|
+
const delay = ms => new Promise(r => setTimeout(r, ms));
|
68
|
+
const headerOf = (headers, name) => {
|
69
|
+
if (!headers) return;
|
70
|
+
const k = Object.keys(headers).find(k => k.toLowerCase() === name.toLowerCase());
|
71
|
+
return k ? headers[k] : undefined;
|
72
|
+
};
|
73
|
+
const buildUrl = cfg => {
|
74
|
+
try {
|
75
|
+
return cfg?.baseURL ? new URL(cfg.url || "/", cfg.baseURL).toString() : cfg?.url || "";
|
76
|
+
} catch {
|
77
|
+
return cfg?.url || "";
|
78
|
+
}
|
79
|
+
};
|
80
|
+
return async (res) => {
|
81
|
+
const status = res?.status ?? 0;
|
82
|
+
if (status >= 500 && status < 600) {
|
83
|
+
if (retryCount >= 5) {
|
84
|
+
const err = new Error("Request retry failed. Check the `res` and `statusCode` property on this error.");
|
85
|
+
err.statusCode = status;
|
86
|
+
err.res = res?.data;
|
87
|
+
err.error = "Request retry failed. Check the `res` and `statusCode` property on this error.";
|
88
|
+
throw err;
|
89
|
+
}
|
90
|
+
const retryTime = Math.floor(Math.random() * 5000);
|
91
|
+
await delay(retryTime);
|
92
|
+
const url = buildUrl(res?.config);
|
93
|
+
const ctype = String(headerOf(res?.config?.headers, "content-type") || "").toLowerCase();
|
94
|
+
const isMultipart = ctype.includes("multipart/form-data");
|
95
|
+
const payload = res?.config?.data;
|
96
|
+
const params = res?.config?.params;
|
97
|
+
retryCount += 1;
|
98
|
+
if (isMultipart) {
|
99
|
+
const newData = await http.postFormData(url, ctx.jar, payload, params, ctx.globalOptions, ctx);
|
100
|
+
return await parseAndCheckLogin(ctx, http, retryCount)(newData);
|
101
|
+
} else {
|
102
|
+
const newData = await http.post(url, ctx.jar, payload, ctx.globalOptions, ctx);
|
103
|
+
return await parseAndCheckLogin(ctx, http, retryCount)(newData);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
if (status === 404) return;
|
107
|
+
if (status !== 200) {
|
108
|
+
const err = new Error("parseAndCheckLogin got status code: " + status + ". Bailing out of trying to parse response.");
|
109
|
+
err.statusCode = status;
|
110
|
+
err.res = res?.data;
|
111
|
+
throw err;
|
112
|
+
}
|
113
|
+
const resBodyRaw = res?.data;
|
114
|
+
const body = typeof resBodyRaw === "string" ? makeParsable(resBodyRaw) : resBodyRaw;
|
115
|
+
let parsed;
|
116
|
+
try {
|
117
|
+
parsed = typeof body === "object" && body !== null ? body : JSON.parse(body);
|
118
|
+
} catch (e) {
|
119
|
+
const err = new Error("JSON.parse error. Check the `detail` property on this error.");
|
120
|
+
err.error = "JSON.parse error. Check the `detail` property on this error.";
|
121
|
+
err.detail = e;
|
122
|
+
err.res = resBodyRaw;
|
123
|
+
throw err;
|
124
|
+
}
|
125
|
+
const method = String(res?.config?.method || "GET").toUpperCase();
|
126
|
+
if (parsed.redirect && method === "GET") {
|
127
|
+
const redirectRes = await http.get(parsed.redirect, ctx.jar, null, ctx.globalOptions, ctx);
|
128
|
+
return await parseAndCheckLogin(ctx, http)(redirectRes);
|
129
|
+
}
|
130
|
+
if (parsed.jsmods && parsed.jsmods.require && Array.isArray(parsed.jsmods.require[0]) && parsed.jsmods.require[0][0] === "Cookie") {
|
131
|
+
parsed.jsmods.require[0][3][0] = parsed.jsmods.require[0][3][0].replace("_js_", "");
|
132
|
+
const requireCookie = parsed.jsmods.require[0][3];
|
133
|
+
ctx.jar.setCookie(formatCookie(requireCookie, "facebook"), "https://www.facebook.com");
|
134
|
+
ctx.jar.setCookie(formatCookie(requireCookie, "messenger"), "https://www.messenger.com");
|
135
|
+
}
|
136
|
+
if (parsed.jsmods && Array.isArray(parsed.jsmods.require)) {
|
137
|
+
for (const item of parsed.jsmods.require) {
|
138
|
+
if (item[0] === "DTSG" && item[1] === "setToken") {
|
139
|
+
ctx.fb_dtsg = item[3][0];
|
140
|
+
ctx.ttstamp = "2";
|
141
|
+
for (let j = 0; j < ctx.fb_dtsg.length; j++) ctx.ttstamp += ctx.fb_dtsg.charCodeAt(j);
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
if (parsed.error === 1357001) {
|
147
|
+
const err = new Error("Facebook blocked the login");
|
148
|
+
err.error = "Not logged in.";
|
149
|
+
throw err;
|
150
|
+
}
|
151
|
+
return parsed;
|
152
|
+
};
|
153
|
+
}
|
154
|
+
|
155
|
+
module.exports = {
|
156
|
+
saveCookies,
|
157
|
+
getAppState,
|
158
|
+
parseAndCheckLogin
|
159
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function getFrom(html, a, b) {
|
4
|
+
const i = html.indexOf(a);
|
5
|
+
if (i < 0) return;
|
6
|
+
const start = i + a.length;
|
7
|
+
const j = html.indexOf(b, start);
|
8
|
+
return j < 0 ? undefined : html.slice(start, j);
|
9
|
+
}
|
10
|
+
|
11
|
+
module.exports = {
|
12
|
+
getFrom
|
13
|
+
};
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function getType(obj) {
|
4
|
+
return Object.prototype.toString.call(obj).slice(8, -1);
|
5
|
+
}
|
6
|
+
|
7
|
+
function generateOfflineThreadingID() {
|
8
|
+
var ret = Date.now();
|
9
|
+
var value = Math.floor(Math.random() * 4294967295);
|
10
|
+
var str = ("0000000000000000000000" + value.toString(2)).slice(-22);
|
11
|
+
var msgs = ret.toString(2) + str;
|
12
|
+
return binaryToDecimal(msgs);
|
13
|
+
}
|
14
|
+
var h;
|
15
|
+
var i = {};
|
16
|
+
var j = {
|
17
|
+
_: "%",
|
18
|
+
A: "%2",
|
19
|
+
B: "000",
|
20
|
+
C: "%7d",
|
21
|
+
D: "%7b%22",
|
22
|
+
E: "%2c%22",
|
23
|
+
F: "%22%3a",
|
24
|
+
G: "%2c%22ut%22%3a1",
|
25
|
+
H: "%2c%22bls%22%3a",
|
26
|
+
I: "%2c%22n%22%3a%22%",
|
27
|
+
J: "%22%3a%7b%22i%22%3a0%7d",
|
28
|
+
K: "%2c%22pt%22%3a0%2c%22vis%22%3a",
|
29
|
+
L: "%2c%22ch%22%3a%7b%22h%22%3a%22",
|
30
|
+
M: "%7b%22v%22%3a2%2c%22time%22%3a1",
|
31
|
+
N: ".channel%22%2c%22sub%22%3a%5b",
|
32
|
+
O: "%2c%22sb%22%3a1%2c%22t%22%3a%5b",
|
33
|
+
P: "%2c%22ud%22%3a100%2c%22lc%22%3a0",
|
34
|
+
Q: "%5d%2c%22f%22%3anull%2c%22uct%22%3a",
|
35
|
+
R: ".channel%22%2c%22sub%22%3a%5b1%5d",
|
36
|
+
S: "%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a",
|
37
|
+
T: "%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a",
|
38
|
+
U: "%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
39
|
+
V: "%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a",
|
40
|
+
W: "%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a",
|
41
|
+
X: "%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1",
|
42
|
+
Y:
|
43
|
+
"%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a",
|
44
|
+
Z:
|
45
|
+
"%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a"
|
46
|
+
};
|
47
|
+
(function () {
|
48
|
+
var l = [];
|
49
|
+
for (var m in j) {
|
50
|
+
i[j[m]] = m;
|
51
|
+
l.push(j[m]);
|
52
|
+
}
|
53
|
+
l.reverse();
|
54
|
+
h = new RegExp(l.join("|"), "g");
|
55
|
+
})();
|
56
|
+
|
57
|
+
module.exports = {
|
58
|
+
getType,
|
59
|
+
generateOfflineThreadingID,
|
60
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function getHeaders(url, options, ctx, customHeader) {
|
4
|
+
const u = new URL(url);
|
5
|
+
const ua = options?.userAgent || "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
|
6
|
+
const referer = options?.referer || "https://www.facebook.com/";
|
7
|
+
const origin = referer.replace(/\/+$/, "");
|
8
|
+
const contentType = options?.contentType || "application/x-www-form-urlencoded";
|
9
|
+
const acceptLang = options?.acceptLanguage || "en-US,en;q=0.9,vi;q=0.8";
|
10
|
+
const headers = {
|
11
|
+
Host: u.host,
|
12
|
+
Origin: origin,
|
13
|
+
Referer: referer,
|
14
|
+
"User-Agent": ua,
|
15
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,application/json;q=0.8,*/*;q=0.7",
|
16
|
+
"Accept-Language": acceptLang,
|
17
|
+
"Accept-Encoding": "gzip, deflate, br",
|
18
|
+
"Content-Type": contentType,
|
19
|
+
Connection: "keep-alive",
|
20
|
+
DNT: "1",
|
21
|
+
"Upgrade-Insecure-Requests": "1",
|
22
|
+
"sec-ch-ua": "\"Chromium\";v=\"139\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"139\"",
|
23
|
+
"sec-ch-ua-mobile": "?0",
|
24
|
+
"sec-ch-ua-platform": "\"Windows\"",
|
25
|
+
"sec-ch-ua-arch": "\"x86\"",
|
26
|
+
"sec-ch-ua-bitness": "\"64\"",
|
27
|
+
"sec-ch-ua-full-version-list": "\"Chromium\";v=\"139.0.0.0\", \"Not;A=Brand\";v=\"24.0.0.0\", \"Google Chrome\";v=\"139.0.0.0\"",
|
28
|
+
"sec-ch-ua-platform-version": "\"15.0.0\"",
|
29
|
+
"Sec-Fetch-Site": "same-origin",
|
30
|
+
"Sec-Fetch-Mode": "cors",
|
31
|
+
"Sec-Fetch-Dest": "empty",
|
32
|
+
"X-Requested-With": "XMLHttpRequest",
|
33
|
+
Pragma: "no-cache",
|
34
|
+
"Cache-Control": "no-cache"
|
35
|
+
};
|
36
|
+
if (ctx?.region) headers["X-MSGR-Region"] = ctx.region;
|
37
|
+
if (customHeader && typeof customHeader === "object") Object.assign(headers, customHeader);
|
38
|
+
return headers;
|
39
|
+
}
|
40
|
+
|
41
|
+
module.exports = { getHeaders };
|