toru-fca 1.0.0 → 1.0.5
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 +45 -55
- package/README.md +111 -264
- package/checkUpdate.js +49 -27
- package/config.json +54 -18
- package/examples/basic-bot.js +138 -0
- package/examples/e2ee-bot.js +141 -0
- package/fca-config.example.json +79 -0
- package/index.js +593 -361
- package/package.json +9 -46
- package/src/logout.js +10 -9
- package/src/send.js +28 -2
- package/src/sendTypingIndicatorV2.js +51 -0
- package/build/messagix.dll +0 -0
- package/build/messagix.so +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,64 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CHANGELOG — toru-fca
|
|
2
2
|
|
|
3
|
-
## v1.0.
|
|
3
|
+
## v1.0.5 (Latest) — Full Advanced Fixed, Anti-Restriction, Smooth & Comfortable
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
A clean, merged, audited Facebook Chat API built from analyzing 6 FCA variants.
|
|
5
|
+
### 🔥 New in v1.0.5
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
#### ✅ Anti-Logout System v3 (Enhanced)
|
|
8
|
+
- fb_dtsg auto-refresh interval: **30min → 20min** (more stable session)
|
|
9
|
+
- Cookie revalidation: every **15min** background check (NEW)
|
|
10
|
+
- `api.stopAutomationGuard()` — graceful stop added
|
|
11
|
+
- Startup feature banner (log summary of all enabled features)
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
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
|
|
13
|
+
#### ✅ Session Guard v2 (Improved)
|
|
14
|
+
- Auto-save interval: **5min → 4min** (faster appstate persistence)
|
|
15
|
+
- Debounce: **30s → 20s** (faster reaction to cookie changes)
|
|
16
|
+
- `minCookieCount` config field — skip save if state has too few cookies
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
- Global `process.on("uncaughtException")` handler (non-exit)
|
|
25
|
-
- Clean `BOOL_OPTIONS` setOptions pattern
|
|
18
|
+
#### ✅ Smooth Mode v2
|
|
19
|
+
- Message delay: **500ms → 400ms** (faster but still human-like)
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
-
|
|
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
|
|
21
|
+
#### ✅ Anti-Ban v2 (Tuned)
|
|
22
|
+
- Human delay range: **300-1200ms → 200-900ms** (faster, still safe)
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
-
|
|
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
|
|
24
|
+
#### ✅ MQTT Reconnect v2 (Tuned)
|
|
25
|
+
- Backoff range: **3s-60s → 2s-45s** (faster recovery on disconnect)
|
|
50
26
|
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
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)
|
|
27
|
+
#### ✅ Login Retry (NEW)
|
|
28
|
+
- Transient network error e automatically 3x retry with 5s delay
|
|
29
|
+
- Config: `loginSafety.maxRetries`, `loginSafety.retryDelayMs`
|
|
60
30
|
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
#### ✅ send.js Fix (Critical)
|
|
32
|
+
- `ctx.mqttClient` null check added — crash hobe na MQTT not ready thakte
|
|
33
|
+
|
|
34
|
+
#### ✅ Inbox v2
|
|
35
|
+
- `inbox.replyToDM` / `inbox.replyToGroup` separate config field
|
|
36
|
+
- DM + Group dono jaigai bot reply correctly kore
|
|
37
|
+
|
|
38
|
+
#### ✅ typingDuration
|
|
39
|
+
- Default: **4000ms → 3500ms** (slightly faster typing indicator)
|
|
40
|
+
|
|
41
|
+
#### ✅ Examples Updated
|
|
42
|
+
- `basic-bot.js`: `!health`, `!help` commands, graceful final save on SIGINT
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## v1.0.4 — Ultimate Merged, Fixed & Anti-Restriction
|
|
47
|
+
- Anti-Logout v2, Session Guard, Cookie String support, GoatBot defaults
|
|
48
|
+
- sendTypingV2 fix, MQTT exponential backoff
|
|
49
|
+
- Merged: toru-fca v1.0.3 · shan-fca · hridoy-fca · ws3-fca
|
|
50
|
+
|
|
51
|
+
## v1.0.3 — sendTypingIndicatorV2 fix, antiBan humanDelay, cookieProtect
|
|
52
|
+
## v1.0.2 — Anti-Logout, Session Guard, Smooth Mode, E2EE, GoatBot defaults
|
|
53
|
+
## v1.0.1 — Initial merged release
|
|
54
|
+
## v1.0.0 — Base alpha-fca release
|
package/README.md
CHANGED
|
@@ -1,319 +1,166 @@
|
|
|
1
|
-
#
|
|
1
|
+
# toru-fca v1.0.5
|
|
2
2
|
|
|
3
|
-
> **Ultimate Merged Facebook Chat API**
|
|
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`
|
|
3
|
+
> **Ultimate Merged, Fixed & Advanced Facebook Chat API**
|
|
4
|
+
> Anti-Logout v3 · Anti-Ban v2 · Smooth Inbox · GoatBot Compatible · Error-Free · Login Retry
|
|
7
5
|
|
|
8
6
|
---
|
|
9
7
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
| Feature | Status |
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
8
|
+
## ✅ Features
|
|
9
|
+
|
|
10
|
+
| Feature | Status | Notes |
|
|
11
|
+
|---------|--------|-------|
|
|
12
|
+
| Anti-Logout v3 (Browser Logout Fix) | ✅ Enabled | fb_dtsg refresh every 20min |
|
|
13
|
+
| Automation Logout Fix | ✅ Enabled | Cookie revalidate every 15min |
|
|
14
|
+
| Login Retry | ✅ Enabled | 3x retry on network error |
|
|
15
|
+
| Inbox Bot Reply (DM + Group) | ✅ Working | Both work correctly |
|
|
16
|
+
| GoatBot Compatible | ✅ Compatible | Auto-detect GoatBot config |
|
|
17
|
+
| Facebook Account Safe | ✅ Protected | Human delay, no automation |
|
|
18
|
+
| Error-Free (Global Handler) | ✅ Enabled | MQTT/Network non-fatal |
|
|
19
|
+
| Session Guard v2 (Auto-Save) | ✅ Enabled | Every 4min + backup |
|
|
20
|
+
| E2EE Bridge (Labyrinth) | ✅ Enabled | DM + Group |
|
|
21
|
+
| MQTT Auto-Reconnect v2 | ✅ Enabled | 2s-45s backoff |
|
|
22
|
+
| Anti-Ban v2 Human Delay | ✅ Enabled | 200-900ms |
|
|
23
|
+
| Cookie String Support | ✅ Supported | Raw c_user=xxx format |
|
|
24
|
+
| send.js MQTT null fix | ✅ Fixed | No crash if MQTT not ready |
|
|
22
25
|
|
|
23
26
|
---
|
|
24
27
|
|
|
25
|
-
## 📦
|
|
28
|
+
## 📦 Usage
|
|
26
29
|
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```
|
|
30
|
+
```js
|
|
31
|
+
const login = require('toru-fca');
|
|
32
|
+
const fs = require('fs');
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
login(
|
|
35
|
+
{ appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8')) },
|
|
36
|
+
(err, api) => {
|
|
37
|
+
if (err) return console.error(err);
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
// Session guard — auto save + backup (optional but recommended)
|
|
40
|
+
api.sessionGuard('./appstate.json', { interval: 4 * 60 * 1000, backup: true });
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
api.listen((err, event) => {
|
|
43
|
+
if (err) return;
|
|
44
|
+
if (event.type === 'message') {
|
|
45
|
+
api.sendMessage('Hello! 👋', event.threadID);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
```
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
---
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
## 🔒 Anti-Logout System v3
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
Bot run korle browser theke **logout hobe na**। Facebook automation dia **id logout korbe na**।
|
|
46
57
|
|
|
47
58
|
```js
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
// Fully automatic — kono extra code lagbe na
|
|
60
|
+
// api.logout() is blocked by default (safe no-op)
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
// Manual save (optional)
|
|
63
|
+
api.saveSession('./appstate.json');
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// Auto-save session every 3 minutes
|
|
59
|
-
api.sessionGuard("appstate.json", { interval: 3 * 60 * 1000 });
|
|
60
|
-
|
|
61
|
-
// Listen for messages
|
|
62
|
-
api.listenMqtt((err, event) => {
|
|
63
|
-
if (err) return console.error(err);
|
|
64
|
-
if (event.type === "message") {
|
|
65
|
-
console.log(`[${event.threadID}] ${event.senderID}: ${event.body}`);
|
|
66
|
-
if (event.body === "ping") api.sendMessage("pong!", event.threadID);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
65
|
+
// Session guard with auto-backup
|
|
66
|
+
const guard = api.sessionGuard('./appstate.json', {
|
|
67
|
+
interval: 240000, // 4 min
|
|
68
|
+
backup : true // .bak file rakhe
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
// Graceful stop timers (on shutdown)
|
|
72
|
+
api.stopAntiLogout();
|
|
73
|
+
api.stopAutomationGuard();
|
|
70
74
|
```
|
|
71
75
|
|
|
72
|
-
|
|
76
|
+
---
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
```json
|
|
76
|
-
{
|
|
77
|
-
"e2ee": { "enable": true, "saveType": "memory" }
|
|
78
|
-
}
|
|
79
|
-
```
|
|
78
|
+
## 📬 Inbox Bot Reply (DM + Group)
|
|
80
79
|
|
|
81
|
-
Then:
|
|
82
80
|
```js
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (event.type === "message" && event.isE2EE) {
|
|
89
|
-
api.sendMessage("Hello E2EE!", event.threadID);
|
|
81
|
+
api.listen((err, event) => {
|
|
82
|
+
if (event.type === 'message') {
|
|
83
|
+
const { threadID, isGroup, body } = event;
|
|
84
|
+
// threadID automatically correct — DM + Group dono te kaje kore
|
|
85
|
+
api.sendMessage(`Reply: ${body}`, threadID);
|
|
90
86
|
}
|
|
91
87
|
});
|
|
92
88
|
```
|
|
93
89
|
|
|
94
|
-
See `examples/e2ee-bot.js` for a complete example.
|
|
95
|
-
|
|
96
90
|
---
|
|
97
91
|
|
|
98
|
-
## ⚙️
|
|
92
|
+
## ⚙️ Config (`config.json`)
|
|
99
93
|
|
|
100
94
|
```json
|
|
101
95
|
{
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"logLevel": "none"
|
|
111
|
-
},
|
|
112
|
-
"enableTypingIndicator": false,
|
|
113
|
-
"typingDuration": 4000
|
|
96
|
+
"antiLogout" : { "enabled": true, "refreshIntervalMs": 1200000 },
|
|
97
|
+
"sessionGuard" : { "enabled": true, "intervalMs": 240000, "backupEnabled": true },
|
|
98
|
+
"automation" : { "enabled": false },
|
|
99
|
+
"antiBan" : { "enabled": true, "humanDelay": true, "minHumanDelayMs": 200, "maxHumanDelayMs": 900 },
|
|
100
|
+
"smooth" : { "enabled": true, "messageDelay": 400 },
|
|
101
|
+
"inbox" : { "enabled": true, "replyToDM": true, "replyToGroup": true },
|
|
102
|
+
"loginSafety" : { "enabled": true, "maxRetries": 3, "retryDelayMs": 5000 },
|
|
103
|
+
"cookieProtect": { "enabled": true, "validateOnStart": true, "revalidateIntervalMs": 900000 }
|
|
114
104
|
}
|
|
115
105
|
```
|
|
116
106
|
|
|
117
|
-
|
|
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 |
|
|
107
|
+
> ⚠️ `automation.enabled` সবসময় `false` রাখবে। True করলে Facebook restriction আসবে।
|
|
126
108
|
|
|
127
109
|
---
|
|
128
110
|
|
|
129
|
-
##
|
|
130
|
-
|
|
131
|
-
### Login
|
|
111
|
+
## 🤖 GoatBot Compatible
|
|
132
112
|
|
|
133
113
|
```js
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
}
|
|
114
|
+
// GoatBot config.js
|
|
115
|
+
module.exports = {
|
|
116
|
+
enableTypingIndicator: true,
|
|
117
|
+
typingDuration: 3500
|
|
118
|
+
};
|
|
119
|
+
// global.GoatBot.config auto-detected by toru-fca ✅
|
|
153
120
|
```
|
|
154
121
|
|
|
155
122
|
---
|
|
156
123
|
|
|
157
|
-
|
|
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
|
-
```
|
|
190
|
-
|
|
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
|
|
124
|
+
## 📋 Available APIs
|
|
214
125
|
|
|
215
126
|
```js
|
|
216
|
-
|
|
217
|
-
api.
|
|
218
|
-
api.
|
|
219
|
-
api.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
api.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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.
|
|
267
|
-
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
## 📁 Project Structure
|
|
271
|
-
|
|
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
|
|
127
|
+
// Messaging
|
|
128
|
+
api.sendMessage(msg, threadID, callback)
|
|
129
|
+
api.sendTypingIndicator(typing, threadID, callback)
|
|
130
|
+
api.sendTypingIndicatorV2(typing, threadID, callback) // MQTT-based
|
|
131
|
+
|
|
132
|
+
// Inbox
|
|
133
|
+
api.getThreadList(limit, timestamp, tags, callback)
|
|
134
|
+
api.getThreadHistory(threadID, amount, timestamp, callback)
|
|
135
|
+
api.getThreadInfo(threadID, callback)
|
|
136
|
+
|
|
137
|
+
// Session & Anti-Logout
|
|
138
|
+
api.saveSession(filePath)
|
|
139
|
+
api.sessionGuard(filePath, opts)
|
|
140
|
+
api.stopAntiLogout()
|
|
141
|
+
api.stopAutomationGuard()
|
|
142
|
+
api.forceLogout(callback) // opt-in only
|
|
143
|
+
|
|
144
|
+
// Health & Info
|
|
145
|
+
api.getHealth() // MQTT status, uptime, queue
|
|
146
|
+
api.version // "1.0.5"
|
|
147
|
+
api.name // "toru-fca"
|
|
148
|
+
|
|
149
|
+
// Aliases
|
|
150
|
+
api.listen // = api.listenMqtt
|
|
151
|
+
api.send // = api.sendMessage
|
|
152
|
+
api.getInbox // = api.getThreadList
|
|
299
153
|
```
|
|
300
154
|
|
|
301
155
|
---
|
|
302
156
|
|
|
303
|
-
##
|
|
157
|
+
## 🔧 Merged From
|
|
304
158
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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) |
|
|
159
|
+
- **toru-fca v1.0.4** — Base, Anti-Logout v2, Session Guard, Cookie String
|
|
160
|
+
- **shan-fca** — sendComment, setProfileLock, thread functions
|
|
161
|
+
- **hridoy-fca** — sessionGuard enhanced, pinMessage, refreshFb_dtsg
|
|
162
|
+
- **ws3-fca** — MQTT improvements, realtime
|
|
314
163
|
|
|
315
164
|
---
|
|
316
165
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
MIT
|
|
166
|
+
**toru-fca v1.0.5** — Ultimate Merged FCA | Anti-Logout v3 · Login Retry · Smooth & Safe
|
package/checkUpdate.js
CHANGED
|
@@ -1,37 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const CURRENT_VERSION = "1.0.0";
|
|
4
|
-
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Never blocks login or throws on failure.
|
|
3
|
+
* toru-fca v1.0.5 — checkUpdate.js
|
|
4
|
+
* Non-blocking update check. Bot startup e delay dibe na.
|
|
9
5
|
*/
|
|
6
|
+
|
|
7
|
+
const axios = require("axios");
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const log = require("npmlog");
|
|
11
|
+
|
|
12
|
+
const CURRENT_VERSION = "1.0.5";
|
|
13
|
+
const NPM_REGISTRY = "https://registry.npmjs.org/toru-fca/latest";
|
|
14
|
+
const TIMEOUT_MS = 5000;
|
|
15
|
+
|
|
16
|
+
function getCurrentVersion() {
|
|
17
|
+
try {
|
|
18
|
+
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8"));
|
|
19
|
+
if (pkg && pkg.version) return pkg.version;
|
|
20
|
+
} catch (_) {}
|
|
21
|
+
try {
|
|
22
|
+
var pkg2 = JSON.parse(fs.readFileSync(path.join(process.cwd(), "node_modules", "toru-fca", "package.json"), "utf8"));
|
|
23
|
+
if (pkg2 && pkg2.version) return pkg2.version;
|
|
24
|
+
} catch (_) {}
|
|
25
|
+
return CURRENT_VERSION;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function compareVersions(a, b) {
|
|
29
|
+
var pa = a.split(".").map(Number);
|
|
30
|
+
var pb = b.split(".").map(Number);
|
|
31
|
+
for (var i = 0; i < 3; i++) {
|
|
32
|
+
var na = pa[i] || 0, nb = pb[i] || 0;
|
|
33
|
+
if (na > nb) return 1;
|
|
34
|
+
if (na < nb) return -1;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
10
39
|
async function checkForFCAUpdate() {
|
|
11
40
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
req.on("error", () => resolve(null));
|
|
25
|
-
req.on("timeout", () => { req.destroy(); resolve(null); });
|
|
26
|
-
});
|
|
27
|
-
if (data && data.version && data.version !== CURRENT_VERSION) {
|
|
28
|
-
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");
|
|
41
|
+
var res = await axios.get(NPM_REGISTRY, { timeout: TIMEOUT_MS });
|
|
42
|
+
var latestVersion = res.data && res.data.version;
|
|
43
|
+
var currentVersion = getCurrentVersion();
|
|
44
|
+
|
|
45
|
+
if (!latestVersion) return false;
|
|
46
|
+
|
|
47
|
+
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
48
|
+
log.info("toru-fca", "Update available: v" + latestVersion + " (current: v" + currentVersion + ")");
|
|
49
|
+
log.info("toru-fca", "Run: npm install toru-fca@" + latestVersion);
|
|
50
|
+
} else {
|
|
51
|
+
log.info("toru-fca", "Up to date (v" + currentVersion + ")");
|
|
31
52
|
}
|
|
32
53
|
} catch (_) {
|
|
33
|
-
//
|
|
54
|
+
// Silent — update check is non-critical
|
|
34
55
|
}
|
|
56
|
+
return false;
|
|
35
57
|
}
|
|
36
58
|
|
|
37
|
-
module.exports = { checkForFCAUpdate
|
|
59
|
+
module.exports = { checkForFCAUpdate };
|