nexus-fca 3.0.3 → 3.0.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.
@@ -14,7 +14,8 @@ NEXUS_PERSISTENT_DEVICE=true # Enable consistent device fingerprinting (defau
14
14
  NEXUS_DEVICE_FILE=./device.json # Custom path to device profile file
15
15
 
16
16
  # Single-session guard (built-in)
17
- # Uses SingleSessionGuard with NEXUS_SESSION_LOCK_PATH and NEXUS_FORCE_LOCK
17
+ # Toggle and configure SingleSessionGuard
18
+ NEXUS_SESSION_LOCK_ENABLED=true # Enable/disable lock globally (default true)
18
19
  NEXUS_SESSION_LOCK_PATH=./lock # Path to session lock file used by SingleSessionGuard
19
20
  NEXUS_FORCE_LOCK=false # Force acquire lock even if lock exists
20
21
 
@@ -62,8 +63,8 @@ const api = await login({
62
63
  // Session stability options
63
64
  persistentDevice: true, // Use consistent device fingerprinting
64
65
  deviceFilePath: './device.json', // Custom device profile path
65
- // Single-session guard is enabled by default internally
66
- // Configure via env: NEXUS_SESSION_LOCK_PATH, NEXUS_FORCE_LOCK
66
+ // Single-session guard (optional toggle)
67
+ sessionLockEnabled: true, // or control via env NEXUS_SESSION_LOCK_ENABLED
67
68
 
68
69
  // Connection options
69
70
  region: 'NA', // Set fixed region
package/index.js CHANGED
@@ -1371,12 +1371,18 @@ async function login(loginData, options = {}, callback) {
1371
1371
  mainLogger.info('✅ Session generated successfully');
1372
1372
  mainLogger.info('🔄 Starting bot with generated session (old system)');
1373
1373
 
1374
- // STEP 2: Single session guard before starting bot
1374
+ // STEP 2: Single session guard before starting bot (configurable)
1375
1375
  try {
1376
- const ssg = new SingleSessionGuard({ dataDir: process.env.NEXUS_DATA_DIR });
1377
- ssg.acquire();
1378
- // keep guard reference to release on exit
1379
- global.__NEXUS_SSG__ = ssg;
1376
+ const lockEnabled = (typeof options.sessionLockEnabled !== 'undefined')
1377
+ ? !!options.sessionLockEnabled
1378
+ : !(process.env.NEXUS_SESSION_LOCK_ENABLED === '0' || (process.env.NEXUS_SESSION_LOCK_ENABLED || '').toLowerCase() === 'false');
1379
+
1380
+ if (lockEnabled) {
1381
+ const ssg = new SingleSessionGuard({ dataDir: process.env.NEXUS_DATA_DIR });
1382
+ ssg.acquire();
1383
+ // keep guard reference to release on exit
1384
+ global.__NEXUS_SSG__ = ssg;
1385
+ }
1380
1386
  } catch (e) {
1381
1387
  mainLogger.error('⚠️ Single session guard blocked start', e.message);
1382
1388
  if (callback) callback(e);
@@ -1426,9 +1432,15 @@ async function login(loginData, options = {}, callback) {
1426
1432
 
1427
1433
  // Direct session authentication using appstate (with single session guard)
1428
1434
  try {
1429
- const ssg = new SingleSessionGuard({ dataDir: process.env.NEXUS_DATA_DIR });
1430
- ssg.acquire();
1431
- global.__NEXUS_SSG__ = ssg;
1435
+ const lockEnabled = (typeof options.sessionLockEnabled !== 'undefined')
1436
+ ? !!options.sessionLockEnabled
1437
+ : !(process.env.NEXUS_SESSION_LOCK_ENABLED === '0' || (process.env.NEXUS_SESSION_LOCK_ENABLED || '').toLowerCase() === 'false');
1438
+
1439
+ if (lockEnabled) {
1440
+ const ssg = new SingleSessionGuard({ dataDir: process.env.NEXUS_DATA_DIR });
1441
+ ssg.acquire();
1442
+ global.__NEXUS_SSG__ = ssg;
1443
+ }
1432
1444
  } catch (e) {
1433
1445
  mainLogger.error('⚠️ Single session guard blocked start', e.message);
1434
1446
  if (callback) callback(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexus-fca",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Nexus-FCA 3.0 – stable, low-risk Facebook Messenger automation API with integrated secure login (ID / Password / 2FA), adaptive MQTT core, safety orchestration, metrics, and TypeScript support.",
5
5
  "main": "index.js",
6
6
  "repository": {