@decentnetwork/lan 0.1.286 → 0.1.287

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.
@@ -60,6 +60,18 @@ export declare class PeerManager extends EventEmitter {
60
60
  * pubkey is a no-op at the SDK level.
61
61
  */
62
62
  acceptFriendRequest(pubkey: string): Promise<void>;
63
+ /**
64
+ * Decline an inbound request, at the SDK level and not only in our own
65
+ * pending list.
66
+ *
67
+ * Rejecting used to be described as "a no-op at the Carrier level — sender
68
+ * just sees no acceptance". It is not: the request leaves a friend record in
69
+ * the SDK, and the SDK treats a later request from someone already in that
70
+ * list as a reconnection signal and never surfaces it. So rejecting a person
71
+ * once meant they could never reach you again, with nothing on either side
72
+ * saying why.
73
+ */
74
+ rejectFriendRequest(pubkey: string): void;
63
75
  /**
64
76
  * Remove a friend (by userid/pubkey). Drops them from the Carrier friend
65
77
  * store (and persists the shrunk list). Returns true if a friend was
@@ -125,6 +125,23 @@ export class PeerManager extends EventEmitter {
125
125
  await this.peer.acceptFriendRequest(pubkey);
126
126
  this.logger.info(`Accepted friend request from ${pubkey}`);
127
127
  }
128
+ /**
129
+ * Decline an inbound request, at the SDK level and not only in our own
130
+ * pending list.
131
+ *
132
+ * Rejecting used to be described as "a no-op at the Carrier level — sender
133
+ * just sees no acceptance". It is not: the request leaves a friend record in
134
+ * the SDK, and the SDK treats a later request from someone already in that
135
+ * list as a reconnection signal and never surfaces it. So rejecting a person
136
+ * once meant they could never reach you again, with nothing on either side
137
+ * saying why.
138
+ */
139
+ rejectFriendRequest(pubkey) {
140
+ if (!this.peer)
141
+ return;
142
+ this.peer.rejectFriendRequest(pubkey);
143
+ this.logger.info(`Rejected friend request from ${pubkey}`);
144
+ }
128
145
  /**
129
146
  * Remove a friend (by userid/pubkey). Drops them from the Carrier friend
130
147
  * store (and persists the shrunk list). Returns true if a friend was
@@ -430,7 +430,17 @@ export class DaemonServer {
430
430
  const entry = this.pendingFriends?.remove(userid);
431
431
  if (!entry)
432
432
  throw new Error(`No pending friend-request for userid ${userid}`);
433
- // No-op at the Carrier level — sender just sees no acceptance.
433
+ // Tell the SDK as well. This used to be left as "a no-op at the
434
+ // Carrier level — sender just sees no acceptance", which was wrong:
435
+ // the request leaves a friend record behind, and a later request
436
+ // from anyone already in that list is swallowed as a reconnection
437
+ // signal. Reject someone once and they could never reach you again.
438
+ try {
439
+ this.peerManager?.rejectFriendRequest(entry.pubkey);
440
+ }
441
+ catch (e) {
442
+ this.logger.warn(`reject cleanup for ${userid.slice(0, 8)} failed: ${e.message}`);
443
+ }
434
444
  },
435
445
  chatSend: async (userid, text) => {
436
446
  if (!text)
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.286";
1
+ window.__DK_UI_VERSION="0.1.287";
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.286",
3
+ "version": "0.1.287",
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",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "dependencies": {
86
86
  "@decentnetwork/dora": "^0.1.14",
87
- "@decentnetwork/peer": "^0.1.141",
87
+ "@decentnetwork/peer": "0.1.154",
88
88
  "@decentnetwork/peer-webrtc": "^0.2.10",
89
89
  "ink": "^5.2.1",
90
90
  "js-yaml": "^4.1.0",