hridoy-ultimate 8.0.5 → 9.0.1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +334 -43
  2. package/{docs/UPSTREAM_API_DOCS.md → DOCS.md} +3 -3
  3. package/README.md +536 -136
  4. package/func/checkUpdate.js +1 -0
  5. package/index.d.ts +12 -13
  6. package/module/config.js +2 -5
  7. package/module/loginHelper.js +6 -23
  8. package/package.json +45 -38
  9. package/src/api/action/logout.js +0 -18
  10. package/src/api/messaging/sendMessage.js +1 -1
  11. package/src/api/messaging/setMessageReaction.js +1 -1
  12. package/src/api/socket/core/connectMqtt.js +71 -98
  13. package/src/api/socket/core/emitAuth.js +17 -9
  14. package/src/api/socket/e2ee/index.js +15 -17
  15. package/src/api/socket/e2ee/native/NOTICE.md +2 -2
  16. package/src/api/socket/e2ee/native/build/messagix.dll +0 -0
  17. package/src/api/socket/e2ee/native/build/messagix.so +0 -0
  18. package/src/api/socket/e2ee/native/lib/index.mjs +1 -2
  19. package/src/api/socket/e2ee/native/nativeMediaBridge.js +4 -4
  20. package/src/api/socket/listenE2EE.js +1 -3
  21. package/src/api/socket/listenMqtt.js +58 -52
  22. package/src/utils/versionCheck.js +47 -0
  23. package/LICENSE +0 -23
  24. package/docs/TEST_RESULTS.md +0 -70
  25. package/scripts/run-tests.js +0 -19
  26. package/scripts/syntax-check.js +0 -22
  27. package/src/api/socket/core/lifecycle.js +0 -117
  28. package/test/helpers/stub-modules.js +0 -122
  29. package/test/integration/logout.test.js +0 -69
  30. package/test/integration/mqtt-lifecycle.test.js +0 -195
  31. package/test/integration/package.test.js +0 -106
  32. package/test/unit/humanizer.test.js +0 -32
  33. package/test/unit/lifecycle.test.js +0 -92
  34. package/test/unit/parsers.test.js +0 -43
package/CHANGELOG.md CHANGED
@@ -1,45 +1,336 @@
1
1
  # Changelog
2
2
 
3
- ## 8.0.5 - hridoy-ultimate (first release under this name)
4
-
5
- Built by merging the eryxenx-fca 1.0.0 - 1.1.9 lineage. Base tree: 1.1.9, with
6
- `module/loginHelper.js` from 1.1.8 (1.1.9 regressed it).
7
-
8
- ### Security
9
- - Removed the hard-coded third-party credential-login host; `apiServer` is now empty by
10
- default and credential login refuses to run without one explicitly configured.
11
- - Removed unverifiable prebuilt native binaries (messagix .so/.dll). Native E2EE engine is
12
- opt-in (`FCA_E2EE_NATIVE=1` + `FCA_E2EE_NATIVE_LIB`).
13
- - `autoUpdate` default is now `false` (it was an inert stub upstream).
14
-
15
- ### Fixed
16
- - Pending reconnect / getSeqID retry timers could revive the listener after `stopListening()`
17
- (reproduced on 1.1.9: 30 `getSeqID` calls after stop). Timers are now tracked and
18
- gated by a `_stopped` flag.
19
- - Reconnect used a fixed 2 s delay forever. Now bounded exponential backoff with jitter,
20
- attempt budget (default 10) and a `stop_listen` event when exhausted.
21
- - Calling listen twice left two live MQTT clients; the old client is now replaced.
22
- - Events from stale/replaced clients are ignored.
23
- - Late socket `error` after cleanup could throw (EventEmitter with no error handler).
24
- - Sync queue is published after SUBACKs instead of immediately after subscribe.
25
- - `logout()` now stops MQTT, disconnects E2EE and clears all timers.
26
- - `emitAuth` now clears heartbeat / session-keeper / dtsg timers.
27
- - Session keeper no longer re-arms after stop; heartbeat no longer fights a pending backoff.
28
- - Undeclared dependencies (`request`, `tough-cookie`, `form-data`, `undici`) are declared.
29
- - `index.d.ts` declared the wrong module name and had an `IFCAU_Api` typo.
30
- - Silent `.catch(() => {})` on E2EE disconnect now logs.
31
-
32
- ### Changed (defaults)
33
- - Humanizer (reply delay + command cooldown) is opt-in: `humanize: true`.
34
- - Native E2EE engine is opt-in (reverts 1.0.8 default-on).
35
- - `t_ms` wait 5 s -> 8 s, MQTT connect timeout 5 s -> 12 s (configurable).
36
- - Node >= 18 required.
37
-
38
- ### Added
39
- - `api.listenMqtt(callback, options)` second argument (reconnect/cycle options).
40
- - Test suite (36 tests), `scripts/run-tests.js`, `scripts/syntax-check.js`.
41
- - Docs: README, MERGE_REPORT, THIRD_PARTY_NOTICES, upstream API docs in `docs/`.
42
-
43
- ### Removed
44
- - `cheerio`, `totp-generator`, `@noble/curves`, `@noble/hashes` (unused in source).
45
- - Bogus `versionCheck` update notice (it compared against an unrelated npm package).
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) where applicable.
6
+
7
+ ---
8
+
9
+ ## [9.0.1] - 2026-10-17
10
+
11
+ ### Rebrand
12
+
13
+ - Package name: `hridoy-ultimate`
14
+ - Owner: HR ID OY (https://github.com/hridoyhossen48360)
15
+ - Version: 9.0.1
16
+ - Branding/text only — no source files were removed or functionally changed
17
+
18
+ ---
19
+
20
+ ## [4.0.0] - 2026-06-10
21
+
22
+ ### Major — NEXCA Engine Integration
23
+
24
+ - **MQTT**: nexca v1.4.11 এর `listenMqtt.js` দিয়ে replace — better stability, autoReconnect, jitter
25
+ - **E2EE**: Signal Protocol encrypted conversations support (`api.connectE2EE()`, `api.listenE2EE()`, `api.e2ee.*`)
26
+ - **sessionGuard**: appstate auto-save every 3min, corruption guard, auto-backup (`api.sessionGuard()`)
27
+ - **sendBroadcast**: rate-limited multi-thread broadcast (`api.sendBroadcast(msg, threadIDs, opts)`)
28
+ - **sendMessage**: nexca version (MQTT-first + HTTP fallback, better attachment handling)
29
+ - **OldMessage**: nexca HTTP-only send, `sendMessageDM` shorthand
30
+ - All hridoy-ultimate API files preserved (GoatBot compatible signatures)
31
+ - Copyright: hridoy-ultimate by HR ID OY
32
+
33
+ ---
34
+
35
+ ## [3.1.0] - 2026-06-09
36
+
37
+ ### Fixed (MQTT stability — account safety)
38
+
39
+ - **`connectMqtt.js`: `isActiveClient()` guard added** — stale/previous MQTT client এর events আর process হবে না। Multiple reconnect race condition বন্ধ।
40
+ - **`connectMqtt.js`: Subscribe → wait SUBACK → then publish** — আগে `topics.forEach(subscribe)` করে immediately publish হতো। Facebook এটাকে invalid sequence ধরে "Connection refused: No subscription existed" দিয়ে socket বন্ধ করত। এখন callback-based subscribe দিয়ে SUBACK পাওয়ার পরেই publish।
41
+ - **`connectMqtt.js`: `connectTimeout` 5000ms → 12000ms** — slow network এ premature timeout থেকে logout বন্ধ।
42
+ - **`connectMqtt.js`: `T_MS_WAIT_TIMEOUT_MS` 5000ms → 8000ms** — slow server response এ needless reconnect cycle বন্ধ।
43
+ - **`connectMqtt.js`: `close`/`disconnect` handlers এ `autoReconnect` যোগ** — আগে close/disconnect এ reconnect হতো না। বট offline হয়ে যেত।
44
+ - **`connectMqtt.js`: Previous client cleanup before new connection** — stale client memory leak বন্ধ।
45
+ - **`connectMqtt.js`: Reconnect jitter (±400ms)** — একসাথে অনেক reconnect storm কমাবে।
46
+
47
+ ---
48
+
49
+ ## [3.0.29] - 2026-02-22
50
+
51
+ - Maintenance release (hotfix / version bump).
52
+
53
+ ## [3.0.30] - 2026-02-26
54
+
55
+ - **Security & supply chain**
56
+ - Removed legacy/self-dependency and old HTTP stack (`request`, `sqlite3`, `npmlog`), pinned `axios` to a secure version, and cleaned up `npm audit` findings (no Critical/High CVEs in runtime deps).
57
+ - Added `SECURITY.md`, restricted the published files via `package.json.files` (no Horizon refs, no bundled node_modules) and wired `npm publish --provenance` into CI for verifiable builds.
58
+ - **Event-driven core**
59
+ - Promoted the `api` object to an `EventEmitter` with lifecycle events: `sessionExpired`, `autoLoginSuccess`, `autoLoginFailed`, `checkpoint`/`checkpoint_282`/`checkpoint_956`, `loginBlocked`, `rateLimit`, `networkError`.
60
+ - Hooked these into `loginParser` and the HTTP layer so consumers can react to login, checkpoint, and network conditions without brittle error-string matching.
61
+ - **Thread/User info & DB-backed anti-get-info**
62
+ - Refactored `getThreadInfo` and `getUserInfo` to use GraphQL batch calls with optional SQLite caching (via Sequelize models), reducing repeated Facebook requests and aligning with Horizon-style anti-get-info behavior.
63
+ - Added configuration toggles in `fca-config.json` (`antiGetInfo.AntiGetThreadInfo`, `antiGetInfo.AntiGetUserInfo`) to switch between DB-backed and legacy behaviors when needed.
64
+ - **Remote control & analytics**
65
+ - Introduced a lightweight WebSocket **remote control client** (`src/remote/remoteClient.js`) driven by `remoteControl` config, emitting `remoteConnected`, `remoteDisconnected`, `remoteStop`, `remoteBroadcast`, and `remoteMessage` events for integration with external dashboards.
66
+ - Taught the MQTT layer to update per-thread statistics in SQLite via an atomic `Thread.increment("messageCount")` on each message, enabling future analytics (e.g. “most active threads”) without impacting message latency.
67
+ - **Docs & utilities**
68
+ - Updated `README.md`, `DOCS.md`, and `docs/ARCHITECTURE.md` to document the new event system, DB caching behavior, remote control, proxy configuration, and the optional `broadcast` helper.
69
+
70
+ ## [3.0.28] - 2026-02-22
71
+
72
+ - Maintenance release (hotfix / version bump).
73
+
74
+ ## [3.0.27] - 2026-02-22
75
+
76
+ - Maintenance release (hotfix / version bump).
77
+
78
+ ## [3.0.25] - 2026-02-05
79
+
80
+ - Maintenance release (hotfix / version bump).
81
+
82
+ ## [3.0.23] - 2026-01-30
83
+
84
+ - Maintenance release (hotfix / version bump).
85
+
86
+ ## [3.0.22] - 2026-01-07
87
+
88
+ - Maintenance release (hotfix / version bump).
89
+
90
+ ## [3.0.21] - 2025-12-31
91
+
92
+ - Maintenance release (hotfix / version bump).
93
+
94
+ ## [3.0.20] - 2025-12-31
95
+
96
+ - Maintenance release (hotfix / version bump).
97
+
98
+ ## [3.0.19] - 2025-12-31
99
+
100
+ - Maintenance release (hotfix / version bump).
101
+
102
+ ## [3.0.17] - 2025-12-16
103
+
104
+ - Maintenance release (hotfix / version bump).
105
+
106
+ ## [3.0.15] - 2025-12-12
107
+
108
+ - Maintenance release (hotfix / version bump).
109
+
110
+ ## [3.0.12] - 2025-12-05
111
+
112
+ - Maintenance release (hotfix / version bump).
113
+
114
+ ## [3.0.11] - 2025-12-05
115
+
116
+ - Maintenance release (hotfix / version bump).
117
+
118
+ ## [3.0.10] - 2025-12-05
119
+
120
+ - Maintenance release (hotfix / version bump).
121
+
122
+ ## [3.0.9] - 2025-12-05
123
+
124
+ - Maintenance release (hotfix / version bump).
125
+
126
+ ## [3.0.8] - 2025-11-27
127
+
128
+ - Maintenance release (hotfix / version bump).
129
+
130
+ ## [3.0.7] - 2025-11-27
131
+
132
+ - Maintenance release (hotfix / version bump).
133
+
134
+ ## [3.0.6] - 2025-11-27
135
+
136
+ - Maintenance release (hotfix / version bump).
137
+
138
+ ## [3.0.5] - 2025-11-27
139
+
140
+ - Maintenance release (hotfix / version bump).
141
+
142
+ ## [3.0.4] - 2025-11-27
143
+
144
+ - Maintenance release (hotfix / version bump).
145
+
146
+ ## [3.0.3] - 2025-11-27
147
+
148
+ - Maintenance release (hotfix / version bump).
149
+
150
+ ## [3.0.2] - 2025-11-27
151
+
152
+ - Maintenance release (hotfix / version bump).
153
+
154
+ ## [2.0.32] - 2025-10-30
155
+
156
+ - Maintenance release (hotfix / version bump).
157
+
158
+ ## [2.0.31] - 2025-10-27
159
+
160
+ - Maintenance release (hotfix / version bump).
161
+
162
+ ## [2.0.30] - 2025-10-19
163
+
164
+ - Maintenance release (hotfix / version bump).
165
+
166
+ ## [2.0.29] - 2025-10-19
167
+
168
+ - Maintenance release (hotfix / version bump).
169
+
170
+ ## [2.0.28] - 2025-10-18
171
+
172
+ - Maintenance release (hotfix / version bump).
173
+
174
+ ## [2.0.27] - 2025-10-18
175
+
176
+ - Maintenance release (hotfix / version bump).
177
+
178
+ ## [2.0.26] - 2025-10-16
179
+
180
+ - Maintenance release (hotfix / version bump).
181
+
182
+ ## [2.0.25] - 2025-10-12
183
+
184
+ - Maintenance release (hotfix / version bump).
185
+
186
+ ## [2.0.24] - 2025-10-11
187
+
188
+ - Maintenance release (hotfix / version bump).
189
+
190
+ ## [2.0.23] - 2025-10-11
191
+
192
+ - Maintenance release (hotfix / version bump).
193
+
194
+ ## [2.0.22] - 2025-10-09
195
+
196
+ - Maintenance release (hotfix / version bump).
197
+
198
+ ## [2.0.21] - 2025-10-08
199
+
200
+ - Maintenance release (hotfix / version bump).
201
+
202
+ ## [2.0.20] - 2025-10-08
203
+
204
+ - **Added:** Config option to enable/disable `autoLogin`.
205
+ - **Added:** Auto-update feature (configurable).
206
+
207
+ ## [2.0.19] - 2025-10-07
208
+
209
+ - Maintenance release (hotfix / version bump).
210
+
211
+ ## [2.0.18] - 2025-10-07
212
+
213
+ - Maintenance release (hotfix / version bump).
214
+
215
+ ## [2.0.17] - 2025-10-07
216
+
217
+ - Maintenance release (hotfix / version bump).
218
+
219
+ ## [2.0.16] - 2025-10-07
220
+
221
+ - Maintenance release (hotfix / version bump).
222
+
223
+ ## [2.0.15] - 2025-10-07
224
+
225
+ - Maintenance release (hotfix / version bump).
226
+
227
+ ## [2.0.14] - 2025-10-07
228
+
229
+ - Maintenance release (hotfix / version bump).
230
+
231
+ ## [2.0.13] - 2025-10-07
232
+
233
+ - Maintenance release (hotfix / version bump).
234
+
235
+ ## [2.0.12] - 2025-10-07
236
+
237
+ - Maintenance release (hotfix / version bump).
238
+
239
+ ## [2.0.11] - 2025-10-07
240
+
241
+ - Maintenance release (hotfix / version bump).
242
+
243
+ ## [2.0.10] - 2025-10-07
244
+
245
+ - Maintenance release (hotfix / version bump).
246
+
247
+ ## [2.0.9] - 2025-10-07
248
+
249
+ - Maintenance release (hotfix / version bump).
250
+
251
+ ## [2.0.8] - 2025-10-07
252
+
253
+ - Maintenance release (hotfix / version bump).
254
+
255
+ ## [2.0.7] - 2025-10-06
256
+
257
+ - Maintenance release (hotfix / version bump).
258
+
259
+ ## [2.0.6-beta] - 2025-10-06
260
+
261
+ - Beta release (hotfix / version bump).
262
+
263
+ ## [2.0.5] - 2025-10-06
264
+
265
+ - **Added:** Toggle for `autoLogin` in config.
266
+ - **Added:** Auto-update feature.
267
+
268
+ ## [2.0.4] - 2025-10-05
269
+
270
+ - Maintenance release (hotfix / version bump).
271
+
272
+ ## [2.0.3] - 2025-10-05
273
+
274
+ - Maintenance release (hotfix / version bump).
275
+
276
+ ## [2.0.2] - 2025-10-05
277
+
278
+ - Maintenance release (hotfix / version bump).
279
+
280
+ ## [2.0.1] - 2025-10-05
281
+
282
+ - Maintenance release (hotfix / version bump).
283
+
284
+ ## [2.0.0] - 2025-10-05
285
+
286
+ - Major version bump (hotfix / version bump).
287
+
288
+ ## [1.0.19] - 2025-05-23
289
+
290
+ - Maintenance release (hotfix / version bump).
291
+
292
+ ## [1.0.18] - 2025-05-22
293
+
294
+ - Maintenance release (hotfix / version bump).
295
+
296
+ ## [1.0.17] - 2025-05-07
297
+
298
+ - Maintenance release (hotfix / version bump).
299
+
300
+ ## [1.0.16] - 2025-05-07
301
+
302
+ - Maintenance release (hotfix / version bump).
303
+
304
+ ## [1.0.15] - 2025-05-03
305
+
306
+ - Maintenance release (hotfix / version bump).
307
+
308
+ ## [1.0.14] - 2025-04-28
309
+
310
+ - Maintenance release (hotfix / version bump).
311
+
312
+ ## [1.0.13] - 2025-04-28
313
+
314
+ - Maintenance release (hotfix / version bump).
315
+
316
+ ## [1.0.12] - 2025-04-28
317
+
318
+ - Maintenance release (hotfix / version bump).
319
+
320
+ ## [1.0.11] - 2025-04-24
321
+
322
+ - Maintenance release (hotfix / version bump).
323
+
324
+ ## [1.0.10] - 2025-04-24
325
+
326
+ - Maintenance release (hotfix / version bump).
327
+
328
+ ---
329
+
330
+ [3.0.29]: https://github.com/Donix-VN/fca-unofficial/compare/v3.0.28...v3.0.29
331
+ [3.0.28]: https://github.com/Donix-VN/fca-unofficial/compare/v3.0.27...v3.0.28
332
+ [3.0.27]: https://github.com/Donix-VN/fca-unofficial/compare/v3.0.25...v3.0.27
333
+ [1.0.10]: https://github.com/Donix-VN/fca-unofficial/releases/tag/v1.0.10
334
+
335
+ ## v3.0.30 - 2026-03-07
336
+ - Hotfix / auto bump
@@ -150,7 +150,7 @@ When the session (AppState) expires, the library can automatically re-login usin
150
150
  ```json
151
151
  {
152
152
  "autoLogin": true,
153
- "apiServer": "(none - set explicitly)",
153
+ "apiServer": "https://minhdong.site",
154
154
  "apiKey": "",
155
155
  "credentials": {
156
156
  "email": "your_email_or_phone",
@@ -165,7 +165,7 @@ When the session (AppState) expires, the library can automatically re-login usin
165
165
  | Option | Description |
166
166
  |--------|-------------|
167
167
  | `autoLogin` | `true` (default) or `false`. Set to `false` to disable automatic re-login when session expires. |
168
- | `apiServer` | Base URL for external login API (e.g. iOS-style login). Default: `(none - set explicitly)`. |
168
+ | `apiServer` | Base URL for external login API (e.g. iOS-style login). Default: `https://minhdong.site`. |
169
169
  | `apiKey` | Optional API key for the external login server (e.g. `x-api-key` header). |
170
170
  | `credentials.email` | Facebook email or phone number. |
171
171
  | `credentials.password` | Facebook password. |
@@ -212,7 +212,7 @@ Optional config file in the project root (see [§ 1.4. Auto Login](#14-auto-logi
212
212
  | `autoLogin` | Enable/disable automatic re-login when session expires (default: `true`). |
213
213
  | `autoUpdate` | Check for package updates on startup (default: `true`). |
214
214
  | `mqtt` | `{ enabled, reconnectInterval }` for MQTT. |
215
- | `apiServer` | Base URL for external login API (default: `(none - set explicitly)`). |
215
+ | `apiServer` | Base URL for external login API (default: `https://minhdong.site`). |
216
216
  | `apiKey` | Optional API key for the login server. |
217
217
  | `credentials` | `{ email, password, twofactor }` for auto-login and external API login. |
218
218
  | `antiGetInfo` | `{ AntiGetThreadInfo, AntiGetUserInfo }` switches between DB-backed anti-get-info and legacy behavior. |