dsh-plugin 1.3.10 → 1.4.0

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.
@@ -23,7 +23,7 @@
23
23
  /* 弹窗基座:安装/卸载确认、错误、失败记录共用;错误类弹窗(.errorModal)单独加宽 */
24
24
  .modal,
25
25
  .errorModal {
26
- width: 420px;
26
+ width: 540px;
27
27
  max-width: calc(100vw - 32px);
28
28
  /* 高度自适应屏幕(桌面/手机视口):内容超长时窗体内滚动,头部与按钮不消失 */
29
29
  max-height: calc(100dvh - 64px);
@@ -41,21 +41,21 @@
41
41
 
42
42
  /* 错误/失败记录弹窗:宽一些,错误详情长行少折行、阅读更顺;两边留白也更稳 */
43
43
  .errorModal {
44
- width: 640px;
44
+ width: 720px;
45
45
  max-width: calc(100vw - 48px);
46
46
  }
47
47
 
48
48
  /* 日志存放位置弹窗:加宽 —— 路径随用户主目录/用户名变化(长短不一),
49
49
  输入框内要完整显示长路径,窄了显示不下 */
50
50
  .modalWide {
51
- width: 560px;
51
+ width: 640px;
52
52
  max-width: calc(100vw - 48px);
53
53
  }
54
54
 
55
55
  /* 自定义安装「帮助」弹窗:比错误弹窗更宽 —— 命令格式 + 中文说明要排在一行,
56
56
  窄了容易折行,宽窗让每条格式整行展示 */
57
57
  .helpModal {
58
- width: 720px;
58
+ width: 760px;
59
59
  max-width: calc(100vw - 48px);
60
60
  }
61
61
 
@@ -63,7 +63,7 @@
63
63
  加上筛选栏与底部操作栏后需要横向空间,窄了长行容易折行。
64
64
  高度固定(540px,小视口才让位给窗口上限):内容多寡不再让弹窗忽高忽低 */
65
65
  .logModal {
66
- width: 780px;
66
+ width: 820px;
67
67
  height: min(540px, calc(100vh - 64px));
68
68
  max-width: calc(100vw - 48px);
69
69
  }
@@ -1285,7 +1285,7 @@
1285
1285
  /* 关注弹窗:比普通弹窗略宽,给 Markdown 介绍 + 反馈群二维码留出阅读空间;
1286
1286
  max-width 覆盖普通弹窗的 calc(100vw - 32px),窄屏时仍不贴边 */
1287
1287
  .aboutModal {
1288
- width: 460px;
1288
+ width: 560px;
1289
1289
  max-width: calc(100vw - 48px);
1290
1290
  }
1291
1291
 
@@ -1418,7 +1418,7 @@
1418
1418
 
1419
1419
  /* 更新说明弹窗:比普通弹窗略宽,给变更记录留出阅读空间 */
1420
1420
  .hubUpdateModal {
1421
- width: 520px;
1421
+ width: 620px;
1422
1422
  max-width: calc(100vw - 48px);
1423
1423
  }
1424
1424
 
@@ -1536,7 +1536,7 @@
1536
1536
 
1537
1537
  /* 详情弹窗:比普通弹窗略宽,给信息网格/路径留出横向空间 */
1538
1538
  .detailModal {
1539
- width: 480px;
1539
+ width: 580px;
1540
1540
  max-width: calc(100vw - 48px);
1541
1541
  }
1542
1542
 
@@ -22,6 +22,9 @@ export interface LocaleService {
22
22
  bind(namespace: string): (key: string, params?: Record<string, string | number>) => string
23
23
  getSnapshot(): { active: LocaleId }
24
24
  subscribe(fn: () => void): () => void
25
+ /** 切换宿主(系统)语言偏好:Hub 语言跟随宿主,右上角语言按钮直接写入宿主偏好,
26
+ * 宿主左侧菜单/设置弹窗与 Hub 面板一起切换,不再与宿主语言脱节 */
27
+ setLocale(id: string): void
25
28
  }
26
29
 
27
30
  /** The subset of the slots service this plugin touches. */
@@ -74,13 +77,11 @@ export interface TaskState {
74
77
  lines: string[]
75
78
  }
76
79
 
77
- export type ToastKind = 'copied' | 'errCopied' | 'done' | 'fail' | 'removed' | 'removeFail' | 'revealFail' | 'updates'
80
+ export type ToastKind = 'copied' | 'errCopied' | 'done' | 'fail' | 'removed' | 'removeFail' | 'revealFail'
78
81
 
79
82
  export interface ToastState {
80
83
  id: number
81
84
  kind: ToastKind
82
- /** 「发现更新」类提示的插件数量(按 kind 语义使用) */
83
- n?: number
84
85
  }
85
86
 
86
87
  /** 宿主机器环境快照(后端 /dsh-plugin-hub/env):提交 bug 时拼进 issue 正文,便于作者复现。 */
@@ -93,7 +93,7 @@ const PROFILE_RE = /^[A-Za-z0-9_-]+$/
93
93
  const BODY_LIMIT_BYTES = 4 * 1024
94
94
  const COMMAND_TIMEOUT_MS = 5 * 60 * 1000
95
95
 
96
- /** 目录/统计数据代理的本地缓存时长:1 小时内重复打开插件中心直接读盘,
96
+ /** 目录/统计数据代理的本地缓存时长:1 小时内重复打开插件市场直接读盘,
97
97
  * 不重复走 curl 拉远程 —— 重启宿主后首次打开同样秒开(缓存跨重启存活)。 */
98
98
  const CATALOG_CACHE_TTL_MS = 60 * 60 * 1000
99
99
 
@@ -149,8 +149,12 @@ export function readInstalled(profile: string): Record<string, string> {
149
149
  }
150
150
  }
151
151
 
152
- /** 宿主 dsh CLI 版本:从入口(process.argv[1])向上找最近的 dsh/harness 相关 package.json;找不到返回 null。 */
152
+ /** 宿主 dsh CLI 版本:优先直接跑 `dsh --version`(与 pnpm/npm/git 同款同步探测,1500ms 超时兜底,
153
+ * 绝不挂起)—— 原先从 process.argv[1] 向上找 package.json 猜版本在部分宿主加载方式下取不到,
154
+ * 导致 issue 环境快照 DSH: unknown;拿不到再退回入口 package.json 查找(dsh 不在 PATH 时兜底)。 */
153
155
  function hostDshVersion(): string | null {
156
+ const viaCli = toolVersion('dsh', ['--version'])
157
+ if (viaCli) return viaCli
154
158
  const entry = process.argv[1]
155
159
  if (entry === undefined) return null
156
160
  let dir = dirname(resolve(entry))
@@ -515,8 +519,8 @@ export function mountPluginHubRoutes(webServer: WebServerService, profile: strin
515
519
  { key: 'npm', url: `${registry}/dsh-plugin`, display: settings.npmRegistry !== '' ? registry : '', cmd: `npm view dsh-plugin version --registry ${registry}` },
516
520
  // GitHub 行用真实 git 克隆握手(git ls-remote)打 dshplugin/hello-dsh 小仓库:
517
521
  // 「网页能打开」和「git 能克隆」是两码事,握手成功才算通道通;小仓库秒级完成,不打 17MB 的 dsh-plugin-hub。
518
- { key: 'github', url: 'https://github.com/dshplugin/hello-dsh', display: 'github.com/dshplugin/hello-dsh', cmd: 'git ls-remote https://github.com/dshplugin/hello-dsh', git: true },
519
- { key: 'catalog', url: 'https://api.dsh-plugin.org/stats.json', display: 'api.dsh-plugin.org', cmd: 'curl -s https://api.dsh-plugin.org/stats.json' },
522
+ { key: 'github', url: 'https://github.com/dshplugin/hello-dsh', display: 'github.com', cmd: 'git ls-remote https://github.com/dshplugin/hello-dsh', git: true },
523
+ { key: 'catalog', url: 'https://api.dsh-plugin.org/stats.json', display: '', cmd: 'curl -s https://api.dsh-plugin.org/stats.json' },
520
524
  ]
521
525
  // 配置了 HTTP 代理:追加一行代理诊断 —— 用该代理打 github.com(安装通道真实访问的地址),
522
526
  // 验证「代理能不能把请求带出去」。与安装同口径:curl 子进程注入该代理 env。
@@ -613,7 +617,7 @@ export function mountPluginHubRoutes(webServer: WebServerService, profile: strin
613
617
  const target = isStats
614
618
  ? 'https://api.dsh-plugin.org/stats.json'
615
619
  : `https://api.dsh-plugin.org/plugins.${lang}.json`
616
- // 1 小时本地缓存:命中直接返回(跨重启生效,插件中心秒开),未命中才走 curl 拉远程
620
+ // 1 小时本地缓存:命中直接返回(跨重启生效,插件市场秒开),未命中才走 curl 拉远程
617
621
  const cacheFile = catalogCacheFile(profile, isStats ? 'stats' : `plugins-${lang}`)
618
622
  const cached = readCatalogCache(cacheFile)
619
623
  if (cached !== null) {