@decentnetwork/beagle 0.1.8 → 0.1.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/dist/carrier-node.js +20 -1
- package/dist/desktop/app.js +1 -1
- package/package.json +1 -1
package/dist/carrier-node.js
CHANGED
|
@@ -9,7 +9,26 @@
|
|
|
9
9
|
// Everything here runs at ordinary user privilege. Nothing opens a TUN, so
|
|
10
10
|
// nothing needs root — which is the entire point of the embedded backend.
|
|
11
11
|
import { EventEmitter } from "node:events";
|
|
12
|
+
import * as peerAddr from "@decentnetwork/peer";
|
|
12
13
|
import { Logger } from "./logger.js";
|
|
14
|
+
/**
|
|
15
|
+
* The address for a peer we only know by public key.
|
|
16
|
+
*
|
|
17
|
+
* A friendship that began with *their* request carries no address — we saw a
|
|
18
|
+
* pubkey and nothing else — so the UI had nothing to show and fell back to the
|
|
19
|
+
* userid, which is not what the "add a friend" box asks for. The address is not
|
|
20
|
+
* separate information: it is the pubkey plus a nospam (0 network-wide) and a
|
|
21
|
+
* checksum, both derivable here without touching the network.
|
|
22
|
+
*/
|
|
23
|
+
function addressFromPubkey(pubkey) {
|
|
24
|
+
try {
|
|
25
|
+
const bytes = peerAddr.base58ToBytes(pubkey);
|
|
26
|
+
return bytes.length === 32 ? peerAddr.carrierAddressFromPublicKey(bytes, 0) : undefined;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
13
32
|
export class CarrierNode extends EventEmitter {
|
|
14
33
|
#peer;
|
|
15
34
|
#logger = new Logger({ prefix: "Carrier" });
|
|
@@ -132,7 +151,7 @@ export class CarrierNode extends EventEmitter {
|
|
|
132
151
|
// Keep "requested" distinct from "offline": it answers "did my friend
|
|
133
152
|
// request get through?", which collapsing would hide.
|
|
134
153
|
status: f.status === "online" ? "online" : f.status === "requested" ? "requested" : "offline",
|
|
135
|
-
address: f.address,
|
|
154
|
+
address: f.address || addressFromPubkey(f.pubkey),
|
|
136
155
|
acceptedAt: f.acceptedAt,
|
|
137
156
|
requestedAt: f.requestedAt,
|
|
138
157
|
}));
|
package/dist/desktop/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__DK_UI_VERSION="0.1.
|
|
1
|
+
window.__DK_UI_VERSION="0.1.9";
|
|
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