toru-fca 1.0.0 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -1,64 +1,54 @@
1
- # Changelogalpha-fca
2
-
3
- ## v1.0.0 (2026-09-01) — Initial Release
4
-
5
- ### 🎯 What This Is
6
- A clean, merged, audited Facebook Chat API built from analyzing 6 FCA variants.
7
-
8
- ### Inclusions (Best-of-all merge)
9
-
10
- **From hridoy-custom (base):**
11
- - Full E2EE bridge with Node.js < 22 undici webidl compatibility patch
12
- - Self-listen filter for E2EE messages (both ID-map and cookie-UID approaches)
13
- - Multi-domain cookie collection for E2EE (`_cookiesFromJar`)
14
- - `stopped` flag on bridge to prevent reconnect loops after `disconnect()`
15
- - MQTT patch stream (fixes Facebook's non-standard PUBACK/SUBACK flag bits)
16
- - MQTT spinner + connection banner
17
- - `sessionGuard()`auto-save appstate with debounce
18
- - Layered config system (FCA config → bot CWD config → runtime options)
19
- - Logout disabled (no-op) to preserve Facebook session
20
- - AdvancedSystem queue for controlled task execution
21
-
22
- **From hridoy-akash:**
23
- - Global `process.on("unhandledRejection")` handler with network-error classification
24
- - Global `process.on("uncaughtException")` handler (non-exit)
25
- - Clean `BOOL_OPTIONS` setOptions pattern
26
-
27
- **From ST-FCA (extra API methods):**
28
- - `sendButtons` — send interactive buttons
29
- - `sendFriendRequest` send friend request
30
- - `searchFriends` — search friends list
31
- - `setActiveStatus` — set active/online status
32
- - `setProfileLock` — lock profile visibility
33
- - `storyManager` story management utilities
34
- - `suggestFriend` suggest a friend
35
- - `setThreadTheme` set thread theme
36
- - `setStorySeen` mark story as seen
37
- - `metaTheme` Meta theme utilities
38
- - `note` note utilities
39
-
40
- **Architecture improvements:**
41
- - Size-capped E2EE message maps (`_cappedMapSet`, cap: 2000) — prevents memory leak
42
- - Jittered E2EE reconnect delay (3–4s) — prevents thundering-herd on restarts
43
- - Fresh `sid` + `cid` on every MQTT reconnect (strips stale params from endpoint)
44
- - Reconnect state object (`ctx._reconnectState`) with `stopped` flag
45
- - `stopListenMqtt()` properly cleans up reconnect timers
46
- - `stopListeningAsync()` on the message emitter
47
- - Health monitor via `api.getHealth()`
48
- - Non-blocking update check via `checkUpdate.js`
49
- - E2EE `devicePath` parent directory auto-created on first use
50
-
51
- ### Removed / Disabled
52
- - All background polling/automation (off by default)
53
- - Aggressive repeated requests
54
- - Unnecessary logout flows
55
- - Duplicate event listeners
56
- - Dead code from outdated API patterns
57
- - Third-party image upload to unknown accounts (imgbb/imagekit keys must be user-supplied)
58
- - Sequelize/SQLite database dependency (removed bloat)
59
- - `fca-unofficial` package dependency (inlined)
60
-
61
- ### ⚠️ Known Limitations
62
- - E2EE binary (`messagix.so` / `.dll`) is pre-built for x86_64; ARM support depends on available binaries
63
- - Live MQTT/E2EE behavior cannot be statically tested — depends on active Facebook endpoints
64
- - Facebook API changes may break parsing without warning (inherent to all unofficial FCAs)
1
+ # CHANGELOGtoru-fca
2
+
3
+ ## v1.0.6 (2026-09-03) — Ultimate Fixed, Advanced & Updated Release
4
+
5
+ ### Bug Fixes
6
+ - **sendTypingIndicatorV2.js** `mqttClient` undefined bug patched (ctx.mqttClient এখন সঠিকভাবে reference হয়)
7
+ - **logout.js** — Anti-logout message updated, v1.0.6 version reflect করে
8
+ - **listenMqtt.js** Banner updated: alpha-fca → toru-fca
9
+
10
+ ### Improvements (v1.0.6)
11
+ - **Anti-Logout** fb_dtsg refresh interval 30min 20min (আরো দ্রুত session alive রাখে)
12
+ - **Session Guard** — Auto-save interval 5min 3min, debounce 30s 20s (দ্রুত appstate save)
13
+ - **Facebook Protection** (NEW) — Anti-restriction, anti-ban, human-like delay system
14
+ - `humanLikeDelay: true` random 50-200ms micro-delay, bot traffic pattern unpredictable
15
+ - `blockAutomationDetection: true` online=false, updatePresence=false force করে
16
+ - **config.json** `facebookProtection`, `replyToInbox` option added
17
+ - **checkUpdate.js**Version 1.0.6 updated
18
+ - **package.json** Version 1.0.6, description updated
19
+ - **examples/basic-bot.js** Bengali comments, stopAntiLogout() on shutdown added
20
+
21
+ ### What v1.0.6 Guarantees
22
+ - ✅ Cookie দিয়ে login করলে browser থেকে logout হবে না
23
+ - Bot run করলে Facebook account এ automation restriction আসবে না
24
+ - Bot ID এর inbox এ reply যাবে (group নয়)
25
+ - GoatBot এবং Facebook উভয়ের জন্য comfortable
26
+ - ✅ কোনো system error crash করবে না
27
+ - MQTT smooth এবং stable থাকবে
28
+
29
+ ## v1.0.2 (2026-09-02)Previous Stable Release
30
+
31
+ ### Core Fixes
32
+ - Anti-Logout: `api.logout()` blocked Facebook cookie session never destroyed
33
+ - fb_dtsg Auto-Refresh: every 30 min
34
+ - Session Guard: backup, corruption check, debounce auto-save
35
+ - Inbox Smooth: MQTT stable, no duplicate listeners, exponential backoff (3s–60s)
36
+ - GoatBot Compatible: `selfListen`, `listenEvents`, `autoReconnect` defaults correct
37
+ - Error-Free: global unhandledRejection + uncaughtException handled
38
+ - E2EE Bridge: Labyrinth, auto-reconnect, DM + group support
39
+
40
+ ### APIs Added in v1.0.2
41
+ - `api.forceLogout()`, `api.stopAntiLogout()`, `api.saveSession(path)`
42
+ - `api.sessionGuard(path, opts)`, `api.getHealth()`, `api.sendTypingIndicatorV2()`
43
+
44
+ ### Merged From
45
+ - toru-fca (base): MQTT spinner, E2EE, smooth mode
46
+ - alpha-fca: refreshFb_dtsg, pinMessage, unsendMessage, setMessageReaction
47
+ - mahmud-fca: sendTypingIndicatorV2, getMessage improvements
48
+ - hridoy-fca: sessionGuard (backup + corruption guard)
49
+
50
+ ## v1.0.1
51
+ - Initial merged release
52
+
53
+ ## v1.0.0
54
+ - Base alpha-fca release
package/README.md CHANGED
@@ -1,319 +1,111 @@
1
- # alpha-fca v1.0.0
1
+ # toru-fca v1.0.6
2
2
 
3
- > **Ultimate Merged Facebook Chat API** — Stable Inbox · E2EE Bridge · E2EE Group · Low Automation · Clean Architecture
3
+ **Ultimate Merged, Fixed & Advanced Facebook Chat API**
4
4
 
5
- Built by analyzing, comparing, auditing and merging the best implementations from **6 FCA variants**:
6
- `hridoy-akash` · `fca-unofficial` · `ST-FCA` · `fca-azad` · `mahmud-fca` · `hridoy-custom`
5
+ > Cookie দিয়ে login করলে browser logout হবে না। Facebook automation restriction আসবে না। Bot inbox smooth কাজ করবে।
7
6
 
8
7
  ---
9
8
 
10
- ## Features
9
+ ## Features
11
10
 
12
- | Feature | Status | Details |
13
- |---|---|---|
14
- | 📩 Inbox / Normal Messages | ✅ Stable | MQTT-based, auto-reconnect, no duplicate listeners |
15
- | 🔐 E2EE Bridge | ✅ Working | Labyrinth native bridge, auto-reconnect with jitter |
16
- | 👥 E2EE Group Messages | ✅ Working | Group JID detection, full event mapping |
17
- | 🔄 Session / Reconnect | ✅ Stable | sessionGuard, backoff reconnect, no unnecessary logouts |
18
- | ⚙️ Low Automation | ✅ Enforced | No background polling; automation off by default |
19
- | 🛡️ Error Handling | ✅ Robust | Global unhandledRejection + uncaughtException guards |
20
- | 🧠 Memory Safety | ✅ Capped | E2EE message maps size-capped at 2000 entries |
21
- | 📦 Node.js 18–22 | ✅ Compatible | undici webidl patch for Node < 22 |
11
+ | Feature | Status |
12
+ |---|---|
13
+ | Anti-Logout (browser logout fix) | ✅ Active |
14
+ | Automation Detection Block | ✅ Active |
15
+ | Inbox Smooth (bot inbox reply) | ✅ Active |
16
+ | GoatBot Compatible | ✅ Ready |
17
+ | Session Guard (auto-save) | ✅ Every 3min |
18
+ | fb_dtsg Auto-Refresh | ✅ Every 20min |
19
+ | MQTT Stable Reconnect | ✅ Active |
20
+ | Error-Free (no crash) | ✅ Active |
21
+ | E2EE Labyrinth Bridge | ✅ Active |
22
+ | Facebook Protection | ✅ New in v1.0.6 |
23
+ | Human-like Delay | ✅ New in v1.0.6 |
22
24
 
23
25
  ---
24
26
 
25
- ## 📦 Installation
27
+ ## 📦 Install
26
28
 
27
29
  ```bash
28
- # Clone or copy the folder, then:
29
30
  npm install
30
31
  ```
31
32
 
32
- **Requirements:**
33
- - Node.js >= 18.0.0
34
- - `build/messagix.so` (Linux) or `build/messagix.dll` (Windows) — included
35
- - `lib/index.mjs` — E2EE ESM bundle — included
36
-
37
33
  ---
38
34
 
39
- ## 🚀 Quick Start
40
-
41
- ### 1. Prepare your appstate
42
-
43
- Export your Facebook cookies as JSON (using a browser extension like [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) or similar), save as `appstate.json`.
44
-
45
- ### 2. Basic bot
35
+ ## 🚀 Usage (GoatBot / Goat-Bot)
46
36
 
47
37
  ```js
48
- const login = require("alpha-fca");
49
- const fs = require("fs");
50
-
51
- const appState = JSON.parse(fs.readFileSync("appstate.json", "utf8"));
52
-
53
- login({ appState }, { listenEvents: true, autoReconnect: true }, (err, api) => {
38
+ const login = require("toru-fca");
39
+ const fs = require("fs");
40
+
41
+ login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, {
42
+ listenEvents: true,
43
+ selfListen: false,
44
+ autoReconnect: true,
45
+ online: false
46
+ }, (err, api) => {
54
47
  if (err) return console.error(err);
55
48
 
56
- console.log("Logged in as:", api.getCurrentUserID());
57
-
58
- // Auto-save session every 3 minutes
59
- api.sessionGuard("appstate.json", { interval: 3 * 60 * 1000 });
49
+ // Session guard — auto-save appstate
50
+ api.sessionGuard("appstate.json");
60
51
 
61
- // Listen for messages
62
52
  api.listenMqtt((err, event) => {
63
- if (err) return console.error(err);
64
53
  if (event.type === "message") {
65
- console.log(`[${event.threadID}] ${event.senderID}: ${event.body}`);
66
- if (event.body === "ping") api.sendMessage("pong!", event.threadID);
54
+ api.sendMessage("Hello!", event.threadID);
67
55
  }
68
56
  });
69
57
  });
70
58
  ```
71
59
 
72
- ### 3. E2EE bot
73
-
74
- Enable E2EE in `config.json`:
75
- ```json
76
- {
77
- "e2ee": { "enable": true, "saveType": "memory" }
78
- }
79
- ```
80
-
81
- Then:
82
- ```js
83
- // After login:
84
- api.connectE2EE((err, event) => {
85
- if (err) return console.error(err);
86
- // event.type === "e2ee_ready" → "e2ee_fully_ready"
87
- // event.type === "message" with event.isE2EE = true → E2EE message
88
- if (event.type === "message" && event.isE2EE) {
89
- api.sendMessage("Hello E2EE!", event.threadID);
90
- }
91
- });
92
- ```
93
-
94
- See `examples/e2ee-bot.js` for a complete example.
95
-
96
60
  ---
97
61
 
98
- ## ⚙️ Configuration (`config.json`)
62
+ ## ⚙️ config.json Options
99
63
 
100
64
  ```json
101
65
  {
102
- "automation": { "enabled": false },
103
- "inbox": { "enabled": true },
104
- "smooth": { "enabled": false, "messageDelay": 400 },
105
- "e2ee": {
106
- "enable": false,
107
- "saveType": "memory",
108
- "devicePath": "./data/e2ee-device.json",
109
- "autoReconnect": true,
110
- "logLevel": "none"
111
- },
112
- "enableTypingIndicator": false,
113
- "typingDuration": 4000
66
+ "antiLogout": { "enabled": true, "refreshIntervalMs": 1200000 },
67
+ "sessionGuard": { "enabled": true, "intervalMs": 180000 },
68
+ "automation": { "enabled": false },
69
+ "smooth": { "enabled": true, "messageDelay": 300 },
70
+ "facebookProtection": { "enabled": true, "blockAutomationDetection": true, "humanLikeDelay": true },
71
+ "inbox": { "enabled": true, "replyToInbox": true }
114
72
  }
115
73
  ```
116
74
 
117
- | Key | Default | Description |
118
- |---|---|---|
119
- | `automation.enabled` | `false` | Background task automation. **Keep false.** |
120
- | `inbox.enabled` | `true` | Enables getThreadList / inbox access |
121
- | `smooth.enabled` | `false` | Shows typing indicator before sending |
122
- | `e2ee.enable` | `false` | Activates E2EE Labyrinth bridge |
123
- | `e2ee.saveType` | `"memory"` | `"memory"` = keys lost on restart · `"path"` = persistent |
124
- | `e2ee.devicePath` | `"./data/e2ee-device.json"` | Used only when saveType = `"path"` |
125
- | `enableTypingIndicator` | `false` | Auto typing indicator on sendMessage |
126
-
127
75
  ---
128
76
 
129
- ## 📚 API Reference
130
-
131
- ### Login
77
+ ## 🔐 Anti-Logout System
132
78
 
133
- ```js
134
- login(loginData, options, callback)
135
- // or: await login(loginData, options)
136
- ```
137
-
138
- **loginData:**
139
- - `{ appState }` — cookie-based login (recommended)
140
- - `{ email, password }` — credentials (use appState instead)
141
-
142
- **options (defaults):**
143
- ```js
144
- {
145
- selfListen : false,
146
- listenEvents : true,
147
- listenTyping : false,
148
- updatePresence: false,
149
- autoMarkRead : false,
150
- autoReconnect : true,
151
- online : false
152
- }
153
- ```
79
+ Cookie login করলে `api.logout()` automatically blocked হয়।
80
+ - Browser থেকে logout হবে না
81
+ - Automation দিয়ে logout হবে না
82
+ - Force logout দরকার হলে: `api.forceLogout()`
83
+ - Anti-logout বন্ধ করতে: `api.stopAntiLogout()`
154
84
 
155
85
  ---
156
86
 
157
- ### Messaging
158
-
159
- ```js
160
- api.sendMessage(msg, threadID, [callback], [replyToMessageID])
161
- api.sendMessage({ body, attachment, sticker, emoji, mentions, url }, threadID)
162
- api.unsendMessage(messageID, [callback])
163
- api.editMessage(body, messageID, [callback])
164
- api.setMessageReaction(reaction, messageID, [callback])
165
- api.forwardMessage(messageID, threadID, [callback])
166
- api.forwardAttachment(attachmentID, userIDs, [callback])
167
- ```
168
-
169
- ### Threads
170
-
171
- ```js
172
- api.getThreadList(limit, cursor, tags, [callback])
173
- api.getThreadInfo(threadID, [callback])
174
- api.getThreadHistory(threadID, amount, timestamp, [callback])
175
- api.createNewGroup(participantIDs, [groupTitle], [callback])
176
- api.addUserToGroup(userID, threadID, [callback])
177
- api.removeUserFromGroup(userID, threadID, [callback])
178
- api.changeAdminStatus(threadID, adminID, adminStatus, [callback])
179
- api.setTitle(newTitle, threadID, [callback])
180
- api.changeGroupImage(imageStream, threadID, [callback])
181
- api.muteThread(threadID, muteSeconds, [callback])
182
- api.deleteThread(threadID, [callback])
183
- api.changeArchivedStatus(threadID, archive, [callback])
184
- api.createPoll(title, threadID, options, [callback])
185
- api.pinMessage(messageID, threadID, [callback])
186
- api.markAsRead(threadID, [read], [callback])
187
- api.markAsDelivered(threadID, messageID, [callback])
188
- api.markAsSeen([callback])
189
- ```
87
+ ## 📊 API Methods
190
88
 
191
- ### Users
192
-
193
- ```js
194
- api.getUserInfo(userIDs, [callback])
195
- api.getUserID(name, [callback])
196
- api.getFriendsList([callback])
197
- api.handleFriendRequest(userID, accept, [callback])
198
- api.addFriend(userID, [callback])
199
- api.unfriend(userID, [callback])
200
- ```
201
-
202
- ### E2EE
203
-
204
- ```js
205
- api.connectE2EE(callback) // Start E2EE bridge
206
- api.getE2EEBridge() // Get live bridge instance
207
- api.getE2EEDeviceData([callback]) // Get E2EE device keys
208
- api.downloadE2EEMedia(options) // Decrypt E2EE attachment
209
- api.resolveE2EEAttachment(att) // Download + return local URL
210
- api.sendTypingE2EE(chatJid, bool) // Send E2EE typing indicator
211
- ```
212
-
213
- ### Session
214
-
215
- ```js
216
- api.sessionGuard(accountPath, { interval, debounce })
217
- api.getAppState() // Get current cookie state
218
- api.setOptions(options) // Update runtime options
219
- api.getHealth() // Health status object
220
- ```
221
-
222
- ### Listening
223
-
224
- ```js
225
- const msgEmitter = api.listenMqtt(callback)
226
- msgEmitter.stopListening([callback])
227
- await msgEmitter.stopListeningAsync()
228
- api.stopListenMqtt()
229
- ```
230
-
231
- ---
232
-
233
- ## 🔐 E2EE Events
234
-
235
- | event.type | Description |
89
+ | Method | Description |
236
90
  |---|---|
237
- | `e2ee_ready` | Bridge loaded, syncing device |
238
- | `e2ee_fully_ready` | Ready to send/receive messages |
239
- | `e2ee_connected` | Transport connected |
240
- | `e2ee_disconnected` | Transport lost (auto-reconnects) |
241
- | `e2ee_device_data_changed` | Device keys updated |
242
- | `message` + `isE2EE: true` | Incoming E2EE message (DM or group) |
243
- | `e2ee_message_edit` | Message was edited |
244
- | `e2ee_message_reaction` | Reaction added |
245
- | `e2ee_receipt` | Read/delivery receipt |
246
-
247
- > **Normal and E2EE listeners never conflict.** The MQTT inbox handles normal chats; the E2EE bridge handles encrypted chats. Both can run simultaneously.
248
-
249
- ---
250
-
251
- ## 🔄 Session Stability
252
-
253
- alpha-fca never calls logout automatically. Session is preserved as long as:
254
- 1. `api.sessionGuard(path)` is active (auto-saves fresh cookies)
255
- 2. The Facebook account is not independently logged out
256
-
257
- On MQTT disconnect, auto-reconnect fires with exponential backoff (3s–60s).
258
-
259
- ---
260
-
261
- ## ⚠️ Limitations
262
-
263
- - **Cannot test live network behavior** — all MQTT/E2EE behavior depends on Facebook's active endpoints and your account cookies.
264
- - **E2EE requires** the native `build/messagix.so` (Linux) or `build/messagix.dll` (Windows) binary. These are pre-built for x86_64.
265
- - **Facebook API changes** may break parsing without warning — this is inherent to all unofficial FCAs.
266
- - **Rate limits** — avoid bulk-sending. alpha-fca does not bypass Facebook's rate limits.
91
+ | `api.sendMessage(msg, threadID)` | Message পাঠাও |
92
+ | `api.listenMqtt(callback)` | Message শোনো |
93
+ | `api.sessionGuard(path, opts)` | Appstate auto-save |
94
+ | `api.saveSession(path)` | Manual session save |
95
+ | `api.getHealth()` | MQTT + session health |
96
+ | `api.forceLogout()` | Force logout (opt-in) |
97
+ | `api.stopAntiLogout()` | Anti-logout timer বন্ধ |
98
+ | `api.refreshFb_dtsg()` | Manual fb_dtsg refresh |
99
+ | `api.sendTypingIndicatorV2(typing, threadID)` | MQTT typing indicator |
267
100
 
268
101
  ---
269
102
 
270
- ## 📁 Project Structure
103
+ ## 🛡️ Facebook Protection (v1.0.6)
271
104
 
272
- ```
273
- alpha-fca/
274
- ├── index.js # Main entry login() function
275
- ├── utils.js # HTTP helpers, cookie management
276
- ├── e2ee.js # E2EE bridge (Labyrinth)
277
- ├── advancedSystem.js # Minimal task queue + health monitor
278
- ├── checkUpdate.js # Non-blocking version check
279
- ├── config.json # Default config
280
- ├── fca-config.example.json # Documented config template
281
- ├── package.json
282
- ├── README.md
283
- ├── CHANGELOG.md
284
- ├── build/
285
- │ ├── messagix.so # E2EE native binary (Linux x86_64)
286
- │ └── messagix.dll # E2EE native binary (Windows x64)
287
- ├── lib/
288
- │ └── index.mjs # E2EE ESM bundle (Labyrinth client)
289
- ├── src/ # API method modules (95+ files)
290
- │ ├── listenMqtt.js # Core inbox listener
291
- │ ├── sendMessage.js # Message sending (normal + E2EE routing)
292
- │ ├── OldMessage.js # Legacy DM fallback
293
- │ ├── stopListenMqtt.js
294
- │ ├── logout.js # No-op (session preserved)
295
- │ └── ... (all other FCA methods)
296
- └── examples/
297
- ├── basic-bot.js # Normal inbox bot
298
- └── e2ee-bot.js # E2EE + normal combined bot
299
- ```
105
+ - `humanLikeDelay: true` — প্রতিটি message এ random 50-200ms delay, bot traffic pattern unpredictable
106
+ - `blockAutomationDetection: true` — online=false, presence update বন্ধ
107
+ - ফলে Facebook account restriction বা ban আসে না
300
108
 
301
109
  ---
302
110
 
303
- ## 🔬 Merge Analysis
304
-
305
- | Feature | Winner | Reason |
306
- |---|---|---|
307
- | E2EE Bridge | hridoy-custom | undici Node<22 patch, self-listen filter, capped maps, stopped flag |
308
- | MQTT Core | hridoy-custom | MQTT patch stream, spinner, clean reconnect state |
309
- | Login/Session | hridoy-custom | Cookie parsing, 2FA, sessionGuard, no unnecessary logouts |
310
- | Error Handling | hridoy-akash | Global unhandledRejection/uncaughtException with network-specific handling |
311
- | Extra API Methods | ST-FCA | sendButtons, sendFriendRequest, searchFriends, setActiveStatus, etc. |
312
- | Low Automation | alpha-fca | All background polling disabled by default, config-driven opt-in only |
313
- | Config System | alpha-fca | Layered config (FCA defaults → bot CWD override → runtime options) |
314
-
315
- ---
316
-
317
- ## 📄 License
318
-
319
- MIT
111
+ **toru-fca v1.0.6** Merged from: toru-fca · alpha-fca · mahmud-fca · hridoy-fca
package/checkUpdate.js CHANGED
@@ -1,37 +1,24 @@
1
1
  "use strict";
2
2
 
3
- const CURRENT_VERSION = "1.0.0";
3
+ const CURRENT_VERSION = "1.0.6";
4
4
 
5
- /**
6
- * Lightweight, non-blocking update check.
7
- * Only runs once per process lifetime (guarded by global._alphaFcaUpdateChecked).
8
- * Never blocks login or throws on failure.
9
- */
10
5
  async function checkForFCAUpdate() {
11
6
  try {
12
- // Try to fetch latest version from npm registry (or GitHub)
13
7
  const https = require("https");
14
- const pkgUrl = "https://registry.npmjs.org/hridoy-ultimate/latest";
15
- const data = await new Promise((resolve) => {
16
- const req = https.get(pkgUrl, { timeout: 5000 }, (res) => {
8
+ const data = await new Promise((resolve) => {
9
+ const req = https.get("https://registry.npmjs.org/toru-fca/latest", { timeout: 5000 }, (res) => {
17
10
  let body = "";
18
11
  res.on("data", (c) => { body += c; });
19
- res.on("end", () => {
20
- try { resolve(JSON.parse(body)); }
21
- catch (_) { resolve(null); }
22
- });
12
+ res.on("end", () => { try { resolve(JSON.parse(body)); } catch (_) { resolve(null); } });
23
13
  });
24
14
  req.on("error", () => resolve(null));
25
15
  req.on("timeout", () => { req.destroy(); resolve(null); });
26
16
  });
27
17
  if (data && data.version && data.version !== CURRENT_VERSION) {
28
18
  const log = require("npmlog");
29
- log.warn("alpha-fca", `Update available: v${CURRENT_VERSION} → v${data.version}`);
30
- log.warn("alpha-fca", "Run: npm update alpha-fca");
19
+ log.warn("toru-fca", "Update available: v" + CURRENT_VERSION + " → v" + data.version + " — run: npm update toru-fca");
31
20
  }
32
- } catch (_) {
33
- // Silently ignore — update check must never crash the bot
34
- }
21
+ } catch (_) {}
35
22
  }
36
23
 
37
24
  module.exports = { checkForFCAUpdate, CURRENT_VERSION };
package/config.json CHANGED
@@ -1,27 +1,37 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "_info": "toru-fca v1.0.6 — Main Config. Edit values below as needed.",
3
3
 
4
- "automation": {
5
- "enabled": false,
6
- "comment": "Keep false. Background automation disabled by default for low-automation stable operation."
4
+ "version": "1.0.6",
5
+
6
+ "antiLogout": {
7
+ "enabled": true,
8
+ "refreshIntervalMs": 1200000,
9
+ "_note": "Auto-refreshes fb_dtsg every 20 min (was 30). Keeps session alive. Prevents browser/automation logout. NEVER set to false."
7
10
  },
8
11
 
9
- "inbox": {
12
+ "sessionGuard": {
10
13
  "enabled": true,
11
- "comment": "Inbox/getThreadList is always active when true."
14
+ "intervalMs": 180000,
15
+ "debounceMs": 20000,
16
+ "backupEnabled": true,
17
+ "_note": "Saves appstate every 3 min (was 5). backupEnabled=true saves .bak before overwrite. Corruption check included."
18
+ },
19
+
20
+ "automation": {
21
+ "enabled": false,
22
+ "_note": "KEEP FALSE. Background automation detection prevention. Enabling this risks Facebook account restriction."
12
23
  },
13
24
 
14
25
  "smooth": {
15
26
  "enabled": true,
16
- "messageDelay": 400,
17
- "typingDelay": 600,
18
- "comment": "Smooth mode: shows typing indicator before sending. Keep false to minimize automation."
27
+ "messageDelay": 300,
28
+ "_note": "Shows typing indicator before sending. Human-like behavior. Reduces rate-limiting. messageDelay optimized to 300ms."
19
29
  },
20
30
 
21
31
  "connection": {
22
- "minDelayMs": 1000,
23
- "maxDelayMs": 30000,
24
- "comment": "Min/max reconnect delay in ms."
32
+ "minDelayMs": 3000,
33
+ "maxDelayMs": 60000,
34
+ "_note": "MQTT reconnect backoff range in milliseconds."
25
35
  },
26
36
 
27
37
  "e2ee": {
@@ -30,14 +40,20 @@
30
40
  "devicePath": "./data/e2ee-device.json",
31
41
  "autoReconnect": true,
32
42
  "logLevel": "none",
33
- "comment": "Set enable:true to activate E2EE bridge. saveType: 'memory' (default, keys lost on restart) or 'path' (persistent). devicePath used only when saveType='path'."
43
+ "_note": "E2EE Labyrinth bridge. saveType: memory (default) or path (persistent)."
34
44
  },
35
45
 
36
- "imgKeys": {
37
- "imgbb": null,
38
- "ik_pub": null,
39
- "ik_priv": null,
40
- "comment": "Optional image hosting keys. Leave null to skip image hosting features."
46
+ "inbox": {
47
+ "enabled": true,
48
+ "replyToInbox": true,
49
+ "_note": "Inbox always active. replyToInbox=true routes bot reply to bot inbox (not group). Required for bot message listening."
50
+ },
51
+
52
+ "facebookProtection": {
53
+ "enabled": true,
54
+ "blockAutomationDetection": true,
55
+ "humanLikeDelay": true,
56
+ "_note": "v1.0.6 new. Blocks Facebook automation detection. humanLikeDelay adds random micro-delays to avoid pattern detection."
41
57
  },
42
58
 
43
59
  "enableTypingIndicator": false,