@noob-stupid/dsh-plugin-console 0.3.14 → 0.3.15
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.js +26 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -3298,6 +3298,12 @@ async function handle(ctx, req, res) {
|
|
|
3298
3298
|
// 升级完成重启后,框架适配逻辑自动:备份新版本快照 + 重打框架补丁 + 版本提示。
|
|
3299
3299
|
let current = null
|
|
3300
3300
|
let dshDir = null
|
|
3301
|
+
// 面板自报名(自报名一致性校验用):从插件自身 package.json 读,与部署目录比对
|
|
3302
|
+
let selfName = null
|
|
3303
|
+
try {
|
|
3304
|
+
const selfPkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf8'))
|
|
3305
|
+
selfName = typeof selfPkg.name === 'string' ? selfPkg.name : null
|
|
3306
|
+
} catch {}
|
|
3301
3307
|
try {
|
|
3302
3308
|
const require = createRequire(ctx.baseUrl ?? 'file:///')
|
|
3303
3309
|
const dshPkgPath = require.resolve('@deepseek-ai/dsh/package.json')
|
|
@@ -3596,6 +3602,26 @@ async function handle(ctx, req, res) {
|
|
|
3596
3602
|
`}`,
|
|
3597
3603
|
`Verify-DependencyTree '${target}'`,
|
|
3598
3604
|
`Log ('依赖树完整性修复完成(' + $script:treeFixed + ' 个)')`,
|
|
3605
|
+
// 自报名一致性校验(事故教训:面板自身部署名与代码自报名不一致崩溃)——
|
|
3606
|
+
// 曾把 @noob-stupid/dsh-plugin-console 的代码装进 @deepseek-ai/dsh-plugin-console 目录,
|
|
3607
|
+
// 浏览器端报 loaded without registering "@deepseek-ai/dsh-plugin-console"(加载器期望
|
|
3608
|
+
// 目录名 = 包名 = 登记 ID,三者必须一致)。校验面板自身:export const name / client.js
|
|
3609
|
+
// 注册 id 必须与部署目录名一致,不一致则日志告警(升级脚本不自动改名——避免破坏运行时)。
|
|
3610
|
+
`function Verify-SelfNameConsistency($expectedName) {`,
|
|
3611
|
+
` $selfDir = ${ps(dirname(dirname(fileURLToPath(import.meta.url))))}`,
|
|
3612
|
+
` $indexJs = Join-Path $selfDir 'lib\\index.js'`,
|
|
3613
|
+
` $clientJs = Join-Path $selfDir 'lib\\client.js'`,
|
|
3614
|
+
` if (-not (Test-Path $indexJs)) { Log ('自报名校验跳过:index.js 未找到'); return }`,
|
|
3615
|
+
` $idx = Get-Content $indexJs -Raw`,
|
|
3616
|
+
` $nameOk = $idx.Contains("export const name = '" + $expectedName + "'")`,
|
|
3617
|
+
` $clientOk = $true`,
|
|
3618
|
+
` if (Test-Path $clientJs) {`,
|
|
3619
|
+
` $cli = Get-Content $clientJs -Raw`,
|
|
3620
|
+
` $clientOk = $cli.Contains('id: "' + $expectedName + '"')`,
|
|
3621
|
+
` }`,
|
|
3622
|
+
` if ($nameOk -and $clientOk) { Log ('自报名一致性 OK:' + $expectedName) } else { Log ('⚠️ 自报名一致性异常:部署目录=' + (Split-Path $selfDir -Leaf) + ',期望 ' + $expectedName + '(index=' + $nameOk + ' client=' + $clientOk + ')——请检查部署目录与包名是否匹配') }`,
|
|
3623
|
+
`}`,
|
|
3624
|
+
`Verify-SelfNameConsistency '${selfName ?? '@noob-stupid/dsh-plugin-console'}'`,
|
|
3599
3625
|
pkgArgs.length > 0 ? `SetState 'pkg' '更新官方配套包…'\n Log '更新官方配套包…'\n Set-Location -Path ${ps(profileDir2)}\n if (Test-Path ${ps(corepackJs)}) {\n $pp = Start-Process -FilePath ${ps(nodePath)} -ArgumentList @(${ps(corepackJs)}, 'pnpm', 'update', ${pkgArgs.join(', ')}, '--no-optional', '--registry', 'https://registry.npmmirror.com') -PassThru -WindowStyle Hidden\n if (-not $pp.WaitForExit(300000)) { Stop-Process -Id $pp.Id -Force -ErrorAction SilentlyContinue; Log '官方配套包更新超时(5 分钟),已跳过' } else { try { Log ('官方配套包更新结束(exit=' + $pp.ExitCode + ')') } catch { Log '官方配套包更新结束(退出码读取失败)' } }\n }` : '',
|
|
3600
3626
|
"SetState 'relaunching' '升级完成,重启 DSH 服务生效…'",
|
|
3601
3627
|
"Log '重启 DSH 服务生效…'",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noob-stupid/dsh-plugin-console",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "DSH plugin management panel \u0026 marketplace: one-click enable/disable, multi-source market (GitHub/Gitee/custom), static-index market (500+ plugins / 300 skills), skills, suites, and one-click framework upgrade.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|