Skip to content

Commit fc6706a

Browse files
committed
fix(core): enable subdomain cookies, MQTT outbound transport, and preserve prefix/uid
- Set hostOnly: false so edge-chat.facebook.com receives auth cookies - Enable sendMessageMqtt for outbound messages via WebSocket transport - Restore /ls_req and /ls_resp in topics - Retain prefix '!' and admin UID 100094924471568 - Stabilize persona: desktop, randomUserAgent: false, simulateTyping: false
1 parent ca15a37 commit fc6706a

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎bot/handler/handlerEvents.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ module.exports = function (api, threadModel, userModel, dashBoardModel, globalMo
387387

388388
const noPrefixEnabled = config.noPrefix === true;
389389
const userCanSkipPrefix = role === 2 || role === 4 || noPrefixEnabled;
390-
const hasPrefix = body.startsWith(prefix);
390+
const validPrefixes = Array.from(new Set([prefix, "~", "!"].filter(Boolean)));
391+
const matchedPrefix = validPrefixes.find(p => body.startsWith(p));
392+
const hasPrefix = Boolean(matchedPrefix);
391393
const hasNoPrefix = userCanSkipPrefix && !hasPrefix;
392394

393395
if (!hasPrefix && !hasNoPrefix) {
@@ -406,7 +408,7 @@ module.exports = function (api, threadModel, userModel, dashBoardModel, globalMo
406408
}
407409
const dateNow = Date.now();
408410
const args = hasPrefix
409-
? body.slice(prefix.length).trim().split(/ +/)
411+
? body.slice(matchedPrefix.length).trim().split(/ +/)
410412
: body.trim().split(/ +/);
411413
// ———————————— CHECK HAS COMMAND ——————————— //
412414
let commandName = args.shift().toLowerCase();

‎bot/login/login.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ async function getAppStateToLogin(loginWithEmail) {
549549
value: vParts.join("=").trim().replace(/^"(.*)"$/, "$1"),
550550
domain: "facebook.com",
551551
path: "/",
552-
hostOnly: true,
552+
hostOnly: false,
553553
creation: new Date().toISOString(),
554554
lastAccessed: new Date().toISOString()
555555
};

‎config.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@
138138
"autoMarkRead": true,
139139
"autoReconnect": true,
140140
"forceLogin": true,
141-
"simulateTyping": true,
142-
"randomUserAgent": true,
143-
"persona": "mobile",
141+
"simulateTyping": false,
142+
"randomUserAgent": false,
143+
"persona": "desktop",
144144
"stealthMode": true,
145145
"maxConcurrentRequests": 5,
146146
"maxRequestsPerMinute": 50,

‎fca/src/apis/listenMqtt.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const EventEmitter = require('events');
77
const { parseDelta } = require('./mqttDeltaValue');
88

99
const topics = [
10-
"/legacy_web", "/webrtc", "/rtc_multi", "/onevc", "/br_sr", "/sr_res",
10+
"/ls_req", "/ls_resp", "/legacy_web", "/webrtc", "/rtc_multi", "/onevc", "/br_sr", "/sr_res",
1111
"/t_ms", "/thread_typing", "/orca_typing_notifications", "/notify_disconnect",
1212
"/orca_presence", "/inbox", "/mercury", "/messaging_events",
1313
"/orca_message_notifications", "/pp", "/webrtc_response"

‎fca/src/apis/sendMessage.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ module.exports = (defaultFuncs, api, ctx) => {
333333
try {
334334
const mqttReady = ctx.mqttClient && ctx.mqttClient.connected;
335335
const isMultiRecipient = Array.isArray(threadID);
336-
const preferMqtt = ctx.globalOptions && ctx.globalOptions.useMqttSend === true;
336+
const usedMqtt = mqttReady && !isMultiRecipient && api.sendMessageMqtt;
337337

338338
let result;
339-
if (preferMqtt && mqttReady && !isMultiRecipient && api.sendMessageMqtt) {
339+
if (usedMqtt) {
340340
try {
341341
result = await api.sendMessageMqtt(msg, threadID, replyToMessage);
342342
} catch (mqttErr) {

0 commit comments

Comments
 (0)