dsh-remote-plugin 0.8.3 → 0.8.5
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/apk/dsh-remote.apk +0 -0
- package/approval-summary.mjs +115 -0
- package/gateway.cjs +704 -16
- package/index.mjs +12 -0
- package/insights.mjs +1 -1
- package/package.json +2 -1
- package/plugin-center.mjs +88 -17
- package/plugin-transaction.mjs +19 -3
- package/public/admin.html +30 -28
- package/public/admin.js +1 -1
- package/public/announcements.json +31 -0
- package/public/app.js +58 -47
- package/public/approval-summary.js +78 -0
- package/public/build.json +2 -2
- package/public/cache-upgrade.js +51 -0
- package/public/chat-copy.js +34 -21
- package/public/desktop/desktop.css +18 -39
- package/public/desktop/desktop.html +70 -96
- package/public/desktop/desktop.js +15 -42
- package/public/e2ee-transport.js +195 -0
- package/public/extensions.js +6 -6
- package/public/history.js +48 -1
- package/public/index.html +75 -93
- package/public/md.js +36 -18
- package/public/motion.js +1 -1
- package/public/plugin-center.css +1 -0
- package/public/plugin-center.js +92 -11
- package/public/plugin.html +25 -24
- package/public/relay-autopair.js +217 -0
- package/public/relay-devices.js +74 -0
- package/public/relay-settings.css +13 -0
- package/public/relay-settings.js +11 -4
- package/public/session-deck.css +7 -1
- package/public/session-deck.js +1 -1
- package/public/skins/blue-fish/preview.html +3 -2
- package/public/skins/bocchi/preview.html +5 -4
- package/public/skins/kita/preview.html +6 -5
- package/public/skins/nijika/preview.html +6 -5
- package/public/skins/penguin/preview.html +3 -2
- package/public/skins/ryo/preview.html +6 -5
- package/public/sponsor-entry.js +20 -21
- package/public/styles.css +24 -24
- package/public/teams.js +2 -2
- package/public/update.json +12 -12
- package/public/version.json +1 -1
- package/public/workflow.js +3 -4
- package/skills/dsh-remote-doctor/references/wiki/plugins.md +1 -1
- package/task-board.mjs +2 -2
- package/teams.mjs +7 -2
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
|
+
<meta name="dsh-remote-build" content="7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
4
5
|
<meta charset="utf-8">
|
|
5
6
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
7
|
<title>DSH Remote · 桌面</title>
|
|
7
8
|
<script>/* 首帧前应用皮肤 */ (function(){try{var t=localStorage.getItem('dshTheme');if(t!=='default'&&t!=='dark'&&t!=='light'&&t!=='neutral'&&t!=='mono'&&t!=='fish'&&t!=='penguin'&&t!=='penguin-night'&&t!=='bocchi'&&t!=='nijika'&&t!=='ryo'&&t!=='kita'){t='fish'}}catch(e){t='fish'}document.documentElement.setAttribute('data-theme',t)})()</script>
|
|
8
|
-
<link rel="stylesheet" href="../theme-vars.css">
|
|
9
|
-
<link rel="stylesheet" href="desktop.css">
|
|
10
|
-
<link rel="stylesheet" href="../plugin-center.css">
|
|
11
|
-
<link rel="stylesheet" href="../skills.css">
|
|
12
|
-
<link rel="stylesheet" href="../doctor.css">
|
|
13
|
-
<link rel="stylesheet" href="../extensions.css">
|
|
14
|
-
<link rel="stylesheet" href="../insights.css">
|
|
15
|
-
<link rel="stylesheet" href="../workflow.css">
|
|
16
|
-
<link rel="stylesheet" href="../relay-settings.css">
|
|
17
|
-
<link rel="stylesheet" href="../subagents.css">
|
|
18
|
-
<link rel="stylesheet" href="../skins/blue-fish/skin.css">
|
|
19
|
-
<link rel="stylesheet" href="../skins/penguin/skin.css">
|
|
20
|
-
<link rel="stylesheet" href="../skins/bocchi/skin.css">
|
|
21
|
-
<link rel="stylesheet" href="../skins/kessoku/skin.css">
|
|
22
|
-
<link rel="stylesheet" href="../skins/nijika/skin.css">
|
|
23
|
-
<link rel="stylesheet" href="../skins/ryo/skin.css">
|
|
24
|
-
<link rel="stylesheet" href="../skins/kita/skin.css">
|
|
25
|
-
<link rel="stylesheet" href="../theme-picker.css">
|
|
9
|
+
<link rel="stylesheet" href="../theme-vars.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
10
|
+
<link rel="stylesheet" href="desktop.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
11
|
+
<link rel="stylesheet" href="../plugin-center.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
12
|
+
<link rel="stylesheet" href="../skills.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
13
|
+
<link rel="stylesheet" href="../doctor.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
14
|
+
<link rel="stylesheet" href="../extensions.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
15
|
+
<link rel="stylesheet" href="../insights.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
16
|
+
<link rel="stylesheet" href="../workflow.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
17
|
+
<link rel="stylesheet" href="../relay-settings.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
18
|
+
<link rel="stylesheet" href="../subagents.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
19
|
+
<link rel="stylesheet" href="../skins/blue-fish/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
20
|
+
<link rel="stylesheet" href="../skins/penguin/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
21
|
+
<link rel="stylesheet" href="../skins/bocchi/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
22
|
+
<link rel="stylesheet" href="../skins/kessoku/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
23
|
+
<link rel="stylesheet" href="../skins/nijika/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
24
|
+
<link rel="stylesheet" href="../skins/ryo/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
25
|
+
<link rel="stylesheet" href="../skins/kita/skin.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
26
|
+
<link rel="stylesheet" href="../theme-picker.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
26
27
|
</head>
|
|
27
28
|
<body>
|
|
28
29
|
<div class="ds-app" id="ds-app">
|
|
@@ -70,38 +71,7 @@
|
|
|
70
71
|
<button class="ds-nav-item" data-view="view-files"><span class="ds-nav-ico">⇅</span><span data-i18n="ds.files">文件传输</span></button>
|
|
71
72
|
<button class="ds-nav-item" data-view="view-plugins"><span class="ds-nav-ico" aria-hidden="true">▦</span><span data-i18n="ds.plugins">插件</span></button>
|
|
72
73
|
<button class="ds-nav-item" data-view="view-settings"><span class="ds-nav-ico"><svg class="settings-gear" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.09a2 2 0 0 1 1 1.73v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.73l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2Z"/><circle cx="12" cy="12" r="3"/></svg></span><span data-i18n="ds.settings">设置</span></button>
|
|
73
|
-
|
|
74
|
-
<button id="btn-feedback" class="ds-feedback-btn" aria-haspopup="menu" aria-expanded="false" data-i18n-title="ds.feedback" data-i18n-aria="ds.feedback">
|
|
75
|
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-8 8H5l-1.5 2L4 20a8 8 0 0 1-1-4 8 8 0 0 1 18-4Z"/></svg>
|
|
76
|
-
<span data-i18n="ds.feedback">反馈</span>
|
|
77
|
-
</button>
|
|
78
|
-
<div id="feedback-menu" class="ds-feedback-menu hidden" role="menu" data-i18n-aria="ds.feedbackTitle">
|
|
79
|
-
<button class="ds-feedback-item" id="btn-doctor" role="menuitem">
|
|
80
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0Z"/><path d="m9 12 2 2 4-5"/><path d="M12 2v2M2 12h2M20 12h2M12 20v2"/></svg></span>
|
|
81
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name" data-i18n="ds.feedbackDoctor">AI 排查问题</span><span class="ds-feedback-desc" data-i18n="ds.feedbackDoctorDesc">使用你的 DSH 和模型,只读诊断</span></span>
|
|
82
|
-
</button>
|
|
83
|
-
<button class="ds-feedback-item" id="btn-write-feedback" role="menuitem">
|
|
84
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg></span>
|
|
85
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name" data-i18n="ds.feedbackWrite">写反馈</span><span class="ds-feedback-desc" data-i18n="ds.feedbackWriteDesc">App 内直接提交</span></span>
|
|
86
|
-
</button>
|
|
87
|
-
<a class="ds-feedback-item" href="https://github.com/Blank-not-black/dsh-Remote/issues" target="_blank" rel="noopener" role="menuitem">
|
|
88
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8a8.01 8.01 0 0 0 5.47 7.59c.4.08.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg></span>
|
|
89
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name">GitHub Issues</span><span class="ds-feedback-desc" data-i18n="ds.feedbackGithubDesc">反馈 bug / 提建议</span></span>
|
|
90
|
-
</a>
|
|
91
|
-
<a class="ds-feedback-item" href="https://gitee.com/Blankneverfails/dsh-Remote/issues" target="_blank" rel="noopener" role="menuitem">
|
|
92
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="9" r="6"/><path d="M7.5 13.5 7 19a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l-.5-5.5"/><circle cx="10" cy="8.6" r=".5" fill="currentColor" stroke="none"/><circle cx="14" cy="8.6" r=".5" fill="currentColor" stroke="none"/><path d="M11 10.8c.6.5 1.4.5 2 0"/></svg></span>
|
|
93
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name">Gitee 反馈</span><span class="ds-feedback-desc" data-i18n="ds.feedbackGiteeDesc">国内镜像,无需代理</span></span>
|
|
94
|
-
</a>
|
|
95
|
-
<a class="ds-feedback-item" href="https://space.bilibili.com/419009275/dynamic" target="_blank" rel="noopener" role="menuitem">
|
|
96
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="6" width="17" height="11" rx="2"/><path d="M8.5 3.5v3M15.5 3.5v3"/><circle cx="9.2" cy="10.6" r=".5" fill="currentColor" stroke="none"/><circle cx="14.8" cy="10.6" r=".5" fill="currentColor" stroke="none"/><path d="M9.5 14c1.4 1 3.6 1 5 0"/></svg></span>
|
|
97
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name">B站交流</span><span class="ds-feedback-desc" data-i18n="ds.feedbackBiliDesc">UP 动态页交流</span></span>
|
|
98
|
-
</a>
|
|
99
|
-
<button class="ds-feedback-item" id="btn-copy-link" role="menuitem">
|
|
100
|
-
<span class="ds-feedback-ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="3" width="12" height="12" rx="2"/><path d="M16 8h3a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-3"/></svg></span>
|
|
101
|
-
<span class="ds-feedback-body"><span class="ds-feedback-name" data-i18n="ds.feedbackCopyLink">复制项目链接</span><span class="ds-feedback-desc" data-i18n="ds.feedbackCopyDesc">手动分享给朋友</span></span>
|
|
102
|
-
</button>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
74
|
+
|
|
105
75
|
</div>
|
|
106
76
|
</aside>
|
|
107
77
|
<button id="ds-sidebar-backdrop" class="ds-sidebar-backdrop hidden" type="button" data-i18n-aria="ds.close" aria-label="关闭菜单"></button>
|
|
@@ -211,11 +181,11 @@
|
|
|
211
181
|
<div style="position:relative">
|
|
212
182
|
<button id="btn-cmd" class="ds-btn" data-i18n="ds.commands">指令</button>
|
|
213
183
|
<div id="cmd-menu" class="ds-group-menu hidden" style="width:280px; left:0; right:auto; top:auto; bottom:calc(100% + 8px)">
|
|
214
|
-
<button class="ds-
|
|
215
|
-
<button class="ds-
|
|
216
|
-
<button class="ds-
|
|
217
|
-
<button class="ds-
|
|
218
|
-
<button class="ds-
|
|
184
|
+
<button class="ds-action-item" data-ds-cmd="/compact" data-i18n="ds.cmdCompact">/compact 压缩对话历史</button>
|
|
185
|
+
<button class="ds-action-item" data-ds-cmd="/export" data-i18n="ds.cmdExport">/export 导出会话日志 ZIP</button>
|
|
186
|
+
<button class="ds-action-item" data-ds-cmd="/feedback" data-i18n="ds.cmdFeedback">/feedback 反馈当前会话</button>
|
|
187
|
+
<button class="ds-action-item" data-ds-cmd="/goal" data-i18n="ds.cmdGoal">/goal 设置/查看任务目标</button>
|
|
188
|
+
<button class="ds-action-item" data-ds-cmd="/plan" data-i18n="ds.cmdPlan">/plan 进入/退出计划模式</button>
|
|
219
189
|
<div class="ds-cmd-section-title" data-i18n="perm.groupLabel">权限模式</div>
|
|
220
190
|
<div id="cmd-perm-inline" class="ds-cmd-perm-inline"></div>
|
|
221
191
|
</div>
|
|
@@ -407,7 +377,7 @@
|
|
|
407
377
|
<button id="btn-rename-session" class="ds-icon-btn hidden" data-i18n-title="ds.sessionRename" data-i18n-aria="ds.sessionRename" data-i18n="ds.sessionRename">✎</button>
|
|
408
378
|
<button id="btn-insights" class="ds-icon-btn hidden" data-i18n-title="ds.insights" data-i18n-aria="ds.insights" data-i18n="ds.insights">上下文与费用</button>
|
|
409
379
|
|
|
410
|
-
|
|
380
|
+
|
|
411
381
|
|
|
412
382
|
<button id="btn-stats-top" class="ds-icon-btn" data-i18n-aria="ds.stats" data-i18n-title="ds.stats" data-i18n="ds.stats">统计</button>
|
|
413
383
|
|
|
@@ -546,7 +516,7 @@
|
|
|
546
516
|
</div>
|
|
547
517
|
|
|
548
518
|
<!-- 赞赏支持模态 -->
|
|
549
|
-
|
|
519
|
+
|
|
550
520
|
<div id="modal-donate" class="ds-modal hidden" role="dialog" aria-modal="true">
|
|
551
521
|
<div class="ds-modal-card">
|
|
552
522
|
<div class="ds-modal-title" data-i18n="ds.donate">赞赏支持</div>
|
|
@@ -852,44 +822,48 @@
|
|
|
852
822
|
</div>
|
|
853
823
|
<div class="image-lightbox-hint" data-image-lightbox-hint>双击放大 · 点空白处关闭</div>
|
|
854
824
|
</div>
|
|
855
|
-
<script src="i18n.js"></script>
|
|
856
|
-
<link rel="stylesheet" href="../genui.css">
|
|
857
|
-
<script src="../genui.js"></script>
|
|
858
|
-
<script src="../chat-files.js"></script>
|
|
859
|
-
<script src="../md.js"></script>
|
|
860
|
-
<script src="../vendor/gsap/gsap.min.js"></script>
|
|
861
|
-
<script src="../motion.js"></script>
|
|
862
|
-
<script type="module" src="../morphicons-init.js"></script>
|
|
863
|
-
<script src="../plugin-center.js"></script>
|
|
864
|
-
<script src="../skills.js"></script>
|
|
865
|
-
<script src="../insights.js"></script>
|
|
866
|
-
<script src="../teams.js"></script>
|
|
867
|
-
<script src="../task-board.js"></script>
|
|
868
|
-
<script src="../extensions.js"></script>
|
|
869
|
-
<script src="../sha256.js"></script>
|
|
870
|
-
<script src="../diagnostics.js"></script>
|
|
871
|
-
<script src="../doctor.js"></script>
|
|
872
|
-
<script src="../history.js"></script>
|
|
873
|
-
<script src="../activity.js"></script>
|
|
874
|
-
<script src="../turn-results.js"></script>
|
|
875
|
-
<script src="../image-cache.js"></script>
|
|
876
|
-
<script src="../chat-copy.js"></script>
|
|
877
|
-
<script src="../image-preview.js"></script>
|
|
878
|
-
<script src="../link-check.js"></script>
|
|
879
|
-
<script src="../network.js"></script>
|
|
880
|
-
<script src="../operations.js"></script>
|
|
881
|
-
<script src="../workflow.js"></script>
|
|
882
|
-
<script src="../
|
|
883
|
-
<script src="../
|
|
884
|
-
<script src="../
|
|
885
|
-
<script src="../
|
|
886
|
-
<script src="../
|
|
887
|
-
<script src="../
|
|
888
|
-
<
|
|
889
|
-
<script src="../
|
|
890
|
-
<
|
|
891
|
-
<
|
|
892
|
-
<script src="../
|
|
893
|
-
<
|
|
825
|
+
<script src="i18n.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
826
|
+
<link rel="stylesheet" href="../genui.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
827
|
+
<script src="../genui.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
828
|
+
<script src="../chat-files.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
829
|
+
<script src="../md.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
830
|
+
<script src="../vendor/gsap/gsap.min.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
831
|
+
<script src="../motion.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
832
|
+
<script type="module" src="../morphicons-init.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
833
|
+
<script src="../plugin-center.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
834
|
+
<script src="../skills.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
835
|
+
<script src="../insights.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
836
|
+
<script src="../teams.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
837
|
+
<script src="../task-board.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
838
|
+
<script src="../extensions.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
839
|
+
<script src="../sha256.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
840
|
+
<script src="../diagnostics.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
841
|
+
<script src="../doctor.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
842
|
+
<script src="../history.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
843
|
+
<script src="../activity.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
844
|
+
<script src="../turn-results.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
845
|
+
<script src="../image-cache.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
846
|
+
<script src="../chat-copy.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
847
|
+
<script src="../image-preview.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
848
|
+
<script src="../link-check.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
849
|
+
<script src="../network.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
850
|
+
<script src="../operations.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
851
|
+
<script src="../workflow.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
852
|
+
<script src="../sponsor-entry.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
853
|
+
<script src="../relay-devices.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
854
|
+
<script src="../relay-settings.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
855
|
+
<script src="../subagents.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
856
|
+
<script src="../session-presets.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
857
|
+
<script src="../permission-presets.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
858
|
+
<script src="../approval-records.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
859
|
+
<script src="../approval-summary.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
860
|
+
<script src="../doctor-entry.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
861
|
+
<link rel="stylesheet" href="../file-inbox.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
862
|
+
<script src="../file-inbox.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
863
|
+
<link rel="stylesheet" href="../session-deck.css?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623">
|
|
864
|
+
<script src="../session-deck.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
865
|
+
<script src="../theme.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
866
|
+
<script src="../cache-upgrade.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
867
|
+
<script src="desktop.js?dsr-build=7006a2673f19f69788f5c533fbcf9ca1f077d0b4f3b92f4eb3b000ed4ee85623"></script>
|
|
894
868
|
</body>
|
|
895
869
|
</html>
|
|
@@ -141,6 +141,7 @@ for (const key of ['server', 'token']) {
|
|
|
141
141
|
window.DshExtensions?.invalidateCapabilities()
|
|
142
142
|
window.DshFileInbox?.reset()
|
|
143
143
|
window.DshSessionDeck?.reset()
|
|
144
|
+
window.DshApprovalSummary?.reset()
|
|
144
145
|
if (typeof document !== 'undefined') document.getElementById('btn-insights')?.classList.add('hidden')
|
|
145
146
|
if(typeof document!=='undefined') {
|
|
146
147
|
const identityGeneration=connectionGeneration
|
|
@@ -216,7 +217,7 @@ function renderPresetMenuDesktop() {
|
|
|
216
217
|
menu.innerHTML = `<div class="ds-empty">${esc(t('ds.presetsEmpty'))}</div><div class="ds-empty ds-presets-guide">${esc(t('ds.presetsGuide'))}</div>`
|
|
217
218
|
return
|
|
218
219
|
}
|
|
219
|
-
menu.innerHTML = list.map(p => `<button class="ds-
|
|
220
|
+
menu.innerHTML = list.map(p => `<button class="ds-action-item" data-ds-preset="${esc(p.id)}">${esc(p.name)}</button>`).join('')
|
|
220
221
|
}
|
|
221
222
|
const PRESET_NAME_MAX = 20
|
|
222
223
|
const PRESET_TEXT_MAX = 2000
|
|
@@ -454,12 +455,6 @@ async function selectSessionModel(provider, modelId) {
|
|
|
454
455
|
}
|
|
455
456
|
|
|
456
457
|
/* ---------------- 反馈 ---------------- */
|
|
457
|
-
const FEEDBACK_LINKS = {
|
|
458
|
-
githubIssues: 'https://github.com/Blank-not-black/dsh-Remote/issues',
|
|
459
|
-
giteeIssues: 'https://gitee.com/Blankneverfails/dsh-Remote/issues',
|
|
460
|
-
bili: 'https://space.bilibili.com/419009275/dynamic',
|
|
461
|
-
repo: 'https://github.com/Blank-not-black/dsh-Remote'
|
|
462
|
-
}
|
|
463
458
|
async function copyText(text) {
|
|
464
459
|
try { await navigator.clipboard.writeText(text); return true } catch {}
|
|
465
460
|
try {
|
|
@@ -470,19 +465,6 @@ async function copyText(text) {
|
|
|
470
465
|
ta.remove(); return ok
|
|
471
466
|
} catch { return false }
|
|
472
467
|
}
|
|
473
|
-
function openFeedbackMenu() {
|
|
474
|
-
$('feedback-menu').classList.remove('hidden')
|
|
475
|
-
$('btn-feedback').setAttribute('aria-expanded', 'true')
|
|
476
|
-
const first = $('feedback-menu').querySelector('[role="menuitem"]')
|
|
477
|
-
if (first) first.focus()
|
|
478
|
-
}
|
|
479
|
-
function closeFeedbackMenu() {
|
|
480
|
-
$('feedback-menu').classList.add('hidden')
|
|
481
|
-
$('btn-feedback').setAttribute('aria-expanded', 'false')
|
|
482
|
-
}
|
|
483
|
-
function toggleFeedbackMenu() {
|
|
484
|
-
$('feedback-menu').classList.contains('hidden') ? openFeedbackMenu() : closeFeedbackMenu()
|
|
485
|
-
}
|
|
486
468
|
function doctorEnvironment() {
|
|
487
469
|
let report = {}
|
|
488
470
|
try { report = globalThis.DshDiagnostics?.report?.() || {} } catch {}
|
|
@@ -503,7 +485,6 @@ function doctorEnvironment() {
|
|
|
503
485
|
}
|
|
504
486
|
}
|
|
505
487
|
function openDoctor() {
|
|
506
|
-
closeFeedbackMenu()
|
|
507
488
|
if (!window.DshDoctor) {
|
|
508
489
|
toast(t('ds.feedbackSubmitFailed', { msg: 'doctor unavailable' }), 'err')
|
|
509
490
|
return
|
|
@@ -2445,8 +2426,8 @@ function blockHtml(b,index=0,context={}) {
|
|
|
2445
2426
|
if (b.type==='thinking'||b.type==='reasoning') return window.DshActivity.reasoning({text:b.text??b.content??'',key:window.DshActivity.reasoningKey(context,index,key)})
|
|
2446
2427
|
if (b.type==='tool-call'||b.type==='tool-result') return window.DshActivity.tool({key,name:b.name||b.toolName,...(b.type==='tool-call'?{args:b.arguments??b.args??b.input}:{result:b.result??b.output??b.content??b,error:!!(b.error||b.ok===false||b.isError)})})
|
|
2447
2428
|
}
|
|
2448
|
-
if (b.type === 'text') return window.DshActivity.hasVisibleText(b.text) ? `<div class="md">${window.mdToHtml ? window.mdToHtml(b.text ?? '', { fileLinks: true, imageLabel: t('block.image'), copyCode: true, copyCodeLabel: window.I18N?.lang === 'en' ? 'Copy code' : '复制代码' }) : esc(b.text ?? '')}</div>` : ''
|
|
2449
|
-
if (b.type === 'code') return window.DshChatCopy?.code(b.content ?? b.code ?? '') || `<pre><code>${esc(b.content ?? b.code ?? '')}</code></pre>`
|
|
2429
|
+
if (b.type === 'text') return window.DshActivity.hasVisibleText(b.text) ? `<div class="md">${window.mdToHtml ? window.mdToHtml(b.text ?? '', { fileLinks: true, imageLabel: t('block.image'), copyCode: true, copyScope: window.DshChatCopy?.scope(state.history), copyCodeLabel: window.I18N?.lang === 'en' ? 'Copy code' : '复制代码' }) : esc(b.text ?? '')}</div>` : ''
|
|
2430
|
+
if (b.type === 'code') return window.DshChatCopy?.code(b.content ?? b.code ?? '', b.language || b.lang || '', { scope: window.DshChatCopy?.scope(state.history) }) || `<pre><code>${esc(b.content ?? b.code ?? '')}</code></pre>`
|
|
2450
2431
|
if (b.type === 'file' && typeof window !== 'undefined' && window.DshChatFiles) return window.DshChatFiles.render(b)
|
|
2451
2432
|
if (b.type === 'file') return `<div class="ds-tool">📎 ${esc(b.attachment?.name || b.name || 'file')} <small>${esc(b.attachment?.bytes ?? b.bytes ?? '')} bytes</small></div>`
|
|
2452
2433
|
if (b.type === 'thinking' || b.type === 'reasoning') return `<details><summary>${esc(t('block.thinking'))}</summary><div style="opacity:.82">${esc(b.text ?? b.content ?? '')}</div></details>`
|
|
@@ -2502,7 +2483,7 @@ function eventHtml(entry) {
|
|
|
2502
2483
|
if (type === 'user/message' && !isHumanUserMessage(ev)) return ''
|
|
2503
2484
|
const text = blocks.map((block,index)=>blockHtml(block,index,{...data,seq:entry.seq,suppressBlockTools:state.history.suppressBlockTools})).join('')
|
|
2504
2485
|
if (!text) return ''
|
|
2505
|
-
return `<div class="ds-msg ${esc(role)}"><div class="role">${esc(role === 'user' ? t('ds.role.me') : t('ds.role.dsh'))}
|
|
2486
|
+
return `<div class="ds-msg ${esc(role)}"><div class="role">${esc(role === 'user' ? t('ds.role.me') : t('ds.role.dsh'))}</div>${text}</div>`
|
|
2506
2487
|
}
|
|
2507
2488
|
if (type === 'tool/call') {
|
|
2508
2489
|
const name = data.name || data.toolName || t('ds.toolDefault')
|
|
@@ -4304,7 +4285,6 @@ function bindUi() {
|
|
|
4304
4285
|
$('btn-insights').addEventListener('click', () => openInsights())
|
|
4305
4286
|
$('stats-drawer-close').addEventListener('click', toggleStatsDrawer)
|
|
4306
4287
|
// 赞赏支持
|
|
4307
|
-
$('btn-donate').addEventListener('click', openDonateModal)
|
|
4308
4288
|
$('btn-donate-about').addEventListener('click', openDonateModal)
|
|
4309
4289
|
$('btn-donate-close').addEventListener('click', () => $('modal-donate').classList.add('hidden'))
|
|
4310
4290
|
// 更新内容弹窗
|
|
@@ -4322,17 +4302,6 @@ function bindUi() {
|
|
|
4322
4302
|
$('modal-new-session').addEventListener('click', (e) => { if (e.target === $('modal-new-session')) closeNewSessionModal() })
|
|
4323
4303
|
$('modal-notes').addEventListener('click', (e) => { if (e.target === $('modal-notes')) closeNotesModal() })
|
|
4324
4304
|
// 反馈
|
|
4325
|
-
$('btn-feedback').addEventListener('click', (e) => { e.stopPropagation(); toggleFeedbackMenu() })
|
|
4326
|
-
$('feedback-menu').addEventListener('click', (e) => {
|
|
4327
|
-
if (e.target.closest('a[role="menuitem"]')) closeFeedbackMenu()
|
|
4328
|
-
})
|
|
4329
|
-
$('btn-copy-link').addEventListener('click', async () => {
|
|
4330
|
-
const ok = await copyText(FEEDBACK_LINKS.repo)
|
|
4331
|
-
toast(t(ok ? 'ds.feedbackCopied' : 'ds.feedbackCopyFailed'), ok ? 'ok' : 'err')
|
|
4332
|
-
closeFeedbackMenu()
|
|
4333
|
-
})
|
|
4334
|
-
$('btn-write-feedback').addEventListener('click', () => { closeFeedbackMenu(); openFeedbackModal() })
|
|
4335
|
-
$('btn-doctor').addEventListener('click', openDoctor)
|
|
4336
4305
|
$('fb-cancel').addEventListener('click', closeFeedbackModal)
|
|
4337
4306
|
$('fb-submit').addEventListener('click', submitFeedback)
|
|
4338
4307
|
$('fb-msg').addEventListener('input', updateFeedbackLength)
|
|
@@ -4343,12 +4312,6 @@ function bindUi() {
|
|
|
4343
4312
|
btn.addEventListener('click', () => {
|
|
4344
4313
|
document.querySelectorAll('#fb-chips .ds-fb-chip').forEach(b => b.classList.toggle('current', b === btn))
|
|
4345
4314
|
}))
|
|
4346
|
-
document.addEventListener('click', (e) => {
|
|
4347
|
-
if (!e.target.closest('.ds-feedback')) closeFeedbackMenu()
|
|
4348
|
-
})
|
|
4349
|
-
document.addEventListener('keydown', (e) => {
|
|
4350
|
-
if (e.key === 'Escape' && !$('feedback-menu').classList.contains('hidden')) { closeFeedbackMenu(); $('btn-feedback').focus() }
|
|
4351
|
-
})
|
|
4352
4315
|
// 统计柱状图悬停提示: 自定义 tooltip, 限制在视口内, 避免原生 title 溢出抽屉
|
|
4353
4316
|
$('stats-chart').addEventListener('mouseover', (e) => {
|
|
4354
4317
|
const bar = e.target.closest('.ds-stats-bar')
|
|
@@ -4487,6 +4450,7 @@ function mountWorkflowDesktop() {
|
|
|
4487
4450
|
busy:!!state.byId.get(state.current)?.running,sending:sendMessage.pending?.has(state.history)}),
|
|
4488
4451
|
settings:name=>{showView('view-settings');showSettingsPage(name)},plugins:()=>showView('view-plugins'),
|
|
4489
4452
|
feedback:openFeedbackModal,
|
|
4453
|
+
doctor:openDoctor,
|
|
4490
4454
|
browse:()=>{closeNewSessionModal();showView('view-files')},
|
|
4491
4455
|
register:async()=>{
|
|
4492
4456
|
const connection=captureConnection(),path=state.fs.path;if(!path)return toast('请先选择主机目录','err')
|
|
@@ -4537,3 +4501,12 @@ globalThis.DshFileInbox?.mount({ capture: captureConnection, url: apiUrl,
|
|
|
4537
4501
|
sessionTitle: id => state.byId.has(id) ? titleOf(state.byId.get(id)) : '', openFiles: () => showView('view-files'),
|
|
4538
4502
|
headers: connection => ({ authorization: 'Bearer ' + connection.token, 'x-dsh-remote-client': 'web', ...clientIdHeaders() }), native: () => null })
|
|
4539
4503
|
globalThis.DshSessionDeck?.mount({ context: () => ({ sessionId: state.current, inChat: state.view === 'view-chat' }) })
|
|
4504
|
+
globalThis.DshApprovalSummary?.mount({ capture: captureConnection, items: () => state.approvals,
|
|
4505
|
+
url: (connection, path) => connection.server + path,
|
|
4506
|
+
headers: connection => ({ authorization: 'Bearer ' + connection.token, ...clientIdHeaders() }) })
|
|
4507
|
+
globalThis.DshCacheUpgrade?.mount({
|
|
4508
|
+
scopes:()=>state.servers.map(server=>historyCacheScope(server.url,serverToken(server))),
|
|
4509
|
+
safe:()=>!state.current&&!state.approvals.length&&!state.questions.length
|
|
4510
|
+
&&![...document.querySelectorAll('textarea,input:not([type="checkbox"]):not([type="radio"])')].some(input=>input.getBoundingClientRect().width&&input.value)
|
|
4511
|
+
&&!document.querySelector('[data-transfer-id]')&&!state.sessions.some(session=>session.running)
|
|
4512
|
+
})
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/* Packaged Android WebUI: paired public origins always use the native TLS proxy. */
|
|
2
|
+
;(function(root) {
|
|
3
|
+
'use strict'
|
|
4
|
+
const bridge = root.NativeE2ee
|
|
5
|
+
if (!bridge?.resolve) return
|
|
6
|
+
const active = new Set()
|
|
7
|
+
function changed(origin) { for (const request of [...active]) if (request.origin === origin) request.cancel() }
|
|
8
|
+
function resolve(input) {
|
|
9
|
+
const original = String(input), value = JSON.parse(bridge.resolve(original))
|
|
10
|
+
if (value.error || typeof value.url !== 'string') throw new Error('E2EE_TRANSPORT_UNAVAILABLE')
|
|
11
|
+
if ((value.secure || value.paired) && !/^(?:http|ws):\/\/127\.0\.0\.1:\d+\/e2ee-[a-f0-9]{48}\//.test(value.url)) throw new Error('E2EE_TRANSPORT_UNAVAILABLE')
|
|
12
|
+
return value.url
|
|
13
|
+
}
|
|
14
|
+
const fetch = root.fetch.bind(root)
|
|
15
|
+
root.fetch = function(input, init) {
|
|
16
|
+
try {
|
|
17
|
+
const request = typeof root.Request === 'function' && input instanceof root.Request
|
|
18
|
+
const url = request ? input.url : new URL(String(input), root.location.href).href
|
|
19
|
+
const mapped = resolve(url)
|
|
20
|
+
const controller = new root.AbortController(), signal = init?.signal || (request ? input.signal : null)
|
|
21
|
+
const cancel = () => controller.abort(signal?.reason), entry = { origin: new URL(url).origin, cancel: () => controller.abort() }
|
|
22
|
+
if (signal?.aborted) cancel(); else signal?.addEventListener('abort', cancel, { once: true })
|
|
23
|
+
active.add(entry)
|
|
24
|
+
return fetch(mapped === url ? input : request ? new root.Request(mapped, input) : mapped, { ...init, signal: controller.signal })
|
|
25
|
+
.finally(() => { active.delete(entry); signal?.removeEventListener('abort', cancel) })
|
|
26
|
+
} catch (error) { return Promise.reject(error) }
|
|
27
|
+
}
|
|
28
|
+
if (root.WebSocket) {
|
|
29
|
+
const WebSocket = root.WebSocket
|
|
30
|
+
root.WebSocket = class extends WebSocket {
|
|
31
|
+
constructor(url, protocols) {
|
|
32
|
+
const original = new URL(String(url), root.location.href)
|
|
33
|
+
super(resolve(original.href), ...(protocols === undefined ? [] : [protocols]))
|
|
34
|
+
const entry = { origin: original.origin.replace(/^wss:/, 'https:'), cancel: () => this.close() }; active.add(entry)
|
|
35
|
+
this.addEventListener?.('close', () => active.delete(entry), { once: true })
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (root.XMLHttpRequest) {
|
|
40
|
+
const open = root.XMLHttpRequest.prototype.open
|
|
41
|
+
const entries = new WeakMap()
|
|
42
|
+
root.XMLHttpRequest.prototype.open = function(method, url, ...args) {
|
|
43
|
+
const original = new URL(String(url), root.location.href), mapped = resolve(original.href)
|
|
44
|
+
const previous = entries.get(this); if (previous) active.delete(previous)
|
|
45
|
+
const result = open.call(this, method, mapped, ...args)
|
|
46
|
+
const entry = { origin: original.origin, cancel: () => this.abort() }; active.add(entry); entries.set(this, entry)
|
|
47
|
+
this.addEventListener?.('loadend', () => active.delete(entry), { once: true })
|
|
48
|
+
return result
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function externalAllowed(input) {
|
|
52
|
+
try { const state = JSON.parse(bridge.info(new URL(String(input), root.location.href).origin)); return !state.configured && !state.required } catch { return false }
|
|
53
|
+
}
|
|
54
|
+
const externalNotice = () => root.alert?.(root.I18N?.lang === 'en' ? 'Use this paired relay inside the app. Open management locally on your host.' : '此配对中转需要在应用内使用;管理页面请从主机本地打开。')
|
|
55
|
+
if (root.open) {
|
|
56
|
+
const open = root.open.bind(root)
|
|
57
|
+
root.open = (url, ...args) => { if (!externalAllowed(url)) { externalNotice(); return null }; return open(url, ...args) }
|
|
58
|
+
}
|
|
59
|
+
root.document?.addEventListener('click', event => {
|
|
60
|
+
const anchor = event.target?.closest?.('a[href]')
|
|
61
|
+
if (anchor && !externalAllowed(anchor.href)) { event.preventDefault(); event.stopImmediatePropagation(); externalNotice() }
|
|
62
|
+
}, true)
|
|
63
|
+
root.DshE2eeTransport = { resolve, mount(target, { connection, onConnect, onModeChange, onAutoPaired } = {}) {
|
|
64
|
+
if (!target || target.dataset.e2eeMounted) return
|
|
65
|
+
target.dataset.e2eeMounted = 'true'
|
|
66
|
+
const en = () => root.I18N?.lang === 'en', text = (zh, english) => en() ? english : zh
|
|
67
|
+
const title = document.createElement('h3'), explanation = document.createElement('p'), button = document.createElement('button'), status = document.createElement('p')
|
|
68
|
+
const file = document.createElement('input'); file.type = 'file'; file.accept = '.json,application/json'; file.hidden = true
|
|
69
|
+
const autoPair = document.createElement('button'); autoPair.type = 'button'
|
|
70
|
+
autoPair.textContent = text('通过当前局域网连接自动配对', 'Pair automatically over the current LAN connection')
|
|
71
|
+
const logBox = document.createElement('details'), logSummary = document.createElement('summary')
|
|
72
|
+
const logPre = document.createElement('pre'), logActions = document.createElement('div'), logHint = document.createElement('p')
|
|
73
|
+
const logCopy = document.createElement('button'), logRefresh = document.createElement('button'), logClear = document.createElement('button')
|
|
74
|
+
logBox.className = 'relay-pair-log'; logSummary.textContent = text('配对日志(可复制反馈)', 'Pairing log (copy for support)')
|
|
75
|
+
logPre.className = 'relay-pair-log-text'; logPre.setAttribute('aria-live', 'polite')
|
|
76
|
+
logActions.className = 'relay-pair-log-actions'; logHint.className = 'relay-pair-log-hint'; logHint.setAttribute('role', 'status')
|
|
77
|
+
logCopy.type = 'button'; logCopy.textContent = text('复制日志', 'Copy log')
|
|
78
|
+
logRefresh.type = 'button'; logRefresh.textContent = text('刷新', 'Refresh')
|
|
79
|
+
logClear.type = 'button'; logClear.textContent = text('清空', 'Clear')
|
|
80
|
+
function renderLog() {
|
|
81
|
+
try {
|
|
82
|
+
const value = root.DshRelayAutoPair?.logText?.() || ''
|
|
83
|
+
logPre.textContent = value || text('暂无配对记录。', 'No pairing records yet.')
|
|
84
|
+
} catch { logPre.textContent = text('日志读取失败。', 'Could not read the log.') }
|
|
85
|
+
}
|
|
86
|
+
async function copyLog() {
|
|
87
|
+
const value = root.DshRelayAutoPair?.logText?.() || ''
|
|
88
|
+
let ok = false
|
|
89
|
+
try { if (root.navigator?.clipboard?.writeText) { await root.navigator.clipboard.writeText(value); ok = true } } catch {}
|
|
90
|
+
if (!ok) {
|
|
91
|
+
try {
|
|
92
|
+
const area = root.document.createElement('textarea')
|
|
93
|
+
area.value = value; area.setAttribute('readonly', ''); area.style.position = 'fixed'; area.style.top = '-1000px'
|
|
94
|
+
root.document.body.append(area); area.select(); ok = root.document.execCommand?.('copy') === true; area.remove()
|
|
95
|
+
} catch { ok = false }
|
|
96
|
+
}
|
|
97
|
+
logHint.textContent = ok ? text('已复制配对日志。', 'Pairing log copied.') : text('复制失败,请展开日志后手动选择复制。', 'Copy failed. Expand the log and copy it manually.')
|
|
98
|
+
}
|
|
99
|
+
logCopy.addEventListener('click', () => void copyLog())
|
|
100
|
+
logRefresh.addEventListener('click', renderLog)
|
|
101
|
+
logClear.addEventListener('click', () => { root.DshRelayAutoPair?.clearLog?.(); renderLog(); logHint.textContent = text('已清空配对日志。', 'Pairing log cleared.') })
|
|
102
|
+
logActions.append(logCopy, logRefresh, logClear); logBox.append(logSummary, logPre, logActions, logHint)
|
|
103
|
+
autoPair.addEventListener('click', () => {
|
|
104
|
+
const ctx = connection()
|
|
105
|
+
if (!root.DshRelayAutoPair?.localUrl(ctx.url('/relay'))) {
|
|
106
|
+
status.textContent = text('请先连接自己电脑的局域网地址,再配置公网配对。', 'Connect to your computer’s LAN address first, then configure relay pairing.')
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
renderLog()
|
|
110
|
+
void root.DshRelayAutoPair.offer({ connection, onPaired: onAutoPaired, force: true, onStatus: (value, error) => {
|
|
111
|
+
status.textContent = value
|
|
112
|
+
if (error) logBox.open = true
|
|
113
|
+
renderLog(); renderMode()
|
|
114
|
+
} })
|
|
115
|
+
})
|
|
116
|
+
const modeLabel = document.createElement('label'), modeSwitch = document.createElement('input'), modeText = document.createElement('span'), modeStatus = document.createElement('p')
|
|
117
|
+
modeLabel.className = 'relay-encryption-switch'; modeSwitch.type = 'checkbox'; modeSwitch.checked = true; modeSwitch.dataset.e2eeToggle = 'true'
|
|
118
|
+
modeText.textContent = text('端到端加密(默认开启)', 'End-to-end encryption (on by default)'); modeLabel.append(modeSwitch, modeText)
|
|
119
|
+
modeStatus.setAttribute('role', 'status'); modeStatus.className = 'relay-encryption-status'
|
|
120
|
+
title.textContent = text('端到端加密配对(试验)', 'End-to-end pairing (experimental)')
|
|
121
|
+
explanation.textContent = text('先连接自己电脑的局域网地址,即可确认并自动配置这台手机的公网配对,无需传文件;也可手动导入。端到端加密默认开启,关闭前必须确认风险,连接失败不会自动切换模式。', 'Connect to your computer’s LAN address to confirm and automatically configure this phone’s relay pairing, without transferring files. Manual import is also available. Encryption defaults on; disabling requires confirmation and connection failures never change the mode.')
|
|
122
|
+
button.type = 'button'; button.textContent = text('导入本机配对文件', 'Import local pairing file')
|
|
123
|
+
status.setAttribute('role', 'status'); target.append(title, explanation, modeLabel, modeStatus, autoPair, button, file, status, logBox)
|
|
124
|
+
let selectedOrigin = '', identity = ''
|
|
125
|
+
function modeContext() {
|
|
126
|
+
const ctx = connection(), key = JSON.stringify([ctx.url('/relay'),ctx.headers?.authorization||''])
|
|
127
|
+
if (key !== identity) { identity = key; selectedOrigin = new URL(ctx.url('/relay'),root.location.href).origin }
|
|
128
|
+
selectedOrigin = root.DshRelayAutoPair?.pairedOrigin(ctx.url('/relay')) || selectedOrigin
|
|
129
|
+
return ctx
|
|
130
|
+
}
|
|
131
|
+
function renderMode() {
|
|
132
|
+
try {
|
|
133
|
+
modeContext(); const state = JSON.parse(bridge.info(selectedOrigin))
|
|
134
|
+
modeSwitch.checked = state.encrypted !== false
|
|
135
|
+
modeSwitch.disabled = !!state.error || !state.configured || typeof bridge.setEncryption !== 'function'
|
|
136
|
+
modeStatus.dataset.security = !state.configured || state.error ? 'pending' : modeSwitch.checked ? 'encrypted' : 'legacy'
|
|
137
|
+
modeStatus.textContent = selectedOrigin + ' · ' + (state.error ? text('无法读取安全状态,请重试;不会自动降级。','Security status unavailable. No automatic fallback.') : !state.configured
|
|
138
|
+
? text('默认开启,待本地配对;当前连接尚不能标记为已加密。','On by default; local pairing required. This connection is not yet verified as encrypted.')
|
|
139
|
+
: modeSwitch.checked ? text('端到端加密已启用;每次连接仍需通过主机证书校验。','End-to-end encryption enabled; each connection must verify the host certificate.')
|
|
140
|
+
: text('警告:端到端加密已关闭。仅有 HTTPS,中转方在技术上可读取内容和访问令牌。','Warning: end-to-end encryption is OFF. HTTPS remains, but the relay can technically read content and access tokens.'))
|
|
141
|
+
} catch { modeSwitch.disabled = true; modeStatus.textContent = text('无法读取安全状态。','Security status unavailable.') }
|
|
142
|
+
}
|
|
143
|
+
modeSwitch.addEventListener('change', () => {
|
|
144
|
+
const requested = modeSwitch.checked, ctx = modeContext(), origin = selectedOrigin
|
|
145
|
+
renderMode()
|
|
146
|
+
try {
|
|
147
|
+
const state = JSON.parse(bridge.info(origin))
|
|
148
|
+
if (!state.configured || state.error || !ctx.valid()) return
|
|
149
|
+
if (!requested && !root.confirm(text('确认关闭端到端加密?\n关闭后,中转服务器在技术上可读取对话、图片及 Remote 访问令牌。令牌泄露可能导致主机被操作和模型额度被消耗。外层 HTTPS 仍保留,但不能阻止中转方读取内容。\n此选择仅对当前主机保存,重启后仍生效。取消可保持加密。\n目标:','Turn off end-to-end encryption?\nThe relay can technically read conversations, images and the Remote access token. A leaked token may allow host access and model usage. HTTPS remains but does not hide content from the relay.\nThis choice persists for this host after restart. Cancel to keep encryption.\nHost: ') + origin)) return
|
|
150
|
+
if (!ctx.valid()) return
|
|
151
|
+
const result = JSON.parse(bridge.setEncryption(origin, requested, state.fingerprint, !requested))
|
|
152
|
+
if (result.error || result.encrypted !== requested) throw Error('E2EE_MODE_CHANGE_FAILED')
|
|
153
|
+
changed(origin); onModeChange?.(origin, ctx); renderMode()
|
|
154
|
+
status.textContent = requested ? text('已开启;连接失败时不会自动降级。','Enabled. Connection failures never trigger fallback.') : text('已关闭端到端加密,HTTPS 仍保留。','End-to-end encryption disabled; HTTPS remains.')
|
|
155
|
+
} catch { renderMode(); status.textContent = text('模式未能切换,原设置保留。开启失败时请检查系统和证书,不能跳过校验。','Mode change failed; the previous setting is kept. Check system support and the certificate; verification cannot be skipped.') }
|
|
156
|
+
})
|
|
157
|
+
root.setInterval?.(renderMode, 1000); renderMode(); renderLog()
|
|
158
|
+
if (bridge.supported?.() === false) status.textContent = text('此系统不支持 TLS 1.3,加密模式无法连接。可升级系统;若选择关闭,须先确认风险。','This system lacks TLS 1.3. Upgrade Android, or explicitly acknowledge the risks before disabling encryption.')
|
|
159
|
+
button.addEventListener('click', () => file.click())
|
|
160
|
+
file.addEventListener('change', async () => {
|
|
161
|
+
const ctx = connection(), selected = file.files?.[0]; file.value = ''
|
|
162
|
+
if (!selected || selected.size > 16384) { status.textContent = text('请选择不超过 16KB 的配对 JSON 文件。', 'Select a pairing JSON file up to 16KB.'); return }
|
|
163
|
+
button.disabled = true
|
|
164
|
+
try {
|
|
165
|
+
const json = await selected.text(), pair = JSON.parse(json), url = new URL(pair.relayUrl)
|
|
166
|
+
if (!ctx.valid()) return
|
|
167
|
+
if (url.protocol !== 'https:' || url.pathname !== '/relay/v1/e2ee' || !/^[a-f0-9]{64}$/.test(pair.fingerprint)) throw Error('INVALID_E2EE_PAIRING')
|
|
168
|
+
const old = JSON.parse(bridge.info(url.origin))
|
|
169
|
+
if (old.error) throw Error(old.error)
|
|
170
|
+
const prompt = text('确认此文件来自自己的主机本地?\n主机地址:', 'Confirm this file came locally from your own host?\nHost: ') + url.origin
|
|
171
|
+
+ '\n' + text('证书指纹:', 'Certificate fingerprint: ') + pair.fingerprint
|
|
172
|
+
+ (old.configured && old.fingerprint !== pair.fingerprint ? '\n' + text('主机证书已改变,此操作将替换旧配对。', 'The host certificate changed. This replaces the previous pairing.') : '')
|
|
173
|
+
if (!root.confirm(prompt) || !ctx.valid()) return
|
|
174
|
+
// Reuse a credential only after the current authenticated host confirms
|
|
175
|
+
// this exact certificate and public origin. Never send host A's token to B.
|
|
176
|
+
let sameHost = false
|
|
177
|
+
try {
|
|
178
|
+
const response = await root.fetch(ctx.url('/relay'), { headers: ctx.headers, signal: root.AbortSignal.timeout(8000) })
|
|
179
|
+
const host = response.ok ? await response.json() : null
|
|
180
|
+
sameHost = host?.e2ee?.fingerprint === pair.fingerprint && new URL(host.publicUrl).origin === url.origin
|
|
181
|
+
} catch {}
|
|
182
|
+
if (!ctx.valid()) return
|
|
183
|
+
const result = JSON.parse(bridge.configure(json, old.fingerprint || ''))
|
|
184
|
+
if (result.error || !result.origin) throw Error('E2EE_IMPORT_FAILED')
|
|
185
|
+
selectedOrigin = result.origin
|
|
186
|
+
changed(result.origin)
|
|
187
|
+
status.textContent = sameHost ? text('加密配对已保存,连接时将校验主机证书。', 'Pairing saved. The host certificate will be verified when connecting.')
|
|
188
|
+
: text('加密配对已保存。请在主机与连接中选择对应公网地址并填写该主机的访问令牌,当前连接的凭证不会自动复用。', 'Pairing saved. Select its public URL in Hosts and connections and enter that host’s access token. The current credential will not be reused automatically.')
|
|
189
|
+
if (sameHost) onConnect?.(result.origin, ctx)
|
|
190
|
+
renderMode()
|
|
191
|
+
} catch { if (ctx.valid()) status.textContent = text('配对导入失败,请检查文件、有效期和主机配置;不会使用旧链路重试。', 'Pairing import failed. Check the file, expiry and host configuration. No legacy fallback will be attempted.') }
|
|
192
|
+
finally { button.disabled = false }
|
|
193
|
+
})
|
|
194
|
+
} }
|
|
195
|
+
})(typeof window !== 'undefined' ? window : globalThis)
|
package/public/extensions.js
CHANGED
|
@@ -4,11 +4,11 @@ window.DshExtensions = (() => {
|
|
|
4
4
|
let current, cache
|
|
5
5
|
let shortcuts
|
|
6
6
|
const catalog = [
|
|
7
|
-
{ id: 'skills', name: '@linxin666/dsh-client-ui-skill-explorer', label: '打开技能中心', summary: '浏览、搜索和阅读主机上的技能', verified: '0.4.
|
|
8
|
-
{ id: 'teams', name: '@nanmicoder/dsh-agent-teams', label: '查看智能体团队', summary: '查看智能体团队、任务与成员状态', verified: '0.1.
|
|
9
|
-
{ id: 'cost', name: 'dsh-cost-meter', label: '查看费用与额度', summary: '查看费用、套餐额度与峰谷提醒', verified: '1.
|
|
10
|
-
{ id: 'context', name: 'dsh-context', label: '查看当前会话上下文', session: true, summary: '查看会话上下文用量与构成', verified: '0.
|
|
11
|
-
{ id: 'tasks', name: '@linxin666/dsh-client-ui-task-board', label: '查看任务看板', summary: '只读查看任务、执行结果与计划时间', verified: '0.4.
|
|
7
|
+
{ id: 'skills', name: '@linxin666/dsh-client-ui-skill-explorer', label: '打开技能中心', summary: '浏览、搜索和阅读主机上的技能', verified: '0.4.13' },
|
|
8
|
+
{ id: 'teams', name: '@nanmicoder/dsh-agent-teams', label: '查看智能体团队', summary: '查看智能体团队、任务与成员状态', verified: '0.1.28' },
|
|
9
|
+
{ id: 'cost', name: 'dsh-cost-meter', label: '查看费用与额度', summary: '查看费用、套餐额度与峰谷提醒', verified: '1.9.46' },
|
|
10
|
+
{ id: 'context', name: 'dsh-context', label: '查看当前会话上下文', session: true, summary: '查看会话上下文用量与构成', verified: '0.78.2' },
|
|
11
|
+
{ id: 'tasks', name: '@linxin666/dsh-client-ui-task-board', label: '查看任务看板', summary: '只读查看任务、执行结果与计划时间', verified: '0.4.13' },
|
|
12
12
|
]
|
|
13
13
|
const empty = () => ({ known: false, skills: false, cost: false, context: false, teams: false, tasks: false })
|
|
14
14
|
const helpUrl = 'https://github.com/Blank-not-black/dsh-Remote/blob/main/docs/wiki/plugins.md'
|
|
@@ -39,7 +39,7 @@ window.DshExtensions = (() => {
|
|
|
39
39
|
const native = identity(config)
|
|
40
40
|
if (!native.valid() || config.valid && !config.valid()) return
|
|
41
41
|
const code = result?.ok === true && result.available !== false ? 'available'
|
|
42
|
-
: result?.code === 'unsupported' ? 'unsupported' :
|
|
42
|
+
: result?.code === 'unsupported' ? 'unsupported' : ['not-installed','endpoint-missing'].includes(result?.code) ? 'endpoint-missing'
|
|
43
43
|
: result?.code === 'host-denied' ? 'host-denied' : result?.code === 'timeout' ? 'timeout' : 'read-failed'
|
|
44
44
|
cache.observations ||= {}
|
|
45
45
|
cache.observations[id] = { code, at: Date.now(), version: cache.snapshot?.items?.find(row => row.name === catalog.find(feature => feature.id === id).name)?.version }
|