@gluztm/dsh-guard 2.4.0 → 2.4.1

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/lib/index.mjs CHANGED
@@ -1,5 +1,8 @@
1
1
  import {
2
+ INSTALLER_URL,
3
+ PACKAGE_VERSION,
2
4
  RELEASE_URL,
5
+ REPO_URL,
3
6
  formatHealthText,
4
7
  formatSnapshotsText,
5
8
  inspectHealth,
@@ -65,7 +68,10 @@ function buildRouteTable(ctx) {
65
68
  const snapshots = inspectSnapshots({ target: 'all', limit: 15 })
66
69
  sendJson(res, 200, {
67
70
  ok: true,
71
+ version: PACKAGE_VERSION,
68
72
  platform: process.platform,
73
+ installerUrl: INSTALLER_URL,
74
+ repoUrl: REPO_URL,
69
75
  health,
70
76
  snapshots,
71
77
  checkedAt: Date.now(),
@@ -206,9 +212,13 @@ function buildToolDefinitions() {
206
212
  launched: { type: 'boolean', required: true },
207
213
  message: { type: 'string', required: true },
208
214
  releaseUrl: { type: 'string', required: true },
215
+ installerUrl: { type: 'string', required: true },
209
216
  },
210
217
  },
211
- render: (_args, value) => [{ type: 'text', text: value.message + (value.installed ? '' : `\n下载链接:${value.releaseUrl}`) }],
218
+ render: (_args, value) => [{
219
+ type: 'text',
220
+ text: value.message + (value.installed ? '' : `\n安装包直链:${value.installerUrl}\n发布页:${value.releaseUrl}`),
221
+ }],
212
222
  },
213
223
  async execute(args = {}) {
214
224
  const res = openGuard({ launch: Boolean(args.launch) })
@@ -217,6 +227,7 @@ function buildToolDefinitions() {
217
227
  launched: res.launched,
218
228
  message: res.message,
219
229
  releaseUrl: res.releaseUrl,
230
+ installerUrl: res.installerUrl || INSTALLER_URL,
220
231
  }
221
232
  },
222
233
  }),
@@ -248,7 +259,7 @@ export function apply(ctx) {
248
259
  const res = openGuard({ launch: true })
249
260
  return {
250
261
  kind: 'success',
251
- text: res.message + (res.installed ? '' : `\n下载地址:${res.releaseUrl}`),
262
+ text: res.message + (res.installed ? '' : `\n安装包直链:${res.installerUrl || INSTALLER_URL}\n发布页:${res.releaseUrl}`),
252
263
  }
253
264
  }
254
265
  return { kind: 'success', text: formatHealthText(inspectHealth({})) }
package/lib/inspector.mjs CHANGED
@@ -3,7 +3,10 @@ import { execFileSync, spawn } from 'node:child_process'
3
3
  import { homedir } from 'node:os'
4
4
  import { basename, join, resolve } from 'node:path'
5
5
 
6
+ export const PACKAGE_VERSION = '2.4.1'
7
+ export const REPO_URL = 'https://github.com/gluztm/DSHGuard'
6
8
  export const RELEASE_URL = 'https://github.com/gluztm/DSHGuard/releases/latest'
9
+ export const INSTALLER_URL = 'https://github.com/gluztm/DSHGuard/releases/download/2.4.1/DSHGuard-Setup-2.4.1.exe'
7
10
 
8
11
  const REG_POINTER_KEY = 'HKCU\\Software\\DSHGuard'
9
12
  const REG_UNINSTALL_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{9E1F7C34-5B2A-4D18-9C77-6A0E5D3B21F4}_is1'
@@ -87,6 +90,8 @@ export function locateGuardInstallation(options = {}) {
87
90
  exePath: matchedExe,
88
91
  snapshotsDir: matchedSnapshots,
89
92
  releaseUrl: RELEASE_URL,
93
+ installerUrl: INSTALLER_URL,
94
+ repoUrl: REPO_URL,
90
95
  }
91
96
  }
92
97
 
@@ -402,6 +407,8 @@ export function inspectSnapshots(options = {}) {
402
407
  total: 0,
403
408
  snapshots: [],
404
409
  releaseUrl: RELEASE_URL,
410
+ installerUrl: INSTALLER_URL,
411
+ repoUrl: REPO_URL,
405
412
  }
406
413
  }
407
414
 
@@ -428,6 +435,8 @@ export function inspectSnapshots(options = {}) {
428
435
  total: items.length,
429
436
  snapshots: items.slice(0, limit),
430
437
  releaseUrl: RELEASE_URL,
438
+ installerUrl: INSTALLER_URL,
439
+ repoUrl: REPO_URL,
431
440
  }
432
441
  }
433
442
 
@@ -443,7 +452,9 @@ export function openGuard(options = {}) {
443
452
  exePath: null,
444
453
  guardHome: guard.guardHome,
445
454
  releaseUrl: RELEASE_URL,
446
- message: '未检测到本地安装的 DSHGuard 守护壳,可前往 GitHub Releases 下载官方 Windows 安装包。',
455
+ installerUrl: INSTALLER_URL,
456
+ repoUrl: REPO_URL,
457
+ message: '未检测到本地 DSHGuard 桌面控制台。安装 Windows 完整版(免管理员)即可获得:四协议模型可视化配置与测速、CC Switch 多源凭据导入、进程外崩溃救援与快照回滚。',
447
458
  }
448
459
  }
449
460
 
@@ -455,6 +466,8 @@ export function openGuard(options = {}) {
455
466
  exePath: guard.exePath,
456
467
  guardHome: guard.guardHome,
457
468
  releaseUrl: RELEASE_URL,
469
+ installerUrl: INSTALLER_URL,
470
+ repoUrl: REPO_URL,
458
471
  message: '当前非 Windows 环境,无法直接拉起桌面端 DSHGuard.exe。',
459
472
  }
460
473
  }
@@ -474,6 +487,8 @@ export function openGuard(options = {}) {
474
487
  exePath: guard.exePath,
475
488
  guardHome: guard.guardHome,
476
489
  releaseUrl: RELEASE_URL,
490
+ installerUrl: INSTALLER_URL,
491
+ repoUrl: REPO_URL,
477
492
  message: `已在桌面拉起 DSHGuard 守护壳(${basename(guard.exePath)})。`,
478
493
  }
479
494
  } catch (err) {
@@ -483,6 +498,8 @@ export function openGuard(options = {}) {
483
498
  exePath: guard.exePath,
484
499
  guardHome: guard.guardHome,
485
500
  releaseUrl: RELEASE_URL,
501
+ installerUrl: INSTALLER_URL,
502
+ repoUrl: REPO_URL,
486
503
  message: `拉起 DSHGuard 守护壳失败:${err && err.message ? err.message : String(err)}`,
487
504
  }
488
505
  }
@@ -494,6 +511,8 @@ export function openGuard(options = {}) {
494
511
  exePath: guard.exePath,
495
512
  guardHome: guard.guardHome,
496
513
  releaseUrl: RELEASE_URL,
514
+ installerUrl: INSTALLER_URL,
515
+ repoUrl: REPO_URL,
497
516
  message: `已定位本机 DSHGuard 守护壳:${guard.exePath}`,
498
517
  }
499
518
  }
@@ -526,7 +545,7 @@ export function formatHealthText(report) {
526
545
  lines.push(
527
546
  report.guard.installed
528
547
  ? `- [本机 DSHGuard] 已安装(${report.guard.exePath})`
529
- : `- [本机 DSHGuard] 未安装,官方下载:${report.guard.releaseUrl}`
548
+ : `- [本机 DSHGuard] 未安装;安装 Windows 桌面控制台可解锁四协议模型配置与测速、CC Switch 多源凭据导入、进程外崩溃救援与快照回滚:\n 安装包直链:${report.guard.installerUrl || INSTALLER_URL}\n 发布页:${report.guard.releaseUrl}`
530
549
  )
531
550
  if (report.issues.length > 0) {
532
551
  lines.push('诊断建议:')
@@ -541,7 +560,7 @@ export function formatSnapshotsText(report) {
541
560
  if (!report.snapshotsDir || report.total === 0) {
542
561
  return report.guardInstalled
543
562
  ? '本机 DSHGuard 尚无快照存档(Snapshots 目录为空或不存在)。'
544
- : `未定位到本机 DSHGuard 快照目录;可在 Windows 安装 DSHGuard 后自动存档:${report.releaseUrl}`
563
+ : `未定位到本机 DSHGuard 快照目录;安装 Windows 桌面控制台可自动存档并于崩溃时回滚(支持四协议模型配置与 CC Switch 导入):\n安装包直链:${report.installerUrl || INSTALLER_URL}\n发布页:${report.releaseUrl}`
545
564
  }
546
565
  const lines = [`已找到 ${report.total} 份守护壳快照(展示最近 ${report.snapshots.length} 份):`]
547
566
  for (const snap of report.snapshots) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gluztm/dsh-guard",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Cross-platform read-only companion plugin & Web UI sidebar inspector for DSHGuard: inspects Web/Desktop bundle drift, cordis.patch.yml structure, masked .credentials.yaml key readiness, pre-change snapshots, and opens DSHGuard.exe on Windows (3 dsh_guard_* tools + /guard command + Web UI panel).",
5
5
  "icon": "./assets/icon.png",
6
6
  "license": "GPL-3.0-only",
@@ -22,6 +22,7 @@
22
22
  "bin",
23
23
  "lib",
24
24
  "cordis.patch.yml",
25
+ "screenshots.json",
25
26
  "README.md",
26
27
  "README.en.md",
27
28
  "LICENSE"
@@ -0,0 +1,7 @@
1
+ [
2
+ "https://raw.githubusercontent.com/gluztm/DSHGuard/main/docs/screenshots/241-companion-sidebar.png",
3
+ "https://raw.githubusercontent.com/gluztm/DSHGuard/main/docs/screenshots/240-showcase.gif",
4
+ "https://raw.githubusercontent.com/gluztm/DSHGuard/main/docs/screenshots/240-vault-dark.png",
5
+ "https://raw.githubusercontent.com/gluztm/DSHGuard/main/docs/screenshots/240-ccswitch-import-dark.png",
6
+ "https://raw.githubusercontent.com/gluztm/DSHGuard/main/docs/screenshots/240-status-running-dark.png"
7
+ ]