@xinhailaopo/dsh-dl-router-go 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # dsh-download-router-go
1
+ # dsh-dl-router-go
2
2
 
3
3
  DSH 的下载插件。下载之前先实测「哪条路最快」,然后**切成多段并发去拿**——不是猜,也不是一条连接硬等。
4
4
 
@@ -112,11 +112,11 @@ kind="github" target="owner/repo@v1.0.0/file.zip"
112
112
 
113
113
  ## 安装
114
114
 
115
- 在插件市场里装:**设置 → 插件 → 插件市场 → 搜索 `dsh-download-router-go` → 安装**。
115
+ 在插件市场里装:**设置 → 插件 → 插件市场 → 搜索 `dsh-dl-router-go` → 安装**。
116
116
 
117
117
  这是唯一的正规入口——它走 `installGeneration`,会写进 profile 的 `.generations/desired.json`。
118
118
 
119
- > ⚠ 别用 `dsh plugin --profile <name> add dsh-download-router-go@x.y.z` 升级。那条路会把 generation 实体一起清空,下次启动直接进安全模式。升级只走插件市场的按钮。
119
+ > ⚠ 别用 `dsh plugin --profile <name> add dsh-dl-router-go@x.y.z` 升级。那条路会把 generation 实体一起清空,下次启动直接进安全模式。升级只走插件市场的按钮。
120
120
 
121
121
  ## 已知边界
122
122
 
package/RELEASE.md CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  ## 顺序
6
6
 
7
- 1. **推 npm**(可选,但推荐)。发了 npm,市场能显示下载量,用户装的时候也跳过 `allowBuilds` 构建授权。包名 `dsh-download-router-go` 在 npmjs 上目前是空的。
7
+ 1. **推 npm**(可选,但推荐)。发了 npm,市场能显示下载量,用户装的时候也跳过 `allowBuilds` 构建授权。包名 `dsh-dl-router-go` 在 npmjs 上目前是空的。
8
8
  - `package.json` 里的 `repository` 已指向 GitHub 仓库,这一条是硬要求:没指回来,npm 包和列表条目不会关联。
9
- 2. **建 GitHub 仓库并推代码**。仓库名 `dsh-download-router-go`。
9
+ 2. **建 GitHub 仓库并推代码**。仓库名 `dsh-dl-router-go`。
10
10
  3. **给仓库加 `dsh-plugin` topic**。
11
11
  4. **满 1 天**(CI 自动检查,这是硬门槛,不给过)。刚建的仓库当天提交会红叉。
12
12
  5. **提 PR** 到 `awesome-dsh-plugin/awesome-dsh-plugin`,加**一个**文件:
13
- `data/plugins/xinhailaopo__dsh-download-router-go.yml`
13
+ `data/plugins/xinhailaopo__dsh-dl-router-go.yml`
14
14
 
15
15
  ```yaml
16
- url: https://github.com/xinhailaopo/dsh-download-router-go
17
- name: xinhailaopo/dsh-download-router-go
16
+ url: https://github.com/xinhailaopo/dsh-dl-router-go
17
+ name: xinhailaopo/dsh-dl-router-go
18
18
  category: tools
19
19
  description:
20
20
  en: Probes GitHub, npm, PyPI and Hugging Face mirrors plus your local proxy port before a download, then fetches with segmented concurrency, resume and checksum verification.
@@ -35,10 +35,10 @@
35
35
  - 仓库年龄 ≥ 1 天 → 新仓库当天必挂。
36
36
  - peerDependencies 里 `@deepseek-ai/*` 必须带显式预发布分支。写成 `>=0.1.0-rc.7` 会静默排除所有 `0.2.x-rc`,用户装的时候撞 ERESOLVE。现在是:
37
37
  `">=0.1.0-rc.7 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0"`
38
- - 新包名 `npm publish` 返回成功不等于能装。要等 `registry.npmjs.org/dsh-download-router-go` 的 `dist-tags.latest` 等于你的版本、**且** `dist.tarball` 能下载,再去提 PR。
38
+ - 新包名 `npm publish` 返回成功不等于能装。要等 `registry.npmjs.org/dsh-dl-router-go` 的 `dist-tags.latest` 等于你的版本、**且** `dist.tarball` 能下载,再去提 PR。
39
39
  - 国内走的是 npmmirror,它可能长时间停在 `0.0.0-stage` 占位版。要让它重抓:
40
- `curl -X PUT https://registry.npmmirror.com/dsh-download-router-go/sync`
41
- 然后用干净 profile 真装一遍验证:`dsh plugin --profile <name> add dsh-download-router-go`
40
+ `curl -X PUT https://registry.npmmirror.com/dsh-dl-router-go/sync`
41
+ 然后用干净 profile 真装一遍验证:`dsh plugin --profile <name> add dsh-dl-router-go`
42
42
 
43
43
  ## 安装侧注意
44
44
 
package/client/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * dsh-download-router-go — 浏览器半边(DSH web client)。
2
+ * dsh-dl-router-go — 浏览器半边(DSH web client)。
3
3
  *
4
4
  * ## 这个文件里有什么
5
5
  *
@@ -11,7 +11,7 @@
11
11
  * 我们是**静态 client 半边**(`window.__ModuleLoader__.load({factory(require)})`)。
12
12
  * `host.call` 只存在于 `cordis_run` 生成的**动态半边**;静态半边能用的只有
13
13
  * `fetch`。所以所有数据都走 Host 侧 `src/routes.js` 注册的
14
- * `/dsh-download-router-go/api/v1/*`。
14
+ * `/dsh-dl-router-go/api/v1/*`。
15
15
  *
16
16
  * ## 必须守的约定(dsh-client-modules)
17
17
  *
@@ -21,14 +21,14 @@
21
21
  * - 卸载时把所有副作用(样式、定时器、订阅)收干净。
22
22
  */
23
23
  window.__ModuleLoader__.load({
24
- id: 'dsh-download-router-go',
24
+ id: 'dsh-dl-router-go',
25
25
  factory(require) {
26
26
  const React = require('react');
27
27
  const h = React.createElement;
28
28
 
29
29
  const LOCALE_NS = 'downloadRouter';
30
30
  /** Host 侧路由前缀(与 src/routes.js 的 PREFIX 一致)。 */
31
- const API = '/dsh-download-router-go/api/v1';
31
+ const API = '/dsh-dl-router-go/api/v1';
32
32
 
33
33
  /* ------------------------------------------------------------ 文案 */
34
34
 
@@ -1217,16 +1217,16 @@ window.__ModuleLoader__.load({
1217
1217
 
1218
1218
  apply(ctx) {
1219
1219
  // 1. 文案:注册成宿主 locale 的一个命名空间,随语言切换
1220
- ctx.effect(() => ctx.locale.register(LOCALE_NS, { zh, en }), 'dsh-download-router-go: dictionaries');
1220
+ ctx.effect(() => ctx.locale.register(LOCALE_NS, { zh, en }), 'dsh-dl-router-go: dictionaries');
1221
1221
 
1222
1222
  // 2. 样式:插一个带 data-plugin 标记的 <style>,卸载时移除
1223
1223
  ctx.effect(() => {
1224
1224
  const style = document.createElement('style');
1225
- style.setAttribute('data-plugin', 'dsh-download-router-go');
1225
+ style.setAttribute('data-plugin', 'dsh-dl-router-go');
1226
1226
  style.textContent = CSS;
1227
1227
  document.head.appendChild(style);
1228
1228
  return () => style.remove();
1229
- }, 'dsh-download-router-go: styles');
1229
+ }, 'dsh-dl-router-go: styles');
1230
1230
 
1231
1231
  // 3. 设置页「下载与网络」
1232
1232
  ctx.slots.inject('settings.section', () => ctx.slots.register(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xinhailaopo/dsh-dl-router-go",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "DSH plugin: 下载选路与切片加速 —— 下载前先并发实测各渠道(GitHub 官方 / 国内镜像 / 中转 / 本机代理口)真实速度,给出排名与分段方案;顺带把 npm/pip/git 的镜像源与超时一次性给对。",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -40,7 +40,7 @@
40
40
  "node": ">=20"
41
41
  },
42
42
  "peerDependencies": {
43
- "@deepseek-ai/dsh-tools": ">=0.1.0-rc.7 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0"
43
+ "@deepseek-ai/dsh-tools": ">=0.1.0-rc.1 <0.1.0 || >=0.1.5-rc.1 <0.2.0-0 || >=0.2.0-rc.1 <0.2.1-0 || >=0.2.1-rc.1 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0 || >=0.2.3-rc.1 <0.3.0-0 || >=0.3.0-rc.1 <0.4.0-0"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@deepseek-ai/dsh-tools": {
@@ -50,9 +50,9 @@
50
50
  "license": "MIT",
51
51
  "repository": {
52
52
  "type": "git",
53
- "url": "git+https://github.com/xinhailaopo/dsh-download-router-go.git"
53
+ "url": "git+https://github.com/xinhailaopo/dsh-dl-router-go.git"
54
54
  },
55
- "homepage": "https://github.com/xinhailaopo/dsh-download-router-go#readme",
55
+ "homepage": "https://github.com/xinhailaopo/dsh-dl-router-go#readme",
56
56
  "dsh": {
57
57
  "bundle": {
58
58
  "patch": "./cordis.patch.yml"
package/src/config.js CHANGED
@@ -283,7 +283,7 @@ export function setSettings(settings) {
283
283
  * 从 Cordis 传来的 config 归一化并设为生效值,同时叠加设置页写过的用户覆盖。
284
284
  *
285
285
  * 为什么还要叠文件:真宿主上 `configEditor.edit()` 对"由 patch 插入的条目"会抛
286
- * `Configuration for "dsh-download-router-go" is overridden by a home patch or
286
+ * `Configuration for "dsh-dl-router-go" is overridden by a home patch or
287
287
  * command-line overlay`(实测),设置页的保存就永远失败。文件这条路没有这层限制,
288
288
  * 也不再要求宿主版本有 configEditor。
289
289
  */
@@ -443,7 +443,7 @@ export function bindConfigEditor(ctx) {
443
443
  editorCtx = cctx;
444
444
  });
445
445
  } catch (error) {
446
- try { ctx?.logger?.warn?.(`[dsh-download-router-go] configEditor 未接入:${describeError(error)}`); } catch {}
446
+ try { ctx?.logger?.warn?.(`[dsh-dl-router-go] configEditor 未接入:${describeError(error)}`); } catch {}
447
447
  }
448
448
  return () => { editorRef = null; editorCtx = null; ownEntry = null; };
449
449
  }
package/src/guard.js CHANGED
@@ -127,7 +127,7 @@ const HINT = [
127
127
  '',
128
128
  '',
129
129
  '---',
130
- '[dsh-download-router-go] 这条命令会长时间干等下载。',
130
+ '[dsh-dl-router-go] 这条命令会长时间干等下载。',
131
131
  '建议:先 `dl_probe` 拿当前最优渠道与分段方案(2–4 秒),再 `dl_get` 下载',
132
132
  '(它 15 秒内没下完就返回 jobId,之后用 `dl_job` 看进度,不占工具超时)。',
133
133
  '如果坚持用 curl/git,至少加 `--connect-timeout 5 --max-time 180`,并准备好换镜像。',
@@ -151,7 +151,7 @@ export function installGuard(ctx, options = {}) {
151
151
  if (verdict?.isWaitingGame) {
152
152
  return {
153
153
  kind: 'deny',
154
- reason: `[dsh-download-router-go] 拒绝长时间干等下载(${verdict.label})。改用 dl_probe 选路 + dl_get 下载,或至少加 --connect-timeout 5 --max-time 180。`,
154
+ reason: `[dsh-dl-router-go] 拒绝长时间干等下载(${verdict.label})。改用 dl_probe 选路 + dl_get 下载,或至少加 --connect-timeout 5 --max-time 180。`,
155
155
  };
156
156
  }
157
157
  return next();
@@ -192,7 +192,7 @@ export function installGuard(ctx, options = {}) {
192
192
  function withNote(content, text) {
193
193
  if (Array.isArray(content)) {
194
194
  // 已经加过就别重复加(多轮 waterfall 可能被调两次)
195
- if (content.some((block) => block?.type === 'text' && String(block.text ?? '').includes('[dsh-download-router-go]'))) return null;
195
+ if (content.some((block) => block?.type === 'text' && String(block.text ?? '').includes('[dsh-dl-router-go]'))) return null;
196
196
  return [...content, { type: 'text', text }];
197
197
  }
198
198
  if (typeof content === 'string') return `${content}${text}`;
package/src/index.js CHANGED
@@ -23,7 +23,7 @@ import { applyConfig, bindConfigEditor } from './config.js';
23
23
  import { registerRoutes } from './routes.js';
24
24
  import { describeError, wireServices } from './shared.js';
25
25
 
26
- export const name = 'dsh-download-router-go';
26
+ export const name = 'dsh-dl-router-go';
27
27
 
28
28
  // 只有 tools 是硬依赖:没有它这个插件没有任何意义。
29
29
  export const inject = ['tools'];
@@ -45,7 +45,7 @@ export async function apply(ctx, config = {}) {
45
45
  const disposeWired = wireServices(ctx);
46
46
  if (typeof disposeWired === 'function') disposers.push(disposeWired);
47
47
  } catch (error) {
48
- ctx.logger?.warn?.(`[dsh-download-router-go] 服务接线失败:${describeError(error)}`);
48
+ ctx.logger?.warn?.(`[dsh-dl-router-go] 服务接线失败:${describeError(error)}`);
49
49
  }
50
50
 
51
51
  // 配置先落地:后面所有模块(channels / transport / get)都要问它要"此刻生效的源"。
@@ -58,7 +58,7 @@ export async function apply(ctx, config = {}) {
58
58
  const disposeEditor = bindConfigEditor(ctx);
59
59
  if (typeof disposeEditor === 'function') disposers.push(disposeEditor);
60
60
  } catch (error) {
61
- ctx.logger?.error?.(`[dsh-download-router-go] 配置解析失败,退回默认值:${describeError(error)}`);
61
+ ctx.logger?.error?.(`[dsh-dl-router-go] 配置解析失败,退回默认值:${describeError(error)}`);
62
62
  }
63
63
 
64
64
  const registerAll = async () => {
@@ -85,17 +85,17 @@ export async function apply(ctx, config = {}) {
85
85
  if (typeof disposeRoutes === 'function') disposers.push(disposeRoutes);
86
86
  } catch (error) {
87
87
  // 路由注册失败不影响工具:浮窗不可用,但下载照常
88
- ctx.logger?.warn?.(`[dsh-download-router-go] 路由注册失败:${describeError(error)}`);
88
+ ctx.logger?.warn?.(`[dsh-dl-router-go] 路由注册失败:${describeError(error)}`);
89
89
  }
90
90
 
91
- ctx.logger?.info?.(`[dsh-download-router-go] 已注册 ${definitions.length} 个工具,拦截器模式=${guardMode}`);
91
+ ctx.logger?.info?.(`[dsh-dl-router-go] 已注册 ${definitions.length} 个工具,拦截器模式=${guardMode}`);
92
92
  };
93
93
 
94
94
  try {
95
95
  await withTimeout(registerAll(), 15_000, '注册工具');
96
96
  } catch (error) {
97
97
  // 记日志但**不抛** —— 插件起不来不该带走整个应用
98
- ctx.logger?.error?.(`[dsh-download-router-go] 注册失败:${describeError(error)}`);
98
+ ctx.logger?.error?.(`[dsh-dl-router-go] 注册失败:${describeError(error)}`);
99
99
  }
100
100
 
101
101
  return () => {
package/src/routes.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  } from './shared.js';
34
34
 
35
35
  // 带插件名前缀,避免与别的插件的 /api/v1 撞车
36
- const PREFIX = '/dsh-download-router-go/api/v1';
36
+ const PREFIX = '/dsh-dl-router-go/api/v1';
37
37
  const MAX_BODY = 64 * 1024;
38
38
 
39
39
  /* ------------------------------------------------------------------ 基础 */
@@ -317,13 +317,13 @@ export function registerRoutes(ctx) {
317
317
  ctx?.inject?.(['webServer'], (hostCtx) => {
318
318
  const server = hostCtx?.webServer;
319
319
  if (!server || typeof server.register !== 'function') {
320
- ctx?.logger?.warn?.('[dsh-download-router-go] 拿到 webServer 但它没有 register()');
320
+ ctx?.logger?.warn?.('[dsh-dl-router-go] 拿到 webServer 但它没有 register()');
321
321
  return;
322
322
  }
323
323
  mountAll(server);
324
324
  });
325
325
  } catch (error) {
326
- ctx?.logger?.warn?.(`[dsh-download-router-go] 接不上 webServer,设置页与浮窗不可用:${describeError(error)}`);
326
+ ctx?.logger?.warn?.(`[dsh-dl-router-go] 接不上 webServer,设置页与浮窗不可用:${describeError(error)}`);
327
327
  }
328
328
  };
329
329
 
@@ -661,7 +661,7 @@ export function registerRoutes(ctx) {
661
661
  }
662
662
  });
663
663
 
664
- ctx?.logger?.info?.(`[dsh-download-router-go] 已挂载 ${disposers.length} 条数据路由(${PREFIX})`);
664
+ ctx?.logger?.info?.(`[dsh-dl-router-go] 已挂载 ${disposers.length} 条数据路由(${PREFIX})`);
665
665
  }; // ← mountAll 结束
666
666
 
667
667
  wire();
package/src/shared.js CHANGED
@@ -79,7 +79,7 @@ export function dshHome() {
79
79
 
80
80
  /** 我们自己的状态目录(健康库、doctor 缓存)。 */
81
81
  export function stateDir() {
82
- return join(dshHome(), 'storages', 'download-router-go');
82
+ return join(dshHome(), 'storages', 'dl-router-go');
83
83
  }
84
84
 
85
85
  /**
@@ -17,7 +17,7 @@ import { bytes } from '../shared.js';
17
17
  export const spec = {
18
18
  name: 'dl_config',
19
19
  description: [
20
- '读写 dsh-download-router-go 的设置:代理(中转地址)、镜像源(npm / PyPI / GitHub / HF)、下载行为。',
20
+ '读写 dsh-dl-router-go 的设置:代理(中转地址)、镜像源(npm / PyPI / GitHub / HF)、下载行为。',
21
21
  '',
22
22
  'action="get":看当前生效的设置(含每块的 source: default/user)',
23
23
  'action="set":写一块配置并立刻生效。patch 形如 {"proxy":{"mode":"manual","endpoint":"127.0.0.1:7897"}}',