@decentnetwork/lan 0.1.282 → 0.1.283
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/dist/daemon/server.js +14 -51
- package/dist/ui/desktop/app.js +1 -1
- package/package.json +1 -1
package/dist/daemon/server.js
CHANGED
|
@@ -564,57 +564,20 @@ export class DaemonServer {
|
|
|
564
564
|
this.logger.info(`Queued file "${name}" (${data.length}B) for offline ${userid.slice(0, 8)} (delivers on reconnect)`);
|
|
565
565
|
return { queued: true, name: safe, size: data.length };
|
|
566
566
|
}
|
|
567
|
-
// NATIVE friends (iOS/Android/C Carrier)
|
|
568
|
-
//
|
|
569
|
-
//
|
|
570
|
-
//
|
|
571
|
-
//
|
|
572
|
-
//
|
|
573
|
-
//
|
|
574
|
-
//
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//
|
|
578
|
-
//
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
const INLINE_NATIVE_MAX = 256 * 1024;
|
|
582
|
-
if (this.peerManager?.isNativeFriend(userid) && data.length <= INLINE_NATIVE_MAX) {
|
|
583
|
-
// Append the chip as "sending" FIRST, then let the SDK's delivery
|
|
584
|
-
// verdict decide what it becomes. Marking "sent" the moment
|
|
585
|
-
// sendInlineFile resolved was a lie — that only meant the bytes
|
|
586
|
-
// left this machine; a half-open session swallowed them silently
|
|
587
|
-
// while the sender stared at a checkmark (INBOX 2026-08-21 A).
|
|
588
|
-
const safeName = sanitizeFileName(name);
|
|
589
|
-
const chip = this.messageStore?.appendFile(userid, "out", { name: safeName, size: data.length, status: "sending", sent: 0 });
|
|
590
|
-
this.friendMeta?.ensure(userid);
|
|
591
|
-
this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
|
|
592
|
-
// Sends are NON-BLOCKING (the 2026-08-05 rule): the delivery wait
|
|
593
|
-
// scales with size (up to 180s), and holding the HTTP request open
|
|
594
|
-
// that long froze the UI on an 8MB inline send. Return now; the
|
|
595
|
-
// verdict patches the chip and the event stream repaints it.
|
|
596
|
-
const bytes = new Uint8Array(data);
|
|
597
|
-
void (async () => {
|
|
598
|
-
let delivery;
|
|
599
|
-
try {
|
|
600
|
-
delivery = await this.peerManager.sendInlineFile(userid, bytes, name);
|
|
601
|
-
}
|
|
602
|
-
catch (e) {
|
|
603
|
-
if (chip)
|
|
604
|
-
this.messageStore?.patchFile(userid, chip.id, { status: "failed" });
|
|
605
|
-
this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
|
|
606
|
-
this.logger.warn(`Inline file "${name}" to native ${userid.slice(0, 8)} failed to send: ${e.message}`);
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
const status = delivery === "acked" ? "sent" : delivery === "offline" ? "queued" : "failed";
|
|
610
|
-
if (chip)
|
|
611
|
-
this.messageStore?.patchFile(userid, chip.id, { status, sent: delivery === "acked" ? data.length : 0 });
|
|
612
|
-
this.ipcEvents.emit("event", { type: "chat", userid, dir: "out" });
|
|
613
|
-
this.logger.info(`Inline file "${name}" (${data.length}B) to native ${userid.slice(0, 8)}: delivery=${delivery} → ${status}` +
|
|
614
|
-
(delivery === "accepted" ? " (unconfirmed — the bytes went out and may have arrived, but the peer never acknowledged)" : ""));
|
|
615
|
-
})();
|
|
616
|
-
return { inline: true, name, size: data.length, pending: true };
|
|
617
|
-
}
|
|
567
|
+
// NATIVE friends (iOS/Android/C Carrier) stream like everyone else:
|
|
568
|
+
// sendFile below reaches them as DNFT1 frames (peer >= 0.1.141 —
|
|
569
|
+
// offset acks, FEC, resume; verified 100MB JS→iPad). There is NO
|
|
570
|
+
// inline shortcut any more, at any size. The inline envelope has no
|
|
571
|
+
// usable confirmation against a native peer — protoVersion is
|
|
572
|
+
// structurally 0 (no text-ack), the bare FileModel carries no
|
|
573
|
+
// deliveryId to ack, and the transport-ack signal (our send window
|
|
574
|
+
// draining) was FIELD-FALSIFIED at every scale: a 282-BYTE
|
|
575
|
+
// single-fragment PNG sat unconfirmed for 20s on the same session
|
|
576
|
+
// that streamed 100MB with 0.0% loss moments earlier. Routing small
|
|
577
|
+
// files inline just manufactured a daily stream of failed chips for
|
|
578
|
+
// images that had actually arrived. DNFT1's contiguous ack is the
|
|
579
|
+
// only true delivery signal a native can give us; the cost is one
|
|
580
|
+
// offer round trip.
|
|
618
581
|
// Add the "out" chip immediately as STATUS=sending (not "sent" — the
|
|
619
582
|
// transfer is reliable+acked, so it only flips to "sent" once the
|
|
620
583
|
// receiver confirms every byte). Progress/complete/cancel events patch
|
package/dist/ui/desktop/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__DK_UI_VERSION="0.1.
|
|
1
|
+
window.__DK_UI_VERSION="0.1.283";
|
|
2
2
|
const ICON_PATHS = {
|
|
3
3
|
// ---- tab bar (the four must feel like one set) ----
|
|
4
4
|
users: '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/lan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.283",
|
|
4
4
|
"description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|