dsh-quick-restart 0.1.1 → 0.1.3
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 +9 -13
- package/lib/index.js +18 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -16,26 +16,22 @@ DSH 的第三方插件改了代码之后,默认要**完全退出再打开**才
|
|
|
16
16
|
|
|
17
17
|
## 安装
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**方式一:DSH 插件市场**(推荐)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
https://github.com/a994903574/dsh-quick-restart/releases/download/v0.1.1/dsh-quick-restart-0.1.1.tgz
|
|
23
|
-
```
|
|
21
|
+
设置 → 插件 → 搜索 `dsh-quick-restart` → 安装 → **完全退出 DSH 再打开**(按钮要宿主启动时注入,刷新页面没用)。
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
**方式二:命令行 / 直链**
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
```bash
|
|
26
|
+
npm i dsh-quick-restart
|
|
27
|
+
```
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
或把下面这个地址填进 DSH 的插件安装入口:
|
|
32
30
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
pnpm add dsh-quick-restart
|
|
31
|
+
```
|
|
32
|
+
https://registry.npmjs.org/dsh-quick-restart/-/dsh-quick-restart-0.1.2.tgz
|
|
36
33
|
```
|
|
37
34
|
|
|
38
|
-
并在 profile 的 `package.json` 里把它加进 `dsh.profile.bundles`。
|
|
39
35
|
|
|
40
36
|
## 用起来什么效果
|
|
41
37
|
|
package/lib/index.js
CHANGED
|
@@ -11,6 +11,24 @@ import { existsSync, readFileSync } from 'node:fs'
|
|
|
11
11
|
|
|
12
12
|
export const name = 'dsh-quick-restart'
|
|
13
13
|
|
|
14
|
+
// 把 dsh-hot-restart 当作内置引擎:它是本包的依赖,直接 import 后调用它的 apply。
|
|
15
|
+
// 这样用户只装 dsh-quick-restart 一个包,「重启」就能用;
|
|
16
|
+
// 如果用户另外也装了 dsh-hot-restart,路由可能重复注册,这里忽略冲突即可。
|
|
17
|
+
async function embedHotRestart(ctx, log) {
|
|
18
|
+
try {
|
|
19
|
+
const mod = await import('dsh-hot-restart')
|
|
20
|
+
const plugin = (mod && mod.default) || mod
|
|
21
|
+
const apply = plugin && (plugin.apply || (plugin.default && plugin.default.apply))
|
|
22
|
+
if (typeof apply !== 'function') { log('内置重启引擎没有 apply,跳过'); return false }
|
|
23
|
+
await apply(ctx)
|
|
24
|
+
log('内置重启引擎(dsh-hot-restart)已启动')
|
|
25
|
+
return true
|
|
26
|
+
} catch (e) {
|
|
27
|
+
log('内置重启引擎加载失败(重启按钮会不可用): ' + String((e && e.message) || e))
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
15
33
|
const SELF = 'dsh-quick-restart'
|
|
16
34
|
const CLIENT_ROUTE = '/dsh-quick-restart/client.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-quick-restart",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DeepSeek Harness 插件:标题栏加两个按钮——重载第三方插件(不用重启宿主)、重启 DSH。",
|
|
6
6
|
"keywords": [
|
|
@@ -40,5 +40,8 @@
|
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/a994903574/dsh-quick-restart/issues"
|
|
42
42
|
},
|
|
43
|
-
"author": "a994903574"
|
|
43
|
+
"author": "a994903574",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"dsh-hot-restart": "^0.3.16"
|
|
46
|
+
}
|
|
44
47
|
}
|