@decentnetwork/peer 0.1.145 → 0.1.146
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/compat/express.d.ts +1 -0
- package/dist/compat/express.js +11 -2
- package/dist/peer.js +1 -0
- package/package.json +1 -1
package/dist/compat/express.d.ts
CHANGED
package/dist/compat/express.js
CHANGED
|
@@ -12,8 +12,13 @@ export class LegacyExpressClient {
|
|
|
12
12
|
#selfAddress;
|
|
13
13
|
#currNode = 0;
|
|
14
14
|
#callbacks;
|
|
15
|
+
// Own gate, and env-only until now — so in a browser this client was mute
|
|
16
|
+
// whatever the peer's debug setting was. That is why a stalled pull looked
|
|
17
|
+
// identical to a pull that never ran.
|
|
15
18
|
#debug = process.env.DECENT_DEBUG === "1";
|
|
16
19
|
constructor(opts) {
|
|
20
|
+
if (opts.debug)
|
|
21
|
+
this.#debug = true;
|
|
17
22
|
this.#selfKeyPair = opts.selfKeyPair;
|
|
18
23
|
this.#selfUserId = opts.selfUserId;
|
|
19
24
|
this.#selfAddress = opts.selfAddress;
|
|
@@ -63,8 +68,12 @@ export class LegacyExpressClient {
|
|
|
63
68
|
try {
|
|
64
69
|
body = await this.#http(node, "GET", encodeURIComponent(this.#selfUserId));
|
|
65
70
|
}
|
|
66
|
-
catch {
|
|
67
|
-
|
|
71
|
+
catch (error) {
|
|
72
|
+
// Say so. Swallowing this made an unreachable relay indistinguishable
|
|
73
|
+
// from an empty inbox, and offline mail piled up on the server with
|
|
74
|
+
// nothing anywhere reporting why.
|
|
75
|
+
this.#debugLog(`pull from ${node.host}:${node.port} failed: ${error?.message ?? error}`);
|
|
76
|
+
continue;
|
|
68
77
|
}
|
|
69
78
|
const messages = parseExpressResponseFrames(body);
|
|
70
79
|
if (messages.length === 0) {
|
package/dist/peer.js
CHANGED
|
@@ -598,6 +598,7 @@ export class Peer {
|
|
|
598
598
|
selfKeyPair: this.#keyPair,
|
|
599
599
|
selfUserId: this.userid(),
|
|
600
600
|
selfAddress: this.address(),
|
|
601
|
+
debug: this.#debug,
|
|
601
602
|
callbacks: {
|
|
602
603
|
onOfflineFriendRequest: (fromUserId, packet) => {
|
|
603
604
|
this.#emitOfflineFriendRequest(fromUserId, packet);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.146",
|
|
4
4
|
"description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|