@dsh-sup/dsh-core-darwin-arm64 0.1.5-BETA.2 → 0.1.5-BETA.4
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/core.cjs +280 -200
- package/package.json +1 -1
- package/ui-react/assets/{InstancesPage-CKN1Eies.js → InstancesPage-rigmvUH5.js} +2 -2
- package/ui-react/assets/{OverviewPage-C0jq81HS.js → OverviewPage-B5RH9NXk.js} +1 -1
- package/ui-react/assets/{PluginsPage-5avVpMvM.js → PluginsPage-gAcmHjvU.js} +1 -1
- package/ui-react/assets/{RouterPage-30bf9HFw.js → RouterPage-C115y-B3.js} +1 -1
- package/ui-react/assets/{SettingsPage-BKnx_9pb.js → SettingsPage-BNrwQlMy.js} +1 -1
- package/ui-react/assets/{TasksPage-BahVLxU4.js → TasksPage-DvnGMoBB.js} +1 -1
- package/ui-react/assets/{supervisor-DX8HnT5i.js → supervisor-DwJMunGH.js} +2 -2
- package/ui-react/supervisor.html +1 -1
package/core.cjs
CHANGED
|
@@ -225,7 +225,7 @@ var require_version = __commonJS({
|
|
|
225
225
|
var fs2 = require("node:fs");
|
|
226
226
|
var path2 = require("node:path");
|
|
227
227
|
function guardVersion() {
|
|
228
|
-
if (true) return String("0.1.5-BETA.
|
|
228
|
+
if (true) return String("0.1.5-BETA.4");
|
|
229
229
|
try {
|
|
230
230
|
return JSON.parse(fs2.readFileSync(path2.join(__dirname, "..", "..", "package.json"), "utf8")).version || "unknown";
|
|
231
231
|
} catch {
|
|
@@ -236,6 +236,64 @@ var require_version = __commonJS({
|
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
+
// src/platform/matrix.js
|
|
240
|
+
var require_matrix = __commonJS({
|
|
241
|
+
"src/platform/matrix.js"(exports2, module2) {
|
|
242
|
+
"use strict";
|
|
243
|
+
var SUPPORTED = [
|
|
244
|
+
{ platform: "linux", arch: "x64", osTag: "linux", npmTag: "linux-x64" },
|
|
245
|
+
{ platform: "darwin", arch: "arm64", osTag: "darwin", npmTag: "darwin-arm64" },
|
|
246
|
+
{ platform: "darwin", arch: "x64", osTag: "darwin", npmTag: "darwin-x64" },
|
|
247
|
+
{ platform: "win32", arch: "x64", osTag: "win", npmTag: "win-x64" }
|
|
248
|
+
];
|
|
249
|
+
var OS_TAG = { linux: "linux", darwin: "darwin", win32: "win" };
|
|
250
|
+
var FRP_OS = { linux: "linux", darwin: "darwin", win32: "windows" };
|
|
251
|
+
var FRP_ARCH = { x64: "amd64", arm64: "arm64" };
|
|
252
|
+
function osTag(platform) {
|
|
253
|
+
return OS_TAG[platform || process.platform] || null;
|
|
254
|
+
}
|
|
255
|
+
function current(platform, arch) {
|
|
256
|
+
const p = platform || process.platform;
|
|
257
|
+
const a = arch || process.arch;
|
|
258
|
+
return { platform: p, arch: a, osTag: OS_TAG[p] || null, npmTag: npmTag(p, a) };
|
|
259
|
+
}
|
|
260
|
+
function npmTag(platform, arch) {
|
|
261
|
+
const p = platform || process.platform;
|
|
262
|
+
const a = arch || process.arch;
|
|
263
|
+
const os2 = OS_TAG[p];
|
|
264
|
+
if (!os2 || a !== "x64" && a !== "arm64") {
|
|
265
|
+
throw new Error("\u4E0D\u652F\u6301\u7684\u5E73\u53F0\u7EC4\u5408: " + p + "/" + a + "\uFF08\u4EC5 linux/darwin/win32 \xD7 x64/arm64\uFF09");
|
|
266
|
+
}
|
|
267
|
+
return os2 + "-" + a;
|
|
268
|
+
}
|
|
269
|
+
function isSupported(platform, arch) {
|
|
270
|
+
const p = platform || process.platform;
|
|
271
|
+
const a = arch || process.arch;
|
|
272
|
+
return SUPPORTED.some((x) => x.platform === p && x.arch === a);
|
|
273
|
+
}
|
|
274
|
+
function frpTag(platform, arch) {
|
|
275
|
+
const p = platform || process.platform;
|
|
276
|
+
const a = arch || process.arch;
|
|
277
|
+
const os2 = FRP_OS[p];
|
|
278
|
+
const am = FRP_ARCH[a];
|
|
279
|
+
if (!os2 || !am) return null;
|
|
280
|
+
return { os: os2, arch: am, tag: os2 + "_" + am, exe: p === "win32" };
|
|
281
|
+
}
|
|
282
|
+
function supportsProcessGroup(platform) {
|
|
283
|
+
return (platform || process.platform) !== "win32";
|
|
284
|
+
}
|
|
285
|
+
module2.exports = {
|
|
286
|
+
SUPPORTED,
|
|
287
|
+
osTag,
|
|
288
|
+
current,
|
|
289
|
+
npmTag,
|
|
290
|
+
isSupported,
|
|
291
|
+
frpTag,
|
|
292
|
+
supportsProcessGroup
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
239
297
|
// src/platform/os/pidlookup.js
|
|
240
298
|
var require_pidlookup = __commonJS({
|
|
241
299
|
"src/platform/os/pidlookup.js"(exports2, module2) {
|
|
@@ -245,6 +303,56 @@ var require_pidlookup = __commonJS({
|
|
|
245
303
|
var isLinux = process.platform === "linux";
|
|
246
304
|
var isMac = process.platform === "darwin";
|
|
247
305
|
var isWindows = process.platform === "win32";
|
|
306
|
+
function parseProcNetTcpInodes(txt, port) {
|
|
307
|
+
const inodes = /* @__PURE__ */ new Set();
|
|
308
|
+
for (const lineRaw of String(txt || "").split("\n")) {
|
|
309
|
+
const cols = lineRaw.trim().split(/\s+/);
|
|
310
|
+
if (cols.length < 10) continue;
|
|
311
|
+
const local = cols[1];
|
|
312
|
+
const st = cols[3];
|
|
313
|
+
const inode = cols[9];
|
|
314
|
+
if (!local || !inode) continue;
|
|
315
|
+
const p = local.split(":")[1];
|
|
316
|
+
if (st === "0A" && p && parseInt(p, 16) === port) inodes.add("socket:[" + inode + "]");
|
|
317
|
+
}
|
|
318
|
+
return inodes;
|
|
319
|
+
}
|
|
320
|
+
function parseLsofPid(out) {
|
|
321
|
+
for (const line of String(out || "").split("\n")) {
|
|
322
|
+
const m = line.trim().split(/\s+/);
|
|
323
|
+
if (m.length >= 2 && /^\d+$/.test(m[1])) return Number(m[1]);
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
function parseNetstatPid(out, port) {
|
|
328
|
+
const want = String(port);
|
|
329
|
+
for (const line of String(out || "").split("\n")) {
|
|
330
|
+
const parts = line.trim().split(/\s+/);
|
|
331
|
+
if (parts.length >= 5 && (parts[0] === "TCP" || parts[0] === "TCPv6") && parts[3] === "LISTENING") {
|
|
332
|
+
const lp = parts[1];
|
|
333
|
+
const p = lp.slice(lp.lastIndexOf(":") + 1);
|
|
334
|
+
if (p === want) {
|
|
335
|
+
const pid = Number(parts[4]);
|
|
336
|
+
if (Number.isInteger(pid) && pid > 0) return pid;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
function parseSsPid(out) {
|
|
343
|
+
const m = out && /pid=(\d+)/.exec(String(out));
|
|
344
|
+
return m ? Number(m[1]) : null;
|
|
345
|
+
}
|
|
346
|
+
function parseWmicCommandLine(out) {
|
|
347
|
+
if (!out) return null;
|
|
348
|
+
const m = /CommandLine=([\s\S]*)/.exec(String(out));
|
|
349
|
+
const v = m ? m[1].trim() : "";
|
|
350
|
+
return v || null;
|
|
351
|
+
}
|
|
352
|
+
function parsePowerShellCommandLine(out) {
|
|
353
|
+
const v = out ? String(out).trim() : "";
|
|
354
|
+
return v || null;
|
|
355
|
+
}
|
|
248
356
|
function linuxListeningInodes(port) {
|
|
249
357
|
const inodes = /* @__PURE__ */ new Set();
|
|
250
358
|
for (const f of ["/proc/net/tcp", "/proc/net/tcp6"]) {
|
|
@@ -254,16 +362,7 @@ var require_pidlookup = __commonJS({
|
|
|
254
362
|
} catch {
|
|
255
363
|
continue;
|
|
256
364
|
}
|
|
257
|
-
for (const
|
|
258
|
-
const cols = lineRaw.trim().split(/\s+/);
|
|
259
|
-
if (cols.length < 10) continue;
|
|
260
|
-
const local = cols[1];
|
|
261
|
-
const st = cols[3];
|
|
262
|
-
const inode = cols[9];
|
|
263
|
-
if (!local || !inode) continue;
|
|
264
|
-
const p = local.split(":")[1];
|
|
265
|
-
if (st === "0A" && p && parseInt(p, 16) === port) inodes.add("socket:[" + inode + "]");
|
|
266
|
-
}
|
|
365
|
+
for (const x of parseProcNetTcpInodes(txt, port)) inodes.add(x);
|
|
267
366
|
}
|
|
268
367
|
return inodes;
|
|
269
368
|
}
|
|
@@ -297,10 +396,7 @@ var require_pidlookup = __commonJS({
|
|
|
297
396
|
try {
|
|
298
397
|
const out = ex2.runOut("lsof", ["-nP", "-iTCP:" + port, "-sTCP:LISTEN"], { timeoutMs: 3e3 });
|
|
299
398
|
if (!out) return null;
|
|
300
|
-
|
|
301
|
-
const m = line.trim().split(/\s+/);
|
|
302
|
-
if (m.length >= 2 && /^\d+$/.test(m[1])) return Number(m[1]);
|
|
303
|
-
}
|
|
399
|
+
return parseLsofPid(out);
|
|
304
400
|
} catch {
|
|
305
401
|
}
|
|
306
402
|
return null;
|
|
@@ -309,18 +405,7 @@ var require_pidlookup = __commonJS({
|
|
|
309
405
|
try {
|
|
310
406
|
const out = ex2.runOut("netstat", ["-ano"], { timeoutMs: 3e3 });
|
|
311
407
|
if (!out) return null;
|
|
312
|
-
|
|
313
|
-
for (const line of out.split("\n")) {
|
|
314
|
-
const parts = line.trim().split(/\s+/);
|
|
315
|
-
if (parts.length >= 5 && (parts[0] === "TCP" || parts[0] === "TCPv6") && parts[3] === "LISTENING") {
|
|
316
|
-
const lp = parts[1];
|
|
317
|
-
const p = lp.slice(lp.lastIndexOf(":") + 1);
|
|
318
|
-
if (p === want) {
|
|
319
|
-
const pid = Number(parts[4]);
|
|
320
|
-
if (Number.isInteger(pid) && pid > 0) return pid;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
408
|
+
return parseNetstatPid(out, port);
|
|
324
409
|
} catch {
|
|
325
410
|
}
|
|
326
411
|
return null;
|
|
@@ -330,8 +415,8 @@ var require_pidlookup = __commonJS({
|
|
|
330
415
|
for (const ssBin of candidates) {
|
|
331
416
|
try {
|
|
332
417
|
const out = ex2.runOut(ssBin, ["-tlnHp", "sport = :" + port], { timeoutMs: 3e3 });
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
418
|
+
const pid = parseSsPid(out);
|
|
419
|
+
if (pid !== null) return pid;
|
|
335
420
|
} catch {
|
|
336
421
|
}
|
|
337
422
|
}
|
|
@@ -375,15 +460,12 @@ var require_pidlookup = __commonJS({
|
|
|
375
460
|
}
|
|
376
461
|
if (isWindows) {
|
|
377
462
|
const out = ex2.runOut("wmic", ["process", "where", "ProcessId=" + pid, "get", "CommandLine", "/value"], { timeoutMs: 5e3 });
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const viaWmic = m ? m[1].trim() : "";
|
|
381
|
-
if (viaWmic) return viaWmic;
|
|
382
|
-
}
|
|
463
|
+
const viaWmic = parseWmicCommandLine(out);
|
|
464
|
+
if (viaWmic) return viaWmic;
|
|
383
465
|
{
|
|
384
466
|
const ps = "(Get-CimInstance Win32_Process -Filter 'ProcessId=" + pid + "').CommandLine";
|
|
385
467
|
const o = ex2.runOut("powershell", ["-NoProfile", "-NonInteractive", "-Command", ps], { timeoutMs: 5e3 });
|
|
386
|
-
return o
|
|
468
|
+
return parsePowerShellCommandLine(o);
|
|
387
469
|
}
|
|
388
470
|
}
|
|
389
471
|
return null;
|
|
@@ -436,7 +518,24 @@ var require_pidlookup = __commonJS({
|
|
|
436
518
|
}
|
|
437
519
|
return out;
|
|
438
520
|
}
|
|
439
|
-
|
|
521
|
+
function normCmdline(s) {
|
|
522
|
+
return String(s || "").replace(/\\/g, "/");
|
|
523
|
+
}
|
|
524
|
+
module2.exports = {
|
|
525
|
+
findListeningPid,
|
|
526
|
+
isAlive,
|
|
527
|
+
readCmdline,
|
|
528
|
+
normCmdline,
|
|
529
|
+
isDshCmdline,
|
|
530
|
+
pgrepList,
|
|
531
|
+
// 平台输出纯解析器(2026-09-13 抽出:使其可在任意宿主上穷举;生产代码直接调用,非平行实现)
|
|
532
|
+
parseProcNetTcpInodes,
|
|
533
|
+
parseLsofPid,
|
|
534
|
+
parseNetstatPid,
|
|
535
|
+
parseSsPid,
|
|
536
|
+
parseWmicCommandLine,
|
|
537
|
+
parsePowerShellCommandLine
|
|
538
|
+
};
|
|
440
539
|
}
|
|
441
540
|
});
|
|
442
541
|
|
|
@@ -565,7 +664,7 @@ var require_daemon_lifecycle = __commonJS({
|
|
|
565
664
|
try {
|
|
566
665
|
const pid = pidlook.findListeningPid(this.ctlPort);
|
|
567
666
|
if (!pid) return null;
|
|
568
|
-
const cmd2 = pidlook.readCmdline(pid) || "";
|
|
667
|
+
const cmd2 = pidlook.normCmdline(pidlook.readCmdline(pid) || "");
|
|
569
668
|
return this._cmdMarks.some((mk) => mk && cmd2.indexOf(mk) >= 0) ? pid : null;
|
|
570
669
|
} catch {
|
|
571
670
|
return null;
|
|
@@ -865,13 +964,14 @@ var require_exec_path = __commonJS({
|
|
|
865
964
|
}
|
|
866
965
|
return null;
|
|
867
966
|
}
|
|
868
|
-
function standardDirs(platform, home) {
|
|
967
|
+
function standardDirs(platform, home, env) {
|
|
869
968
|
const pl = platform || process.platform;
|
|
870
969
|
const h = home || os2.homedir();
|
|
970
|
+
const e = env || process.env;
|
|
871
971
|
const dirs = [];
|
|
872
972
|
if (pl === "win32") {
|
|
873
|
-
if (
|
|
874
|
-
if (
|
|
973
|
+
if (e.APPDATA) dirs.push(path2.join(e.APPDATA, "npm"));
|
|
974
|
+
if (e.LOCALAPPDATA) dirs.push(path2.join(e.LOCALAPPDATA, "Programs", "dsh-supervisor"));
|
|
875
975
|
dirs.push(path2.join(h, ".local", "bin"));
|
|
876
976
|
} else {
|
|
877
977
|
dirs.push(path2.join(h, ".local", "bin"));
|
|
@@ -883,8 +983,9 @@ var require_exec_path = __commonJS({
|
|
|
883
983
|
}
|
|
884
984
|
return dirs;
|
|
885
985
|
}
|
|
886
|
-
function inPath(base, platform) {
|
|
887
|
-
const
|
|
986
|
+
function inPath(base, platform, env) {
|
|
987
|
+
const e = env || process.env;
|
|
988
|
+
const raw = e.PATH || e.Path || "";
|
|
888
989
|
for (const d of raw.split(path2.delimiter)) {
|
|
889
990
|
if (!d) continue;
|
|
890
991
|
const hit = firstExecutable(d, base, platform);
|
|
@@ -894,35 +995,42 @@ var require_exec_path = __commonJS({
|
|
|
894
995
|
}
|
|
895
996
|
function resolveExecutable(base, opts) {
|
|
896
997
|
const o = opts || {};
|
|
897
|
-
|
|
898
|
-
|
|
998
|
+
const pl = o.platform;
|
|
999
|
+
const env = o.env;
|
|
1000
|
+
const E = env || process.env;
|
|
1001
|
+
if (o.envVar && E[o.envVar]) {
|
|
1002
|
+
const v = E[o.envVar];
|
|
899
1003
|
try {
|
|
900
1004
|
if (fs2.statSync(v).isFile()) return v;
|
|
901
1005
|
} catch {
|
|
902
1006
|
}
|
|
903
1007
|
}
|
|
904
|
-
const inPathHit = inPath(base);
|
|
1008
|
+
const inPathHit = inPath(base, pl, env);
|
|
905
1009
|
if (inPathHit) return inPathHit;
|
|
906
|
-
for (const d of [...o.extraDirs || [], ...standardDirs()]) {
|
|
907
|
-
const hit = firstExecutable(d, base);
|
|
1010
|
+
for (const d of [...o.extraDirs || [], ...standardDirs(pl, void 0, env)]) {
|
|
1011
|
+
const hit = firstExecutable(d, base, pl);
|
|
908
1012
|
if (hit) return hit;
|
|
909
1013
|
}
|
|
910
1014
|
return null;
|
|
911
1015
|
}
|
|
912
1016
|
function npxBin(opts) {
|
|
913
|
-
const
|
|
1017
|
+
const o = opts || {};
|
|
1018
|
+
const pl = o.platform || process.platform;
|
|
1019
|
+
const env = o.env || process.env;
|
|
914
1020
|
if (pl !== "win32") return "npx";
|
|
915
|
-
const resolved = resolveExecutable("npx", { extraDirs: [
|
|
916
|
-
|
|
1021
|
+
const resolved = resolveExecutable("npx", { platform: pl, env, extraDirs: [
|
|
1022
|
+
env.APPDATA ? path2.join(env.APPDATA, "npm") : null
|
|
917
1023
|
].filter(Boolean) });
|
|
918
1024
|
if (resolved) return resolved;
|
|
919
1025
|
return "npx.cmd";
|
|
920
1026
|
}
|
|
921
1027
|
function npmBin(opts) {
|
|
922
|
-
const
|
|
1028
|
+
const o = opts || {};
|
|
1029
|
+
const pl = o.platform || process.platform;
|
|
1030
|
+
const env = o.env || process.env;
|
|
923
1031
|
if (pl !== "win32") return "npm";
|
|
924
|
-
const resolved = resolveExecutable("npm", { extraDirs: [
|
|
925
|
-
|
|
1032
|
+
const resolved = resolveExecutable("npm", { platform: pl, env, extraDirs: [
|
|
1033
|
+
env.APPDATA ? path2.join(env.APPDATA, "npm") : null
|
|
926
1034
|
].filter(Boolean) });
|
|
927
1035
|
if (resolved) return resolved;
|
|
928
1036
|
return "npm.cmd";
|
|
@@ -1171,53 +1279,54 @@ var require_notify = __commonJS({
|
|
|
1171
1279
|
"src/platform/os/notify.js"(exports2, module2) {
|
|
1172
1280
|
"use strict";
|
|
1173
1281
|
var { spawn } = require("node:child_process");
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1282
|
+
function appleScriptString(s) {
|
|
1283
|
+
return JSON.stringify(String(s));
|
|
1284
|
+
}
|
|
1285
|
+
function powerShellString(s) {
|
|
1286
|
+
return '"' + String(s).replace(/"/g, '""') + '"';
|
|
1287
|
+
}
|
|
1288
|
+
function notifyCommand(platform, title, body) {
|
|
1289
|
+
const pl = platform || process.platform;
|
|
1290
|
+
const t = String(title == null ? "" : title);
|
|
1291
|
+
const b = String(body == null ? "" : body);
|
|
1292
|
+
if (pl === "linux") {
|
|
1293
|
+
return { cmd: "notify-send", args: ["-a", "dsh-supervisor", t, b] };
|
|
1294
|
+
}
|
|
1295
|
+
if (pl === "darwin") {
|
|
1296
|
+
const script = "display notification " + appleScriptString(b) + " with title " + appleScriptString(t);
|
|
1297
|
+
return { cmd: "osascript", args: ["-e", script] };
|
|
1298
|
+
}
|
|
1299
|
+
if (pl === "win32") {
|
|
1300
|
+
const ps = [
|
|
1301
|
+
'[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null',
|
|
1302
|
+
'[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null',
|
|
1303
|
+
"$n = New-Object System.Windows.Forms.NotifyIcon",
|
|
1304
|
+
"$n.Icon = [System.Drawing.SystemIcons]::Information",
|
|
1305
|
+
"$n.Visible = $true",
|
|
1306
|
+
"$n.ShowBalloonTip(4000, " + powerShellString(t) + ", " + powerShellString(b) + ", [System.Windows.Forms.ToolTipIcon]::None)",
|
|
1307
|
+
"Start-Sleep -Milliseconds 4200",
|
|
1308
|
+
"$n.Dispose(); $n.Visible = $false"
|
|
1309
|
+
].join("; ");
|
|
1310
|
+
return { cmd: "powershell", args: ["-NoProfile", "-NonInteractive", "-Command", ps] };
|
|
1311
|
+
}
|
|
1312
|
+
return null;
|
|
1313
|
+
}
|
|
1177
1314
|
function notify(title, body, onError) {
|
|
1178
1315
|
try {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
if (isMac) {
|
|
1188
|
-
const script = "display notification " + JSON.stringify(String(body)) + " with title " + JSON.stringify(String(title));
|
|
1189
|
-
const c = spawn("osascript", ["-e", script], { stdio: "ignore" });
|
|
1190
|
-
c.on("error", () => {
|
|
1191
|
-
if (onError) onError();
|
|
1192
|
-
});
|
|
1193
|
-
c.unref();
|
|
1194
|
-
return true;
|
|
1195
|
-
}
|
|
1196
|
-
if (isWindows) {
|
|
1197
|
-
const ps = [
|
|
1198
|
-
'[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null',
|
|
1199
|
-
'[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null',
|
|
1200
|
-
"$n = New-Object System.Windows.Forms.NotifyIcon",
|
|
1201
|
-
"$n.Icon = [System.Drawing.SystemIcons]::Information",
|
|
1202
|
-
"$n.Visible = $true",
|
|
1203
|
-
"$n.ShowBalloonTip(4000, " + JSON.stringify(String(title)) + ", " + JSON.stringify(String(body)) + ", [System.Windows.Forms.ToolTipIcon]::None)",
|
|
1204
|
-
"Start-Sleep -Milliseconds 4200",
|
|
1205
|
-
"$n.Dispose(); $n.Visible = $false"
|
|
1206
|
-
].join("; ");
|
|
1207
|
-
const c = spawn("powershell", ["-NoProfile", "-NonInteractive", "-Command", ps], { stdio: "ignore" });
|
|
1208
|
-
c.on("error", () => {
|
|
1209
|
-
if (onError) onError();
|
|
1210
|
-
});
|
|
1211
|
-
c.unref();
|
|
1212
|
-
return true;
|
|
1213
|
-
}
|
|
1214
|
-
return false;
|
|
1316
|
+
const plan = notifyCommand(process.platform, title, body);
|
|
1317
|
+
if (!plan) return false;
|
|
1318
|
+
const c = spawn(plan.cmd, plan.args, { stdio: "ignore", detached: process.platform === "linux" });
|
|
1319
|
+
c.on("error", () => {
|
|
1320
|
+
if (onError) onError();
|
|
1321
|
+
});
|
|
1322
|
+
c.unref();
|
|
1323
|
+
return true;
|
|
1215
1324
|
} catch {
|
|
1216
1325
|
if (onError) onError();
|
|
1217
1326
|
return false;
|
|
1218
1327
|
}
|
|
1219
1328
|
}
|
|
1220
|
-
module2.exports = { notify };
|
|
1329
|
+
module2.exports = { notify, notifyCommand, appleScriptString, powerShellString };
|
|
1221
1330
|
}
|
|
1222
1331
|
});
|
|
1223
1332
|
|
|
@@ -1226,9 +1335,16 @@ var require_browser = __commonJS({
|
|
|
1226
1335
|
"src/platform/os/browser.js"(exports2, module2) {
|
|
1227
1336
|
"use strict";
|
|
1228
1337
|
var { spawn } = require("node:child_process");
|
|
1338
|
+
function openCommand(platform, url) {
|
|
1339
|
+
const pl = platform || process.platform;
|
|
1340
|
+
if (pl === "darwin") return { cmd: "open", args: [url] };
|
|
1341
|
+
if (pl === "win32") return { cmd: "cmd", args: ["/c", "start", "", url] };
|
|
1342
|
+
return { cmd: "xdg-open", args: [url] };
|
|
1343
|
+
}
|
|
1229
1344
|
function open(url) {
|
|
1230
1345
|
try {
|
|
1231
|
-
const
|
|
1346
|
+
const c = openCommand(process.platform, url);
|
|
1347
|
+
const p = spawn(c.cmd, c.args, { detached: true, stdio: "ignore" });
|
|
1232
1348
|
p.on("error", () => {
|
|
1233
1349
|
});
|
|
1234
1350
|
p.unref();
|
|
@@ -1255,6 +1371,37 @@ var require_browser = __commonJS({
|
|
|
1255
1371
|
child.unref();
|
|
1256
1372
|
return child;
|
|
1257
1373
|
}
|
|
1374
|
+
function isolatedPlan(platform, url, opts) {
|
|
1375
|
+
const o = opts || {};
|
|
1376
|
+
const antiArgs = o.antiArgs || [];
|
|
1377
|
+
const profileDir = o.profileDir;
|
|
1378
|
+
const pl = platform || process.platform;
|
|
1379
|
+
if (pl === "darwin") {
|
|
1380
|
+
return { kind: "single", bin: "open", args: ["-na", "Google Chrome", "--args", ...antiArgs], isolated: true, label: "Google Chrome" };
|
|
1381
|
+
}
|
|
1382
|
+
if (pl === "win32") {
|
|
1383
|
+
return {
|
|
1384
|
+
kind: "single",
|
|
1385
|
+
bin: "cmd",
|
|
1386
|
+
args: ["/c", "start", "", "chrome", "--incognito", "--user-data-dir=" + profileDir, url],
|
|
1387
|
+
isolated: true,
|
|
1388
|
+
label: "chrome"
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
return {
|
|
1392
|
+
kind: "chain",
|
|
1393
|
+
candidates: [
|
|
1394
|
+
{ bin: "microsoft-edge", args: antiArgs, isolated: true, watch: true, envKind: "anti" },
|
|
1395
|
+
{ bin: "microsoft-edge-stable", args: antiArgs, isolated: true, watch: true, envKind: "anti" },
|
|
1396
|
+
{ bin: "google-chrome", args: antiArgs, isolated: true, watch: true, envKind: "anti" },
|
|
1397
|
+
{ bin: "chromium", args: antiArgs, isolated: true, watch: true, envKind: "anti" },
|
|
1398
|
+
{ bin: "chromium-browser", args: antiArgs, isolated: true, watch: true, envKind: "anti" },
|
|
1399
|
+
{ bin: "firefox", args: ["--private-window", url], isolated: false, watch: true, envKind: "sys" },
|
|
1400
|
+
{ bin: "xdg-open", args: [url], isolated: false, watch: false, envKind: "sys" }
|
|
1401
|
+
// 兜底:无隔离
|
|
1402
|
+
]
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1258
1405
|
function launchIsolated(url, o) {
|
|
1259
1406
|
const opts = o || {};
|
|
1260
1407
|
const profileDir = opts.profileDir;
|
|
@@ -1263,31 +1410,20 @@ var require_browser = __commonJS({
|
|
|
1263
1410
|
const sysEnv = opts.sysEnv || process.env;
|
|
1264
1411
|
const onExit = opts.onExit;
|
|
1265
1412
|
try {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
return { ok: !!p, bin: p ? "chrome" : null, isolated: true };
|
|
1273
|
-
}
|
|
1274
|
-
const candidates = [
|
|
1275
|
-
{ bin: "microsoft-edge", args: antiArgs, env: antiEnv, isolated: true, watch: true },
|
|
1276
|
-
{ bin: "microsoft-edge-stable", args: antiArgs, env: antiEnv, isolated: true, watch: true },
|
|
1277
|
-
{ bin: "google-chrome", args: antiArgs, env: antiEnv, isolated: true, watch: true },
|
|
1278
|
-
{ bin: "chromium", args: antiArgs, env: antiEnv, isolated: true, watch: true },
|
|
1279
|
-
{ bin: "chromium-browser", args: antiArgs, env: antiEnv, isolated: true, watch: true },
|
|
1280
|
-
{ bin: "firefox", args: ["--private-window", url], env: sysEnv, isolated: false, watch: true },
|
|
1281
|
-
{ bin: "xdg-open", args: [url], env: sysEnv, isolated: false, watch: false }
|
|
1282
|
-
// 兜底:无隔离
|
|
1283
|
-
];
|
|
1413
|
+
const plan = isolatedPlan(process.platform, url, { profileDir, antiArgs });
|
|
1414
|
+
if (plan.kind === "single") {
|
|
1415
|
+
const env = plan.bin === "open" ? antiEnv : sysEnv;
|
|
1416
|
+
const p = _spawnDetached(plan.bin, plan.args, env, onExit);
|
|
1417
|
+
return { ok: !!p, bin: p ? plan.label : null, isolated: plan.isolated };
|
|
1418
|
+
}
|
|
1284
1419
|
let idx = 0;
|
|
1285
1420
|
const tryNext = () => {
|
|
1286
|
-
if (idx >= candidates.length) return { ok: false, bin: null, isolated: false };
|
|
1287
|
-
const c = candidates[idx++];
|
|
1421
|
+
if (idx >= plan.candidates.length) return { ok: false, bin: null, isolated: false };
|
|
1422
|
+
const c = plan.candidates[idx++];
|
|
1423
|
+
const env = c.envKind === "anti" ? antiEnv : sysEnv;
|
|
1288
1424
|
let child;
|
|
1289
1425
|
try {
|
|
1290
|
-
child = spawn(c.bin, c.args, { detached: true, stdio: "ignore", env:
|
|
1426
|
+
child = spawn(c.bin, c.args, { detached: true, stdio: "ignore", env: env || sysEnv });
|
|
1291
1427
|
} catch {
|
|
1292
1428
|
return tryNext();
|
|
1293
1429
|
}
|
|
@@ -1308,7 +1444,7 @@ var require_browser = __commonJS({
|
|
|
1308
1444
|
return { ok: false, bin: null, isolated: false };
|
|
1309
1445
|
}
|
|
1310
1446
|
}
|
|
1311
|
-
module2.exports = { open, launchIsolated };
|
|
1447
|
+
module2.exports = { open, launchIsolated, openCommand, isolatedPlan };
|
|
1312
1448
|
}
|
|
1313
1449
|
});
|
|
1314
1450
|
|
|
@@ -1356,7 +1492,7 @@ var require_desktop = __commonJS({
|
|
|
1356
1492
|
}
|
|
1357
1493
|
return {
|
|
1358
1494
|
platform: PLATFORM,
|
|
1359
|
-
available:
|
|
1495
|
+
available: sessionAvailable(),
|
|
1360
1496
|
reason: "session-scoped-by-launcher"
|
|
1361
1497
|
};
|
|
1362
1498
|
}
|
|
@@ -1459,6 +1595,9 @@ var require_autostart = __commonJS({
|
|
|
1459
1595
|
guiLabel: GUI_LABEL
|
|
1460
1596
|
};
|
|
1461
1597
|
}
|
|
1598
|
+
if (!isLinux && !isMac && !isWindows) {
|
|
1599
|
+
return { kind: "none", unit: "unsupported", on: false, gui: false };
|
|
1600
|
+
}
|
|
1462
1601
|
let unit = "unknown";
|
|
1463
1602
|
const en = ex2.runDetail("systemctl", ["--user", "is-enabled", "dsh-supervisor.service"]);
|
|
1464
1603
|
unit = String(en.stdout || en.stderr || "disabled").trim() || "disabled";
|
|
@@ -4690,6 +4829,7 @@ var require_dist = __commonJS({
|
|
|
4690
4829
|
var fs2 = require("node:fs");
|
|
4691
4830
|
var path2 = require("node:path");
|
|
4692
4831
|
var net = require("node:net");
|
|
4832
|
+
var matrix = require_matrix();
|
|
4693
4833
|
var { spawn } = require("node:child_process");
|
|
4694
4834
|
var { npmBin } = require_exec_path();
|
|
4695
4835
|
var registryContract = require_registry_contract();
|
|
@@ -4869,14 +5009,7 @@ var require_dist = __commonJS({
|
|
|
4869
5009
|
* 并如实上报(见该函数的 try/catch),不会让守卫崩溃。
|
|
4870
5010
|
*/
|
|
4871
5011
|
_platformTag() {
|
|
4872
|
-
|
|
4873
|
-
const archMap = { arm64: "arm64", x64: "x64" };
|
|
4874
|
-
const os2 = osMap[process.platform];
|
|
4875
|
-
const arch = archMap[process.arch];
|
|
4876
|
-
if (!os2 || !arch) {
|
|
4877
|
-
throw new Error("\u4E0D\u652F\u6301\u7684\u5E73\u53F0\u7EC4\u5408: " + process.platform + "/" + process.arch + "\uFF08\u4EC5 linux/darwin/win32 \xD7 x64/arm64\uFF09");
|
|
4878
|
-
}
|
|
4879
|
-
return os2 + "-" + arch;
|
|
5012
|
+
return matrix.npmTag();
|
|
4880
5013
|
}
|
|
4881
5014
|
/**
|
|
4882
5015
|
* 探测单个 registry 的可达性 + 延迟。
|
|
@@ -7355,20 +7488,14 @@ var require_frpmgr = __commonJS({
|
|
|
7355
7488
|
"use strict";
|
|
7356
7489
|
var fs2 = require("node:fs");
|
|
7357
7490
|
var path2 = require("node:path");
|
|
7491
|
+
var matrix = require_matrix();
|
|
7358
7492
|
var http2 = require("node:http");
|
|
7359
7493
|
var https = require("node:https");
|
|
7360
7494
|
var { spawn } = require("node:child_process");
|
|
7361
7495
|
var crypto = require("node:crypto");
|
|
7362
7496
|
var FRP_VERSION = "0.61.1";
|
|
7363
7497
|
function frpPlatformTag(platform, arch) {
|
|
7364
|
-
|
|
7365
|
-
const ar = arch || process.arch;
|
|
7366
|
-
const osMap = { linux: "linux", darwin: "darwin", win32: "windows" };
|
|
7367
|
-
const archMap = { x64: "amd64", arm64: "arm64" };
|
|
7368
|
-
const os2 = osMap[pl];
|
|
7369
|
-
const am = archMap[ar];
|
|
7370
|
-
if (!os2 || !am) return null;
|
|
7371
|
-
return { os: os2, arch: am, tag: os2 + "_" + am, exe: pl === "win32" };
|
|
7498
|
+
return matrix.frpTag(platform, arch);
|
|
7372
7499
|
}
|
|
7373
7500
|
var MIRROR_PREFIXES = [
|
|
7374
7501
|
"https://ghfast.top/",
|
|
@@ -7640,8 +7767,9 @@ var require_frpmgr = __commonJS({
|
|
|
7640
7767
|
}
|
|
7641
7768
|
};
|
|
7642
7769
|
if (!this.frpTag) {
|
|
7643
|
-
|
|
7644
|
-
|
|
7770
|
+
const cur = matrix.current();
|
|
7771
|
+
if (this.events) this.events.append("frpc_install_failed", { detail: "\u5F53\u524D\u5E73\u53F0\u65E0 frpc \u5B98\u65B9\u4EA7\u7269: " + cur.platform + "/" + cur.arch });
|
|
7772
|
+
return { ok: false, error: "\u5F53\u524D\u5E73\u53F0\u4E0D\u652F\u6301 FRP\uFF08" + cur.platform + "/" + cur.arch + "\uFF09\uFF0C\u4EC5 linux/darwin/win32 \xD7 x64/arm64" };
|
|
7645
7773
|
}
|
|
7646
7774
|
const asset = "frp_" + FRP_VERSION + "_" + this.frpTag.tag + ".tar.gz";
|
|
7647
7775
|
const urls = downloadUrls(asset);
|
|
@@ -10358,6 +10486,7 @@ var require_plugins = __commonJS({
|
|
|
10358
10486
|
var fs2 = require("node:fs");
|
|
10359
10487
|
var path2 = require("node:path");
|
|
10360
10488
|
var os2 = require("node:os");
|
|
10489
|
+
var matrix = require_matrix();
|
|
10361
10490
|
var { semverCompare } = require_dist();
|
|
10362
10491
|
var { dirSizeBytes } = require_fs_utils();
|
|
10363
10492
|
var PROTECTED = /* @__PURE__ */ new Set(["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app"]);
|
|
@@ -10725,7 +10854,7 @@ var require_plugins = __commonJS({
|
|
|
10725
10854
|
const killTree = (sig) => {
|
|
10726
10855
|
if (!child) return;
|
|
10727
10856
|
try {
|
|
10728
|
-
if (
|
|
10857
|
+
if (matrix.supportsProcessGroup() && child.pid) process.kill(-child.pid, sig);
|
|
10729
10858
|
else child.kill(sig);
|
|
10730
10859
|
} catch {
|
|
10731
10860
|
try {
|
|
@@ -11506,7 +11635,7 @@ var require_watchdog = __commonJS({
|
|
|
11506
11635
|
if (inUpdate && !phaseStale) return true;
|
|
11507
11636
|
try {
|
|
11508
11637
|
const j = shell.readJournal && shell.readJournal();
|
|
11509
|
-
if (j && j.to && !j.confirmed
|
|
11638
|
+
if (j && j.to && !j.confirmed) return true;
|
|
11510
11639
|
} catch {
|
|
11511
11640
|
}
|
|
11512
11641
|
return false;
|
|
@@ -11661,11 +11790,7 @@ var require_shell = __commonJS({
|
|
|
11661
11790
|
return readJson(journalPath()) || {
|
|
11662
11791
|
from: null,
|
|
11663
11792
|
to: null,
|
|
11664
|
-
attempts: 0,
|
|
11665
|
-
maxAttempts: 2,
|
|
11666
11793
|
confirmed: false,
|
|
11667
|
-
rolledBack: false,
|
|
11668
|
-
pinnedVersions: [],
|
|
11669
11794
|
startedAt: null,
|
|
11670
11795
|
lastAttemptAt: null
|
|
11671
11796
|
};
|
|
@@ -11677,9 +11802,7 @@ var require_shell = __commonJS({
|
|
|
11677
11802
|
const j = readJournal();
|
|
11678
11803
|
j.from = from || j.from;
|
|
11679
11804
|
j.to = to;
|
|
11680
|
-
j.attempts = 0;
|
|
11681
11805
|
j.confirmed = false;
|
|
11682
|
-
j.rolledBack = false;
|
|
11683
11806
|
j.startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
11684
11807
|
writeJournal(j);
|
|
11685
11808
|
return j;
|
|
@@ -11692,45 +11815,19 @@ var require_shell = __commonJS({
|
|
|
11692
11815
|
if (cur && cur === j.to && id && id.phase === "ready") {
|
|
11693
11816
|
if (!j.confirmed) {
|
|
11694
11817
|
j.confirmed = true;
|
|
11695
|
-
j.attempts = 0;
|
|
11696
11818
|
writeJournal(j);
|
|
11697
11819
|
}
|
|
11698
11820
|
return { state: "confirmed", version: cur, reason: "\u58F3\u5DF2\u5065\u5EB7\u8FD0\u884C\u65B0\u7248\u672C", journal: j, identity: id };
|
|
11699
11821
|
}
|
|
11700
|
-
const attempt = id && typeof id.attempt === "number" ? id.attempt : 0;
|
|
11701
|
-
if (cur && cur !== j.to && attempt >= (j.maxAttempts || 2)) {
|
|
11702
|
-
return {
|
|
11703
|
-
state: "should-rollback",
|
|
11704
|
-
target: j.to,
|
|
11705
|
-
current: cur,
|
|
11706
|
-
attempts: attempt,
|
|
11707
|
-
reason: `\u58F3 ${attempt} \u6B21\u672A\u80FD\u5728 ${j.to} \u4E0A\u5C31\u7EEA\uFF08\u5F53\u524D ${cur}\uFF09`,
|
|
11708
|
-
journal: j,
|
|
11709
|
-
identity: id
|
|
11710
|
-
};
|
|
11711
|
-
}
|
|
11712
11822
|
return {
|
|
11713
11823
|
state: "pending",
|
|
11714
11824
|
target: j.to,
|
|
11715
11825
|
current: cur,
|
|
11716
|
-
attempts: attempt,
|
|
11717
11826
|
reason: cur === j.to ? "\u7B49\u5F85\u58F3\u4E0A\u62A5\u5C31\u7EEA" : "\u7B49\u5F85\u58F3\u91CD\u542F\u5230\u65B0\u7248\u672C",
|
|
11718
11827
|
journal: j,
|
|
11719
11828
|
identity: id
|
|
11720
11829
|
};
|
|
11721
11830
|
}
|
|
11722
|
-
function rollback(reason) {
|
|
11723
|
-
const j = readJournal();
|
|
11724
|
-
const bad = j.to;
|
|
11725
|
-
if (bad && !j.pinnedVersions.includes(bad)) j.pinnedVersions.push(bad);
|
|
11726
|
-
j.rolledBack = true;
|
|
11727
|
-
j.confirmed = false;
|
|
11728
|
-
j.attempts = 0;
|
|
11729
|
-
j.to = null;
|
|
11730
|
-
j.lastAttemptAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
11731
|
-
writeJournal(j);
|
|
11732
|
-
return { ok: true, pinned: bad, reason: reason || null, journal: j };
|
|
11733
|
-
}
|
|
11734
11831
|
function health(payload) {
|
|
11735
11832
|
const p = payload || {};
|
|
11736
11833
|
const dir = shellDir();
|
|
@@ -11753,7 +11850,6 @@ var require_shell = __commonJS({
|
|
|
11753
11850
|
journal: j,
|
|
11754
11851
|
state: ev.state,
|
|
11755
11852
|
reason: ev.reason || null,
|
|
11756
|
-
pinned: j.pinnedVersions || [],
|
|
11757
11853
|
dir: shellDir()
|
|
11758
11854
|
};
|
|
11759
11855
|
}
|
|
@@ -11859,7 +11955,7 @@ var require_shell = __commonJS({
|
|
|
11859
11955
|
return { ok: false, error: "\u62C9\u8D77\u65B0\u58F3\u5931\u8D25: " + (e && e.message || e), killed };
|
|
11860
11956
|
}
|
|
11861
11957
|
}
|
|
11862
|
-
module2.exports = { status, evaluate, health, markPending,
|
|
11958
|
+
module2.exports = { status, evaluate, health, markPending, identity, readJournal, shellDir, checkUpdate, restartShell, SHELL_RELEASE_PKG };
|
|
11863
11959
|
}
|
|
11864
11960
|
});
|
|
11865
11961
|
|
|
@@ -12270,6 +12366,9 @@ var require_manager2 = __commonJS({
|
|
|
12270
12366
|
function npmExe(self) {
|
|
12271
12367
|
return self && self._npmBin || execPath.npmBin();
|
|
12272
12368
|
}
|
|
12369
|
+
function npmExeArgs(self) {
|
|
12370
|
+
return self && Array.isArray(self._npmBinArgs) ? self._npmBinArgs.slice() : [];
|
|
12371
|
+
}
|
|
12273
12372
|
var { semverCompare, VERSION_RE } = require_dist();
|
|
12274
12373
|
var NativeManager = class {
|
|
12275
12374
|
constructor(opts) {
|
|
@@ -12415,7 +12514,7 @@ var require_manager2 = __commonJS({
|
|
|
12415
12514
|
const errors = [];
|
|
12416
12515
|
const nv = ex2.runOut("node", ["--version"]);
|
|
12417
12516
|
if (!nv || !nv.trim()) errors.push("node \u672A\u5B89\u88C5\u6216\u4E0D\u53EF\u6267\u884C");
|
|
12418
|
-
const npmv = ex2.runOut(npmExe(this), ["--version"]);
|
|
12517
|
+
const npmv = ex2.runOut(npmExe(this), npmExeArgs(this).concat(["--version"]));
|
|
12419
12518
|
if (!npmv || !npmv.trim()) errors.push("npm \u672A\u5B89\u88C5\u6216\u4E0D\u53EF\u6267\u884C");
|
|
12420
12519
|
let npmRoot = this.npmRoot;
|
|
12421
12520
|
if (!npmRoot) {
|
|
@@ -12467,7 +12566,7 @@ var require_manager2 = __commonJS({
|
|
|
12467
12566
|
let pkgDir = null;
|
|
12468
12567
|
try {
|
|
12469
12568
|
if (!npmRoot) {
|
|
12470
|
-
const r = ex2.runOut(npmExe(this), ["root", "-g"]);
|
|
12569
|
+
const r = ex2.runOut(npmExe(this), npmExeArgs(this).concat(["root", "-g"]));
|
|
12471
12570
|
if (r) npmRoot = r.trim();
|
|
12472
12571
|
}
|
|
12473
12572
|
pkgDir = path2.join(npmRoot, this.config.packageName || "@deepseek-ai/dsh");
|
|
@@ -12946,7 +13045,7 @@ var require_manager2 = __commonJS({
|
|
|
12946
13045
|
const exitCode = await new Promise((resolve) => {
|
|
12947
13046
|
let child;
|
|
12948
13047
|
try {
|
|
12949
|
-
child = spawn(npmExe(this), uninstallArgs, { stdio: ["ignore", "pipe", "pipe"] });
|
|
13048
|
+
child = spawn(npmExe(this), npmExeArgs(this).concat(uninstallArgs), { stdio: ["ignore", "pipe", "pipe"] });
|
|
12950
13049
|
} catch (e) {
|
|
12951
13050
|
return resolve(-1);
|
|
12952
13051
|
}
|
|
@@ -16191,26 +16290,6 @@ var require_shell2 = __commonJS({
|
|
|
16191
16290
|
return send(r.ok ? 200 : 500, r);
|
|
16192
16291
|
}).catch((e) => send(500, { ok: false, error: e.message }));
|
|
16193
16292
|
}
|
|
16194
|
-
if (req.method === "POST" && pathname === "/shell/rollback") {
|
|
16195
|
-
if (!originAllowed(req, sup.config.apiPort)) {
|
|
16196
|
-
req.resume();
|
|
16197
|
-
return send(403, {});
|
|
16198
|
-
}
|
|
16199
|
-
return collectBody(req, res, 8192, (body) => {
|
|
16200
|
-
let j = {};
|
|
16201
|
-
try {
|
|
16202
|
-
j = body ? JSON.parse(body) : {};
|
|
16203
|
-
} catch {
|
|
16204
|
-
}
|
|
16205
|
-
try {
|
|
16206
|
-
const r = shell.rollback(j.reason || "manual");
|
|
16207
|
-
if (sup.events) sup.events.append("shell_update_rolled_back", { pinned: r.pinned, reason: r.reason });
|
|
16208
|
-
return send(200, r);
|
|
16209
|
-
} catch (e) {
|
|
16210
|
-
return send(500, { ok: false, error: e.message });
|
|
16211
|
-
}
|
|
16212
|
-
});
|
|
16213
|
-
}
|
|
16214
16293
|
if (req.method === "GET" || req.method === "POST") return send(404, { error: "not found", path: pathname });
|
|
16215
16294
|
return send(405, { error: "method not allowed" });
|
|
16216
16295
|
}
|
|
@@ -16616,7 +16695,7 @@ var require_supervise_view = __commonJS({
|
|
|
16616
16695
|
try {
|
|
16617
16696
|
const pid = pidlook.findListeningPid(this._routerCtlPort());
|
|
16618
16697
|
if (!pid) return false;
|
|
16619
|
-
const cmd2 = pidlook.readCmdline(pid) || "";
|
|
16698
|
+
const cmd2 = pidlook.normCmdline(pidlook.readCmdline(pid) || "");
|
|
16620
16699
|
return cmd2.indexOf("router-daemon") >= 0 || cmd2.indexOf("service-daemon") >= 0 || cmd2.indexOf("/domains/router/daemon.js") >= 0;
|
|
16621
16700
|
} catch {
|
|
16622
16701
|
return false;
|
|
@@ -17648,6 +17727,7 @@ var require_settings_view = __commonJS({
|
|
|
17648
17727
|
var { spawn } = require("node:child_process");
|
|
17649
17728
|
var { execFile } = require("node:child_process");
|
|
17650
17729
|
var ex2 = require_exec();
|
|
17730
|
+
var matrix = require_matrix();
|
|
17651
17731
|
var netInfo = require_netinfo();
|
|
17652
17732
|
var { EnvCatalog } = require_env_catalog();
|
|
17653
17733
|
var { semverCompare } = require_dist();
|
|
@@ -17748,7 +17828,7 @@ var require_settings_view = __commonJS({
|
|
|
17748
17828
|
}
|
|
17749
17829
|
/** 守卫自更新「重启生效」衔接:仅当配置 guardRestartAllowed=true 且存在 systemd 用户单元才执行;
|
|
17750
17830
|
* 否则返回明确指引(避免误杀/误起守卫)。 */
|
|
17751
|
-
/** 自更新后的守卫重启(A2
|
|
17831
|
+
/** 自更新后的守卫重启(A2):能力按部署形态自动判定(打包态=systemd 重启闭环;源码形态=拒绝),
|
|
17752
17832
|
* 去掉 guardRestartAllowed 人工配置门槛。重启前落盘「预期版本」,重启后 /status 校验自报版本
|
|
17753
17833
|
* 达标才算更新成功——闭环可观测,不再出现"装了没生效"的静默失败。 */
|
|
17754
17834
|
guardSelfUpdateRestart() {
|
|
@@ -17787,8 +17867,7 @@ var require_settings_view = __commonJS({
|
|
|
17787
17867
|
guardCorePkg() {
|
|
17788
17868
|
const raw = this.config.corePackageName;
|
|
17789
17869
|
if (!raw) return null;
|
|
17790
|
-
|
|
17791
|
-
return String(raw).replace(/{os}/g, map[process.platform] || process.platform).replace(/{arch}/g, String(process.arch)) || null;
|
|
17870
|
+
return String(raw).replace(/{os}/g, matrix.osTag()).replace(/{arch}/g, matrix.current().arch) || null;
|
|
17792
17871
|
}
|
|
17793
17872
|
/** 守卫自更新(2026-09 收敛:npm 通道)——查 @dsh-sup/dsh-core-<os>-<arch> 全 tag 最高版本(全更新:
|
|
17794
17873
|
* BETA/RC/正式都算更新,任一更高即提示可更新),对本机 guardVersion 比较。 */
|
|
@@ -18268,7 +18347,7 @@ var require_control_view = __commonJS({
|
|
|
18268
18347
|
try {
|
|
18269
18348
|
const pid = pidlook.findListeningPid(this._lanCtlPort());
|
|
18270
18349
|
if (!pid) return false;
|
|
18271
|
-
const cmd2 = pidlook.readCmdline(pid) || "";
|
|
18350
|
+
const cmd2 = pidlook.normCmdline(pidlook.readCmdline(pid) || "");
|
|
18272
18351
|
return cmd2.indexOf("lan-daemon") >= 0 || cmd2.indexOf("/domains/relay/daemon.js") >= 0;
|
|
18273
18352
|
} catch {
|
|
18274
18353
|
return false;
|
|
@@ -19481,6 +19560,7 @@ var require_supervisor = __commonJS({
|
|
|
19481
19560
|
var fs2 = require("node:fs");
|
|
19482
19561
|
var path2 = require("node:path");
|
|
19483
19562
|
var os2 = require("node:os");
|
|
19563
|
+
var matrix = require_matrix();
|
|
19484
19564
|
var pidlook = require_pidlookup();
|
|
19485
19565
|
var { DaemonLifecycle } = require_daemon_lifecycle();
|
|
19486
19566
|
var platform = require_os();
|
|
@@ -20393,7 +20473,7 @@ var require_supervisor = __commonJS({
|
|
|
20393
20473
|
if (!this.notifyEnabled) return;
|
|
20394
20474
|
platform.notify(title, body, () => {
|
|
20395
20475
|
this.notifyEnabled = false;
|
|
20396
|
-
this.logger.warn("\u684C\u9762\u901A\u77E5\u4E0D\u53EF\u7528\uFF08" +
|
|
20476
|
+
this.logger.warn("\u684C\u9762\u901A\u77E5\u4E0D\u53EF\u7528\uFF08" + matrix.osTag() + "\uFF09\uFF0C\u5DF2\u505C\u7528");
|
|
20397
20477
|
});
|
|
20398
20478
|
}
|
|
20399
20479
|
// ---- 升级流程挂钩(先停后装,消除运行中替换文件的混合版本窗口)----
|