fca-nx 6.8.3 → 6.8.4
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/module/login.js
CHANGED
|
@@ -135,7 +135,7 @@ function login(loginData, options, callback) {
|
|
|
135
135
|
forceLogin: false,
|
|
136
136
|
autoMarkRead: false,
|
|
137
137
|
autoReconnect: true,
|
|
138
|
-
online:
|
|
138
|
+
online: true,
|
|
139
139
|
emitReady: false,
|
|
140
140
|
// Single source of truth for the default identity - see src/utils/clientIdentity.js.
|
|
141
141
|
// This used to be hard-coded independently here (Chrome/121), in
|
|
@@ -175,6 +175,9 @@ function login(loginData, options, callback) {
|
|
|
175
175
|
callback(error, api);
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
+
if (loginData && (loginData.twofactor || loginData.twoFactor)) {
|
|
179
|
+
globalOptions.twofactor = String(loginData.twofactor || loginData.twoFactor);
|
|
180
|
+
}
|
|
178
181
|
const proceed = () => loginHelper(loginData.appState, loginData.Cookie, loginData.email, loginData.password, globalOptions, wrappedCallback, prCallback);
|
|
179
182
|
if (config && config.autoUpdate) {
|
|
180
183
|
const p = checkAndUpdateVersion();
|
package/module/loginHelper.js
CHANGED
|
@@ -591,7 +591,7 @@ async function tryAutoLoginIfNeeded(currentHtml, currentCookies, globalOptions,
|
|
|
591
591
|
// Try API login
|
|
592
592
|
const u = config.credentials?.email || config.email;
|
|
593
593
|
const p = config.credentials?.password || config.password;
|
|
594
|
-
const tf = config.credentials?.twofactor || config.twofactor || null;
|
|
594
|
+
const tf = (globalOptions && globalOptions.twofactor) || config.credentials?.twofactor || config.twofactor || null;
|
|
595
595
|
|
|
596
596
|
if (!u || !p) {
|
|
597
597
|
logger("tryAutoLoginIfNeeded: No credentials configured for auto-login!", "error");
|
|
@@ -738,7 +738,7 @@ function makeLogin(j, email, password, globalOptions) {
|
|
|
738
738
|
return async function () {
|
|
739
739
|
const u = email || config.credentials?.email;
|
|
740
740
|
const p = password || config.credentials?.password;
|
|
741
|
-
const tf = config.credentials?.twofactor || null;
|
|
741
|
+
const tf = (globalOptions && globalOptions.twofactor) || config.credentials?.twofactor || null;
|
|
742
742
|
if (!u || !p) return;
|
|
743
743
|
const r = await tokens(u, p, tf);
|
|
744
744
|
if (r && r.status && Array.isArray(r.cookies)) {
|
|
@@ -1225,7 +1225,7 @@ function loginHelper(appState, Cookie, email, password, globalOptions, callback)
|
|
|
1225
1225
|
|
|
1226
1226
|
const u = config.credentials?.email || email;
|
|
1227
1227
|
const p = config.credentials?.password || password;
|
|
1228
|
-
const tf = config.credentials?.twofactor || null;
|
|
1228
|
+
const tf = globalOptions.twofactor || config.credentials?.twofactor || null;
|
|
1229
1229
|
if (!u || !p) return false;
|
|
1230
1230
|
// [Hardened4] Repeated credential logins are a classic trigger for "automated
|
|
1231
1231
|
// behaviour"/"multiple sessions" restrictions. At most one per cooldown window
|
package/package.json
CHANGED
|
@@ -127,8 +127,9 @@ module.exports = function createListenMqtt(deps) {
|
|
|
127
127
|
if (!ctx.clientId || ctx.clientId === "") {
|
|
128
128
|
ctx.clientId = ctx.clientID || ((""+Math.random()).slice(2) + Date.now()).slice(0, 16);
|
|
129
129
|
}
|
|
130
|
-
//
|
|
131
|
-
|
|
130
|
+
// Online while this session is actually connected. Offline only if the
|
|
131
|
+
// caller set online:false. A running Messenger tab is online.
|
|
132
|
+
const chatOn = ctx.globalOptions.online !== false;
|
|
132
133
|
// Same browser tab for the life of the process. A new sid on every
|
|
133
134
|
// reconnect looks like a new login and is a common suspend trigger.
|
|
134
135
|
if (!ctx._edgeSid) {
|
|
@@ -358,6 +358,9 @@ module.exports = function (defaultFuncs, api, ctx, opts) {
|
|
|
358
358
|
try {
|
|
359
359
|
if (ctx.mqttClient) {
|
|
360
360
|
if (!soft && isConnected()) {
|
|
361
|
+
try {
|
|
362
|
+
ctx.mqttClient.publish("/foreground_state", JSON.stringify({ foreground: false }), { qos: 0 });
|
|
363
|
+
} catch (_) { }
|
|
361
364
|
try {
|
|
362
365
|
ctx.mqttClient.publish("/browser_close", "{}", { qos: 0 });
|
|
363
366
|
} catch (_) { }
|
|
@@ -528,6 +531,17 @@ module.exports = function (defaultFuncs, api, ctx, opts) {
|
|
|
528
531
|
|
|
529
532
|
installPostGuard();
|
|
530
533
|
|
|
534
|
+
if (ctx.mqttClient && ctx.mqttClient.connected) {
|
|
535
|
+
logger("mqtt already connected - not opening a second session", "info");
|
|
536
|
+
attachClientListeners();
|
|
537
|
+
startHeartbeat();
|
|
538
|
+
api.stopListening = msgEmitter.stopListening;
|
|
539
|
+
api.stopListeningAsync = msgEmitter.stopListeningAsync;
|
|
540
|
+
api.forceReconnect = forceCycle;
|
|
541
|
+
api.isMqttConnected = isConnected;
|
|
542
|
+
return msgEmitter;
|
|
543
|
+
}
|
|
544
|
+
|
|
531
545
|
if (!ctx.firstListen) ctx.lastSeqId = null;
|
|
532
546
|
ctx.syncToken = undefined;
|
|
533
547
|
ctx.t_mqttCalled = false;
|