@decentnetwork/lan 0.1.275 → 0.1.277
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/console/console.js +23 -2
- package/dist/daemon/ipc.js +35 -2
- package/dist/ui/desktop/app.js +1 -1
- package/package.json +2 -2
package/dist/console/console.js
CHANGED
|
@@ -654,7 +654,7 @@ function now() {
|
|
|
654
654
|
import { createConnection } from "node:net";
|
|
655
655
|
import { resolve as resolve2 } from "node:path";
|
|
656
656
|
import { homedir as homedir3 } from "node:os";
|
|
657
|
-
import { createRequire } from "node:module";
|
|
657
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
658
658
|
|
|
659
659
|
// src/config/loader.ts
|
|
660
660
|
import { readFileSync, existsSync } from "fs";
|
|
@@ -975,7 +975,28 @@ var ConfigLoader = class {
|
|
|
975
975
|
};
|
|
976
976
|
|
|
977
977
|
// src/daemon/ipc.ts
|
|
978
|
+
import { chmodSync, existsSync as existsSync2, readFileSync as readFileSync2, unlinkSync } from "fs";
|
|
978
979
|
import { createHash } from "crypto";
|
|
980
|
+
import { createRequire } from "module";
|
|
981
|
+
import { dirname as dirname2, join } from "path";
|
|
982
|
+
import { fileURLToPath } from "url";
|
|
983
|
+
var daemonVersions = (() => {
|
|
984
|
+
const readVer = (file) => {
|
|
985
|
+
try {
|
|
986
|
+
return JSON.parse(readFileSync2(file, "utf-8")).version ?? "";
|
|
987
|
+
} catch {
|
|
988
|
+
return "";
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
const lanVer = readVer(join(dirname2(fileURLToPath(import.meta.url)), "..", "..", "package.json"));
|
|
992
|
+
let peerVer = "";
|
|
993
|
+
try {
|
|
994
|
+
peerVer = readVer(createRequire(import.meta.url).resolve("@decentnetwork/peer/package.json"));
|
|
995
|
+
} catch {
|
|
996
|
+
peerVer = "";
|
|
997
|
+
}
|
|
998
|
+
return { lanVer, peerVer };
|
|
999
|
+
})();
|
|
979
1000
|
function ipcSocketPath(dataDir, platform = process.platform) {
|
|
980
1001
|
if (platform === "win32") {
|
|
981
1002
|
const id = createHash("sha256").update(dataDir.toLowerCase()).digest("hex").slice(0, 16);
|
|
@@ -999,7 +1020,7 @@ function hhmm(ts) {
|
|
|
999
1020
|
}
|
|
1000
1021
|
function lanVersion() {
|
|
1001
1022
|
try {
|
|
1002
|
-
const req =
|
|
1023
|
+
const req = createRequire2(import.meta.url);
|
|
1003
1024
|
return req("../../package.json").version ?? "";
|
|
1004
1025
|
} catch {
|
|
1005
1026
|
return "";
|
package/dist/daemon/ipc.js
CHANGED
|
@@ -22,9 +22,41 @@
|
|
|
22
22
|
* multi-user hardening can come later via peer-credential filtering.
|
|
23
23
|
*/
|
|
24
24
|
import { createServer } from "net";
|
|
25
|
-
import { chmodSync, existsSync, unlinkSync } from "fs";
|
|
25
|
+
import { chmodSync, existsSync, readFileSync, unlinkSync } from "fs";
|
|
26
26
|
import { createHash } from "crypto";
|
|
27
|
+
import { createRequire } from "module";
|
|
28
|
+
import { dirname, join } from "path";
|
|
29
|
+
import { fileURLToPath } from "url";
|
|
27
30
|
import { Logger } from "../utils/logger.js";
|
|
31
|
+
/**
|
|
32
|
+
* Versions of the code THIS daemon process is actually running.
|
|
33
|
+
*
|
|
34
|
+
* A UI that reads the versions off its own node_modules describes the package
|
|
35
|
+
* it was installed beside, not the process answering its calls — so after
|
|
36
|
+
* `npm i -g` but before a restart it cheerfully reports the fix as live while
|
|
37
|
+
* the daemon still runs the old build. `ping` carries these so the panel can
|
|
38
|
+
* show what is genuinely loaded.
|
|
39
|
+
*/
|
|
40
|
+
const daemonVersions = (() => {
|
|
41
|
+
const readVer = (file) => {
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(readFileSync(file, "utf-8")).version ?? "";
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// dist/daemon/ipc.js → ../../package.json
|
|
50
|
+
const lanVer = readVer(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "package.json"));
|
|
51
|
+
let peerVer = "";
|
|
52
|
+
try {
|
|
53
|
+
peerVer = readVer(createRequire(import.meta.url).resolve("@decentnetwork/peer/package.json"));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
peerVer = "";
|
|
57
|
+
}
|
|
58
|
+
return { lanVer, peerVer };
|
|
59
|
+
})();
|
|
28
60
|
export class IpcServer {
|
|
29
61
|
socketPath;
|
|
30
62
|
handlers;
|
|
@@ -167,7 +199,8 @@ export class IpcServer {
|
|
|
167
199
|
async dispatch(req) {
|
|
168
200
|
switch (req.op) {
|
|
169
201
|
case "ping":
|
|
170
|
-
|
|
202
|
+
// Carries the running daemon's versions — see `daemonVersions`.
|
|
203
|
+
return { pong: true, ...daemonVersions };
|
|
171
204
|
case "friend-request": {
|
|
172
205
|
if (!req.address)
|
|
173
206
|
throw new Error("address is required");
|
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.277";
|
|
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.277",
|
|
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.
|
|
87
|
+
"@decentnetwork/peer": "^0.1.139",
|
|
88
88
|
"@decentnetwork/peer-webrtc": "^0.2.10",
|
|
89
89
|
"ink": "^5.2.1",
|
|
90
90
|
"js-yaml": "^4.1.0",
|