@eryxenx/fca 1.0.7 → 1.0.9
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eryxenx/fca",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Facebook Chat API by EryXenX | Stable • Auto Re-login • Full E2EE Support — send messages, media, reactions & more in encrypted chats, hassle-free",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -22,6 +22,15 @@ const nativeMediaBridge = require("./native/nativeMediaBridge");
|
|
|
22
22
|
const { decodeIncomingMedia } = require("./mediaDecode");
|
|
23
23
|
const localMediaServer = require("./localMediaServer");
|
|
24
24
|
|
|
25
|
+
// Native media engine (image/video/audio send, reactions, unsend, markRead,
|
|
26
|
+
// group receive) is ON by default — matches pre-1.0.7 behavior. Set
|
|
27
|
+
// FCA_E2EE_NATIVE=0 to force it off (falls back to the legacy vendor engine)
|
|
28
|
+
// if the native/vendored device-kick conflict described below becomes an
|
|
29
|
+
// issue for your deployment.
|
|
30
|
+
function _nativeMediaEnabled() {
|
|
31
|
+
return process.env.FCA_E2EE_NATIVE !== "0";
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
// Simple FIFO-bounded Map.set — evicts the oldest entry once maxSize is
|
|
26
35
|
// exceeded, so long-lived per-message caches (media buffers, thread/sender
|
|
27
36
|
// lookups) can't grow unbounded over a multi-hour/overnight process
|
|
@@ -377,11 +386,11 @@ class E2EEBridge {
|
|
|
377
386
|
// loop (a fresh Noise handshake every few seconds). Until the two
|
|
378
387
|
// engines can use distinct device ids, the native engine must stay
|
|
379
388
|
// OFF for the vendored socket to stay alive. Opt back in with
|
|
380
|
-
// FCA_E2EE_NATIVE=
|
|
389
|
+
// FCA_E2EE_NATIVE=0 (group E2EE receive + native media sends) if you
|
|
381
390
|
// accept the resulting socket churn.
|
|
382
|
-
const _nativeEnabled =
|
|
391
|
+
const _nativeEnabled = _nativeMediaEnabled();
|
|
383
392
|
if (!_nativeEnabled) {
|
|
384
|
-
logger.info("E2EE", "[native-group] native engine disabled (FCA_E2EE_NATIVE
|
|
393
|
+
logger.info("E2EE", "[native-group] native engine disabled (FCA_E2EE_NATIVE=0) — vendored socket kept exclusive to avoid server-side device kicks");
|
|
385
394
|
}
|
|
386
395
|
try {
|
|
387
396
|
if (!_nativeEnabled) throw { _skipNative: true };
|
|
@@ -511,11 +520,11 @@ class E2EEBridge {
|
|
|
511
520
|
const isGroup = this._knownE2EEGroups.has(String(threadId));
|
|
512
521
|
|
|
513
522
|
if (!attachment && isGroup) {
|
|
514
|
-
if (
|
|
523
|
+
if (!_nativeMediaEnabled()) {
|
|
515
524
|
// Native engine disabled (default) — it shares the same E2EE
|
|
516
525
|
// device id as the vendored socket and triggers server-side
|
|
517
526
|
// device kicks. Group E2EE text send unavailable in this mode.
|
|
518
|
-
throw new Error("E2EE group text send requires the native engine
|
|
527
|
+
throw new Error("E2EE group text send requires the native engine, which is disabled (FCA_E2EE_NATIVE=0) to protect the vendored socket from server-side device kicks.");
|
|
519
528
|
}
|
|
520
529
|
// Vendor's own group Sender-Key encryption is broken (see native-group
|
|
521
530
|
// listener above) — group text sends go through native instead.
|
|
@@ -593,8 +602,8 @@ class E2EEBridge {
|
|
|
593
602
|
const appState = this.api.getAppState();
|
|
594
603
|
let result;
|
|
595
604
|
try {
|
|
596
|
-
if (
|
|
597
|
-
throw new Error("native engine disabled (FCA_E2EE_NATIVE
|
|
605
|
+
if (!_nativeMediaEnabled()) {
|
|
606
|
+
throw new Error("native engine disabled (FCA_E2EE_NATIVE=0) — see native-group note");
|
|
598
607
|
}
|
|
599
608
|
result = await nativeMediaBridge.sendMedia(appState, threadId, mediaType, data, mimeType, {
|
|
600
609
|
caption: text || undefined,
|
|
@@ -690,7 +699,7 @@ class E2EEBridge {
|
|
|
690
699
|
|
|
691
700
|
async markRead(threadId, watermarkTs) {
|
|
692
701
|
this.ensureConnected();
|
|
693
|
-
if (
|
|
702
|
+
if (_nativeMediaEnabled())
|
|
694
703
|
return nativeMediaBridge.markRead(this.api.getAppState(), threadId, watermarkTs);
|
|
695
704
|
// Native disabled: read receipts aren't available through the vendored
|
|
696
705
|
// engine — treat as a no-op rather than waking the native engine.
|
|
@@ -711,8 +720,8 @@ class E2EEBridge {
|
|
|
711
720
|
this._knownE2EEGroups = this._knownE2EEGroups || new Set();
|
|
712
721
|
const isGroup = this._knownE2EEGroups.has(String(threadId));
|
|
713
722
|
try {
|
|
714
|
-
if (
|
|
715
|
-
throw new Error("native engine disabled (FCA_E2EE_NATIVE
|
|
723
|
+
if (!_nativeMediaEnabled())
|
|
724
|
+
throw new Error("native engine disabled (FCA_E2EE_NATIVE=0)");
|
|
716
725
|
return await nativeMediaBridge.sendReaction(this.api.getAppState(), threadId, messageId, senderJid, reaction, isGroup);
|
|
717
726
|
} catch (err) {
|
|
718
727
|
if (isGroup) {
|
|
@@ -734,8 +743,8 @@ class E2EEBridge {
|
|
|
734
743
|
this._knownE2EEGroups = this._knownE2EEGroups || new Set();
|
|
735
744
|
const isGroup = this._knownE2EEGroups.has(String(threadId));
|
|
736
745
|
try {
|
|
737
|
-
if (
|
|
738
|
-
throw new Error("native engine disabled (FCA_E2EE_NATIVE
|
|
746
|
+
if (!_nativeMediaEnabled())
|
|
747
|
+
throw new Error("native engine disabled (FCA_E2EE_NATIVE=0)");
|
|
739
748
|
return await nativeMediaBridge.unsendMessage(this.api.getAppState(), threadId, messageId, isGroup);
|
|
740
749
|
} catch (err) {
|
|
741
750
|
if (isGroup) {
|
|
@@ -752,8 +761,8 @@ class E2EEBridge {
|
|
|
752
761
|
this._knownE2EEGroups = this._knownE2EEGroups || new Set();
|
|
753
762
|
const isGroup = this._knownE2EEGroups.has(String(threadId));
|
|
754
763
|
if (isGroup) {
|
|
755
|
-
if (
|
|
756
|
-
throw new Error("E2EE group edit requires the native engine
|
|
764
|
+
if (!_nativeMediaEnabled())
|
|
765
|
+
throw new Error("E2EE group edit requires the native engine, which is disabled (FCA_E2EE_NATIVE=0).");
|
|
757
766
|
// Vendor's group Sender-Key encryption is broken, so route
|
|
758
767
|
// group edits through native (it doesn't need a chatJid — the
|
|
759
768
|
// messageId alone identifies which chat/message to edit).
|
|
@@ -947,4 +956,4 @@ function _getImageDimensions(buf, mimeType) {
|
|
|
947
956
|
}
|
|
948
957
|
} catch (_) {}
|
|
949
958
|
return null;
|
|
950
|
-
}
|
|
959
|
+
}
|
|
@@ -25,6 +25,7 @@ function getAdminTextMessageType(m) {
|
|
|
25
25
|
return "log:thread-approval-mode";
|
|
26
26
|
case "messenger_call_log":
|
|
27
27
|
case "participant_joined_group_call":
|
|
28
|
+
case "rtc_call_log":
|
|
28
29
|
return "log:thread-call";
|
|
29
30
|
case "pin_messages_v2":
|
|
30
31
|
return "log:thread-pinned";
|
|
@@ -41,7 +42,7 @@ function formatDeltaEvent(m) {
|
|
|
41
42
|
switch (m.class) {
|
|
42
43
|
case "AdminTextMessage":
|
|
43
44
|
logMessageType = getAdminTextMessageType(m);
|
|
44
|
-
logMessageData = m.untypedData;
|
|
45
|
+
logMessageData = Object.assign({}, m.untypedData, { rawType: m.type });
|
|
45
46
|
break;
|
|
46
47
|
case "ThreadName":
|
|
47
48
|
logMessageType = "log:thread-name";
|
package/src/utils/nexca-utils.js
CHANGED
|
@@ -569,7 +569,8 @@ function _getAdminTextMessageType(delta) {
|
|
|
569
569
|
case "group_poll": return "log:thread-poll";
|
|
570
570
|
case "change_thread_approval_mode": return "log:thread-approval-mode";
|
|
571
571
|
case "messenger_call_log":
|
|
572
|
-
case "participant_joined_group_call":
|
|
572
|
+
case "participant_joined_group_call":
|
|
573
|
+
case "rtc_call_log": return "log:thread-call";
|
|
573
574
|
case "pin_messages_v2":
|
|
574
575
|
case "unpin_messages_v2": return "log:thread-pinned";
|
|
575
576
|
case "confirm_friend_request": return "log:confirmed-friend-request";
|
|
@@ -593,7 +594,7 @@ function formatDeltaEvent(delta) {
|
|
|
593
594
|
messageID: md.messageId,
|
|
594
595
|
author: (md.actorFbId || "").toString(),
|
|
595
596
|
logMessageType: _getAdminTextMessageType(delta),
|
|
596
|
-
logMessageData: delta.untypedData || {},
|
|
597
|
+
logMessageData: Object.assign({}, delta.untypedData || {}, { rawType: delta.type }),
|
|
597
598
|
logMessageBody: md.adminText || "",
|
|
598
599
|
participantIDs: participantIDs,
|
|
599
600
|
timestamp: parseInt(md.timestamp)
|