dsh-plugin-refresh 1.0.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.
- package/README.md +16 -0
- package/cordis.patch.yml +10 -0
- package/lib/index.js +44 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# dsh-plugin-refresh
|
|
2
|
+
|
|
3
|
+
DSH 侧边栏 / 聊天区**空白处右键刷新**(整页重载)。用于解决 DSH 重启后界面白屏/卡死时的快速恢复。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
```powershell
|
|
7
|
+
dsh plugin --profile web add link:D:\\work space\\dsh-plugins\\dsh-plugin-refresh
|
|
8
|
+
# 重启 DSH web 进程后生效
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 卸载
|
|
12
|
+
```powershell
|
|
13
|
+
dsh plugin --profile web remove dsh-plugin-refresh
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
> 注:客户端通过 DOM 查找侧边栏/聊天区容器,具体选择器可能需要按 DSH 实际 DOM 微调。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dsh-plugin-refresh —— DSH bundle patch
|
|
2
|
+
# 挂载声明:DSH 启动时按 bundle 层栈叠加各插件 patch。
|
|
3
|
+
#
|
|
4
|
+
# 安装:
|
|
5
|
+
# dsh plugin --profile web add link:<本目录绝对路径>
|
|
6
|
+
# 卸载:
|
|
7
|
+
# dsh plugin --profile web remove dsh-plugin-refresh
|
|
8
|
+
- insert:
|
|
9
|
+
- id: dsh-plugin-refresh
|
|
10
|
+
name: dsh-plugin-refresh
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
5
|
+
|
|
6
|
+
// 客户端脚本:在侧边栏 / 聊天区空白处右键 → 整页重载(等效退出重开,修复白屏)。
|
|
7
|
+
const CLIENT_JS = `(function () {
|
|
8
|
+
if (window.__dshRefresh) return
|
|
9
|
+
window.__dshRefresh = true
|
|
10
|
+
|
|
11
|
+
// 右键直接刷新:除表单控件/链接/菜单项/会话行/鲸鱼挂件外,其余右键一律整页重载。
|
|
12
|
+
function isInteractive(el) {
|
|
13
|
+
if (!el || el.nodeType !== 1) return false
|
|
14
|
+
return !!el.closest('a, button, input, textarea, select, [contenteditable], [role="menuitem"], [role="menuitemcheckbox"], [role="button"], [role="tab"], [role="option"], [role="treeitem"], .dshwv-root, [class*="menu"]')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
document.addEventListener('contextmenu', function (e) {
|
|
18
|
+
if (isInteractive(e.target)) return
|
|
19
|
+
e.preventDefault()
|
|
20
|
+
window.location.reload()
|
|
21
|
+
}, { capture: true })
|
|
22
|
+
})()`
|
|
23
|
+
|
|
24
|
+
const name = 'dsh-plugin-refresh'
|
|
25
|
+
const inject = ['webServer']
|
|
26
|
+
|
|
27
|
+
function apply(ctx) {
|
|
28
|
+
ctx.webServer.register({
|
|
29
|
+
kind: 'exact',
|
|
30
|
+
path: '/dsh-plugin-refresh/widget.js',
|
|
31
|
+
handler: (req, res) => {
|
|
32
|
+
res.writeHead(200, { 'Content-Type': 'application/javascript; charset=utf-8', 'Cache-Control': 'no-store' })
|
|
33
|
+
res.end(CLIENT_JS)
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
ctx.webServer.tapIndex((html) => {
|
|
37
|
+
if (html.indexOf('/dsh-plugin-refresh/widget.js') !== -1) return html
|
|
38
|
+
const tag = '<script defer src="/dsh-plugin-refresh/widget.js"></script>'
|
|
39
|
+
if (html.indexOf('</body>') !== -1) return html.replace('</body>', tag + '</body>')
|
|
40
|
+
return html + tag
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { name, inject, apply }
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-plugin-refresh",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "DSH 侧边栏/聊天区空白处右键刷新(整页重载)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"refresh"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"lib",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"dsh": {
|
|
19
|
+
"bundle": {
|
|
20
|
+
"patch": "./cordis.patch.yml"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/mengyu-arch/dsh-plugins.git"
|
|
30
|
+
}
|
|
31
|
+
}
|