dsh-remote-plugin 0.8.1 → 0.8.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 +1 -1
- package/apk/dsh-remote.apk +0 -0
- package/cordis.patch.yml +2 -1
- package/gateway.cjs +323 -64
- package/index.mjs +2 -2
- package/insights.mjs +5 -3
- package/market.mjs +4 -1
- package/package.json +1 -1
- package/plugin-center.mjs +120 -7
- package/plugin-transaction.mjs +10 -3
- package/public/admin.html +19 -14
- package/public/admin.js +71 -23
- package/public/announcements.json +192 -0
- package/public/app.js +192 -60
- package/public/build.json +2 -2
- package/public/chat-copy.js +46 -0
- package/public/desktop/desktop.css +10 -0
- package/public/desktop/desktop.html +28 -15
- package/public/desktop/desktop.js +74 -22
- package/public/diagnostics.js +115 -21
- package/public/history.js +45 -9
- package/public/image-cache.js +141 -0
- package/public/image-preview.js +48 -5
- package/public/index.html +39 -34
- package/public/lan-discovery.js +94 -0
- package/public/md.js +8 -2
- package/public/plugin-center.js +1 -1
- package/public/plugin.html +8 -2
- package/public/relay-settings.js +7 -6
- package/public/skins/blue-fish/DESIGN.md +24 -0
- package/public/skins/blue-fish/preview.html +11 -289
- package/public/skins/blue-fish/skin.css +95 -585
- package/public/skins/blue-fish/sparkles.svg +18 -0
- package/public/skins/bocchi/DESIGN.md +99 -0
- package/public/skins/bocchi/face.png +0 -0
- package/public/skins/bocchi/grain.png +0 -0
- package/public/skins/bocchi/icon-blush.png +0 -0
- package/public/skins/bocchi/icon-sleep.png +0 -0
- package/public/skins/bocchi/icon-smile.png +0 -0
- package/public/skins/bocchi/icon-star.png +0 -0
- package/public/skins/bocchi/icon-wink.png +0 -0
- package/public/skins/bocchi/icon.png +0 -0
- package/public/skins/bocchi/pattern-soft.png +0 -0
- package/public/skins/bocchi/pattern.png +0 -0
- package/public/skins/bocchi/preview.html +54 -0
- package/public/skins/bocchi/skin.css +233 -0
- package/public/skins/bocchi/stage-bg.png +0 -0
- package/public/skins/bocchi/stage-soft.png +0 -0
- package/public/skins/bocchi/stand.png +0 -0
- package/public/skins/bocchi/sticker-guitar.png +0 -0
- package/public/skins/kessoku/DESIGN.md +38 -0
- package/public/skins/kessoku/grain.png +0 -0
- package/public/skins/kessoku/skin.css +212 -0
- package/public/skins/kita/SOURCES.json +51 -0
- package/public/skins/kita/face.png +0 -0
- package/public/skins/kita/icon-live.png +0 -0
- package/public/skins/kita/icon-reddress.png +0 -0
- package/public/skins/kita/icon-seifuku.png +0 -0
- package/public/skins/kita/pattern.png +0 -0
- package/public/skins/kita/preview.html +55 -0
- package/public/skins/kita/skin.css +26 -0
- package/public/skins/kita/stand.png +0 -0
- package/public/skins/kita/sticker-live.png +0 -0
- package/public/skins/nijika/SOURCES.json +51 -0
- package/public/skins/nijika/face.png +0 -0
- package/public/skins/nijika/icon-live.png +0 -0
- package/public/skins/nijika/icon-reddress.png +0 -0
- package/public/skins/nijika/icon-seifuku.png +0 -0
- package/public/skins/nijika/pattern.png +0 -0
- package/public/skins/nijika/preview.html +55 -0
- package/public/skins/nijika/skin.css +25 -0
- package/public/skins/nijika/stand.png +0 -0
- package/public/skins/nijika/sticker-live.png +0 -0
- package/public/skins/penguin/DESIGN.md +33 -0
- package/public/skins/penguin/SOURCES.json +22 -0
- package/public/skins/penguin/aic-blueprint.svg +24 -0
- package/public/skins/penguin/endfield-triangles.svg +4 -0
- package/public/skins/penguin/face.png +0 -0
- package/public/skins/penguin/icon-blush.png +0 -0
- package/public/skins/penguin/icon-dizzy.png +0 -0
- package/public/skins/penguin/icon-laugh.png +0 -0
- package/public/skins/penguin/icon-sleep.png +0 -0
- package/public/skins/penguin/icon-smile.png +0 -0
- package/public/skins/penguin/icon-star.png +0 -0
- package/public/skins/penguin/icon-wink.png +0 -0
- package/public/skins/penguin/icon.png +0 -0
- package/public/skins/penguin/mascot.png +0 -0
- package/public/skins/penguin/pattern-night.png +0 -0
- package/public/skins/penguin/pattern.png +0 -0
- package/public/skins/penguin/preview.html +11 -0
- package/public/skins/penguin/skin.css +212 -0
- package/public/skins/ryo/SOURCES.json +51 -0
- package/public/skins/ryo/face.png +0 -0
- package/public/skins/ryo/icon-live.png +0 -0
- package/public/skins/ryo/icon-reddress.png +0 -0
- package/public/skins/ryo/icon-seifuku.png +0 -0
- package/public/skins/ryo/pattern.png +0 -0
- package/public/skins/ryo/preview.html +55 -0
- package/public/skins/ryo/skin.css +25 -0
- package/public/skins/ryo/stand.png +0 -0
- package/public/skins/ryo/sticker-live.png +0 -0
- package/public/sponsor-entry.js +22 -0
- package/public/styles.css +13 -0
- package/public/theme-picker.css +58 -0
- package/public/theme-vars.css +532 -5
- package/public/theme.js +111 -3
- package/public/update.json +12 -12
- package/public/version.json +1 -1
- package/public/workflow.css +2 -1
- package/public/workflow.js +24 -1
- package/skills/dsh-remote-doctor/references/wiki/notifications.md +4 -0
|
@@ -825,3 +825,13 @@ input:focus-visible, select:focus-visible, textarea:focus-visible {
|
|
|
825
825
|
.chat-file { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:12px; border:1px solid var(--dsr-line); border-radius:12px; margin:8px 0; }
|
|
826
826
|
.chat-file-name { min-width:0; flex:1; overflow-wrap:break-word; }.chat-file small { color:var(--dsr-muted); }
|
|
827
827
|
.chat-file button { flex-shrink:0; min-height:44px; padding:8px 12px; border:1px solid var(--dsr-accent-line); border-radius:10px; color:var(--dsr-accent-strong); background:var(--dsr-accent-soft); font:inherit; cursor:pointer; }
|
|
828
|
+
|
|
829
|
+
/* Conversation copy controls remain reachable on touch and keyboard. */
|
|
830
|
+
.ds-msg .role { display:flex; align-items:center; justify-content:space-between; gap:12px; opacity:1; }
|
|
831
|
+
.chat-copy-button { min-height:36px; padding:4px 9px; border:1px solid var(--dsr-line); border-radius:8px; background:var(--dsr-panel); color:var(--dsr-muted); font:inherit; font-size:11px; cursor:pointer; }
|
|
832
|
+
.chat-copy-button:focus-visible { outline:2px solid var(--dsr-accent); outline-offset:2px; }
|
|
833
|
+
.chat-copy-button:disabled { opacity:.6; cursor:wait; }
|
|
834
|
+
.chat-code { position:relative; margin:8px 0; }
|
|
835
|
+
.chat-code > .chat-copy-button { display:block; margin-left:auto; margin-bottom:3px; }
|
|
836
|
+
.feedback-length { margin:4px 0; color:var(--dsr-muted); font-size:12px; }
|
|
837
|
+
#fb-msg[aria-invalid="true"] { outline:2px solid var(--dsr-danger, #dc4444); }
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>DSH Remote · 桌面</title>
|
|
7
|
-
<script>/* 首帧前应用皮肤 */ (function(){try{var t=localStorage.getItem('dshTheme');if(t!=='default'&&t!=='dark'&&t!=='light'&&t!=='neutral'&&t!=='mono'&&t!=='fish'){t='fish'}}catch(e){t='fish'}document.documentElement.setAttribute('data-theme',t)})()</script>
|
|
7
|
+
<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
8
|
<link rel="stylesheet" href="../theme-vars.css">
|
|
9
9
|
<link rel="stylesheet" href="desktop.css">
|
|
10
10
|
<link rel="stylesheet" href="../plugin-center.css">
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
<link rel="stylesheet" href="../relay-settings.css">
|
|
17
17
|
<link rel="stylesheet" href="../subagents.css">
|
|
18
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">
|
|
19
26
|
</head>
|
|
20
27
|
<body>
|
|
21
28
|
<div class="ds-app" id="ds-app">
|
|
@@ -326,7 +333,7 @@
|
|
|
326
333
|
<div class="ds-setting-name" data-i18n="ds.groupTheme">皮肤</div>
|
|
327
334
|
</div>
|
|
328
335
|
<div class="ds-setting-row">
|
|
329
|
-
<div><div class="ds-setting-name" data-i18n="ds.themeTitle">皮肤</div><div class="ds-setting-desc" data-i18n="ds.themeDesc"
|
|
336
|
+
<div><div class="ds-setting-name" data-i18n="ds.themeTitle">皮肤</div><div class="ds-setting-desc" data-i18n="ds.themeDesc">十二套皮肤</div></div>
|
|
330
337
|
<button id="btn-theme" class="ds-btn">默认深空</button>
|
|
331
338
|
</div>
|
|
332
339
|
</div>
|
|
@@ -435,12 +442,14 @@
|
|
|
435
442
|
<button class="ds-fb-chip" data-fb-type="suggestion" data-i18n="ds.feedbackTypeSuggestion">建议</button>
|
|
436
443
|
<button class="ds-fb-chip" data-fb-type="other" data-i18n="ds.feedbackTypeOther">其他</button>
|
|
437
444
|
</div>
|
|
438
|
-
<textarea id="fb-msg" class="ds-fb-textarea" rows="5"
|
|
445
|
+
<textarea id="fb-msg" class="ds-fb-textarea" rows="5" aria-describedby="fb-length" data-i18n-placeholder="ds.feedbackMessagePlaceholder" placeholder="请描述遇到的问题或建议(必填,最多 20000 字符)"></textarea>
|
|
446
|
+
<p id="fb-length" class="feedback-length" role="status" aria-live="polite"></p>
|
|
447
|
+
<button id="fb-copy-draft" type="button" class="ds-btn ds-fb-copy-draft">复制全文</button>
|
|
439
448
|
<input id="fb-contact" class="ds-fb-input" maxlength="200" data-i18n-placeholder="ds.feedbackContactPlaceholder" placeholder="联系方式(可选):邮箱 / 微信 / B站 ID">
|
|
440
|
-
<label class="ds-fb-diagnostics"><input id="fb-include-diagnostics" type="checkbox"> <span data-i18n="ds.feedbackIncludeDiagnostics"
|
|
449
|
+
<label class="ds-fb-diagnostics"><input id="fb-include-diagnostics" type="checkbox"> <span data-i18n="ds.feedbackIncludeDiagnostics">附带客户端与网关诊断(可选)</span><small data-i18n="ds.feedbackDiagnosticsPrivacy">上传客户端操作与错误位置、存储占用、版本和网关链路状态;不含令牌、Cookie、对话正文、答案或完整路径。可在下方预览。</small></label>
|
|
441
450
|
<label class="ds-fb-diagnostics"><input id="fb-include-crashes" type="checkbox"> <span data-i18n="ds.feedbackIncludeCrashes">附带崩溃日志摘要(可选)</span><small data-i18n="ds.feedbackCrashPrivacy">默认仅在本机记录。勾选后上传最近 3 条退出、重启和错误位置摘要,不含对话、密钥或完整路径。</small></label>
|
|
442
451
|
<section class="client-diagnostics" aria-label="操作诊断日志">
|
|
443
|
-
<p data-log-label="privacy"
|
|
452
|
+
<p data-log-label="privacy">操作日志默认保存在此设备。提交反馈时勾选诊断选项可附带脱敏日志,也可复制或导出。</p>
|
|
444
453
|
<details id="fb-client-log-details"><summary data-log-label="details">查看操作诊断日志</summary><pre id="fb-client-log-preview"></pre></details>
|
|
445
454
|
<div class="client-log-actions"><button id="fb-log-preview" type="button" data-log-label="refresh">刷新预览</button><button id="fb-log-copy" type="button" data-log-label="copy">复制日志</button><button id="fb-log-export" type="button" data-log-label="export">导出日志</button><button id="fb-log-clear" type="button" data-log-label="clear">清除日志</button></div>
|
|
446
455
|
<p id="fb-client-log-status" role="status" aria-live="polite"></p>
|
|
@@ -537,6 +546,7 @@
|
|
|
537
546
|
</div>
|
|
538
547
|
|
|
539
548
|
<!-- 赞赏支持模态 -->
|
|
549
|
+
<script src="../sponsor-entry.js" defer></script>
|
|
540
550
|
<div id="modal-donate" class="ds-modal hidden" role="dialog" aria-modal="true">
|
|
541
551
|
<div class="ds-modal-card">
|
|
542
552
|
<div class="ds-modal-title" data-i18n="ds.donate">赞赏支持</div>
|
|
@@ -618,18 +628,18 @@
|
|
|
618
628
|
'ds.back': '‹ 返回', 'ds.emptyGroup': '暂无设置项',
|
|
619
629
|
'ds.serversTitle': '服务器(分组)', 'ds.speedTest': '测速', 'ds.currentGroup': '当前组',
|
|
620
630
|
'ds.addGroup': '+ 组', 'ds.addServer': '添加', 'ds.saveToken': '保存并连接', 'ds.tokenTitle': '访问令牌', 'ds.copyToken': '复制',
|
|
621
|
-
'ds.themeTitle': '皮肤', 'ds.themeDesc': '默认深空 / 落日 / 易北爱乐厅 / 草原孤塔 / 黑曜白 / 蓝色大肥鱼', 'ds.langTitle': '语言 / Language',
|
|
631
|
+
'ds.themeTitle': '皮肤', 'ds.themeDesc': '默认深空 / 落日 / 易北爱乐厅 / 草原孤塔 / 黑曜白 / 蓝色大肥鱼 / 企鹅女管·白昼 / 企鹅女管·极夜 / 波奇酱 / 伊地知虹夏 / 山田凉 / 喜多郁代', 'ds.langTitle': '语言 / Language',
|
|
622
632
|
'ds.feedbackTitle': '反馈渠道', 'ds.feedbackDesc': 'GitHub / Gitee / B站:反馈 bug、提建议、唠嗑',
|
|
623
633
|
'ds.feedback': '反馈', 'ds.feedbackGithubDesc': '反馈 bug / 提建议', 'ds.feedbackGiteeDesc': '国内镜像,无需代理',
|
|
624
634
|
'ds.feedbackDoctor': 'AI 排查问题', 'ds.feedbackDoctorDesc': '使用你的 DSH 和模型,只读诊断',
|
|
625
635
|
'ds.feedbackBiliDesc': 'UP 动态页交流', 'ds.feedbackCopyLink': '复制项目链接', 'ds.feedbackCopyDesc': '手动分享给朋友',
|
|
626
636
|
'ds.feedbackCopied': '项目链接已复制', 'ds.feedbackCopyFailed': '复制失败,请手动复制',
|
|
627
|
-
'ds.feedbackWrite': '写反馈', 'ds.feedbackWriteDesc': 'App 内直接提交', 'ds.feedbackModalTitle': '写反馈', 'ds.feedbackIncludeDiagnostics': '
|
|
637
|
+
'ds.feedbackWrite': '写反馈', 'ds.feedbackWriteDesc': 'App 内直接提交', 'ds.feedbackModalTitle': '写反馈', 'ds.feedbackIncludeDiagnostics': '附带客户端与网关诊断(可选)', 'ds.feedbackDiagnosticsPrivacy': '上传客户端操作与错误位置、存储占用、版本和网关链路状态;不含令牌、Cookie、对话正文、答案或完整路径。可在下方预览。', 'ds.feedbackIncludeCrashes': '附带崩溃日志摘要(可选)', 'ds.feedbackCrashPrivacy': '默认仅在本机记录。勾选后上传最近 3 条退出、重启和错误位置摘要,不含对话、密钥或完整路径。', 'ds.feedbackCrashPreview': '查看拟上传的日志摘要', 'ds.feedbackCrashLoading': '读取本机日志…', 'ds.feedbackCrashUnavailable': '当前网关暂时无法读取日志,请更新网关或稍后重试。',
|
|
628
638
|
'ds.feedbackTypeBug': 'Bug', 'ds.feedbackTypeSuggestion': '建议', 'ds.feedbackTypeOther': '其他',
|
|
629
|
-
'ds.feedbackMessagePlaceholder': '
|
|
639
|
+
'ds.feedbackMessagePlaceholder': '请描述遇到的问题或建议(必填,最多 20000 字符)',
|
|
630
640
|
'ds.feedbackContactPlaceholder': '联系方式(可选):邮箱 / 微信 / B站 ID',
|
|
631
641
|
'ds.feedbackCancel': '取消', 'ds.feedbackSubmit': '提交',
|
|
632
|
-
'ds.feedbackEmpty': '请填写描述内容', 'ds.feedbackTooLong': '描述不能超过
|
|
642
|
+
'ds.feedbackEmpty': '请填写描述内容', 'ds.feedbackTooLong': '描述不能超过 20000 字符,全文已保留',
|
|
633
643
|
'ds.feedbackSubmitted': '已提交,感谢反馈',
|
|
634
644
|
'ds.feedbackRateLimited': '提交太频繁,请 5 分钟后再试', 'ds.feedbackSubmitFailed': '提交失败:{msg}', 'ds.feedbackNetworkError': '网络错误',
|
|
635
645
|
'ds.questionTitle': '回答问题', 'ds.ignore': '忽略', 'ds.submit': '提交',
|
|
@@ -673,7 +683,7 @@
|
|
|
673
683
|
'ds.groupsConfirmDelete': '删除组「{group}」?组内服务器将归入默认组。', 'ds.groupsDeleted': '组已删除',
|
|
674
684
|
'ds.groupsDrawerOpen': '切换服务器组', 'ds.groupsDrawerClose': '关闭组列表', 'ds.groupsDrawerEyebrow': '快速切换', 'ds.groupsDrawerTitle': '切换服务器组', 'ds.groupsDrawerCurrent': '当前连接组',
|
|
675
685
|
'ds.groupsDrawerManage': '管理服务器与组', 'ds.groupsDrawerManageDesc': '编辑、测速和调整组', 'ds.groupsServerCount': '{count} 台服务器',
|
|
676
|
-
'ds.theme.default': '默认深空', 'ds.theme.dark': '落日', 'ds.theme.light': '易北爱乐厅', 'ds.theme.neutral': '草原孤塔', 'ds.theme.mono': '黑曜白', 'ds.theme.fish': '蓝色大肥鱼',
|
|
686
|
+
'ds.theme.default': '默认深空', 'ds.theme.dark': '落日', 'ds.theme.light': '易北爱乐厅', 'ds.theme.neutral': '草原孤塔', 'ds.theme.mono': '黑曜白', 'ds.theme.fish': '蓝色大肥鱼', 'ds.theme.penguin': '企鹅女管·白昼', 'ds.theme.penguin-night': '企鹅女管·极夜', 'ds.theme.bocchi': '波奇酱', 'ds.theme.nijika': '伊地知虹夏', 'ds.theme.ryo': '山田凉', 'ds.theme.kita': '喜多郁代',
|
|
677
687
|
'ds.role.me': '我', 'ds.role.dsh': 'DSH', 'ds.toolDefault': '工具',
|
|
678
688
|
'ds.eventSystemReminder': '系统提示',
|
|
679
689
|
'ds.questionOptions': '选项', 'ds.questionCustom': '自定义回答',
|
|
@@ -747,19 +757,19 @@
|
|
|
747
757
|
'ds.back': '‹ Back', 'ds.emptyGroup': 'No settings here',
|
|
748
758
|
'ds.serversTitle': 'Servers (groups)', 'ds.speedTest': 'Test', 'ds.currentGroup': 'Current group',
|
|
749
759
|
'ds.addGroup': '+ Group', 'ds.addServer': 'Add', 'ds.saveToken': 'Save and connect', 'ds.tokenTitle': 'Access token', 'ds.copyToken': 'Copy',
|
|
750
|
-
'ds.themeTitle': 'Theme', 'ds.themeDesc': 'Deep Space / Sunset / Elbphilharmonie / Prairie Tower / Monochrome / Blue Fat Fish', 'ds.langTitle': 'Language',
|
|
760
|
+
'ds.themeTitle': 'Theme', 'ds.themeDesc': 'Deep Space / Sunset / Elbphilharmonie / Prairie Tower / Monochrome / Blue Fat Fish / Penguin Admin Day / Penguin Admin Night / Bocchi / Nijika / Ryo / Kita', 'ds.langTitle': 'Language',
|
|
751
761
|
'ds.feedbackTitle': 'Feedback', 'ds.feedbackDesc': 'GitHub / Gitee / Bilibili: report bugs, suggest features, or just chat',
|
|
752
762
|
'ds.feedback': 'Feedback', 'ds.feedbackGithubDesc': 'Report bugs · suggest features', 'ds.feedbackGiteeDesc': 'Mirror in China, no proxy needed',
|
|
753
763
|
'ds.feedbackDoctor': 'AI diagnosis', 'ds.feedbackDoctorDesc': 'Read-only diagnosis with your own DSH and model',
|
|
754
764
|
'ds.feedbackBiliDesc': 'Chat on the UP\'s Bilibili page', 'ds.feedbackCopyLink': 'Copy project link', 'ds.feedbackCopyDesc': 'Share it manually',
|
|
755
765
|
'ds.feedbackCopied': 'Project link copied', 'ds.feedbackCopyFailed': 'Copy failed, copy manually',
|
|
756
766
|
'ds.contributors': 'Contributors', 'ds.contributorsThanks': 'Thank you to everyone who helps make DSH Remote better.', 'ds.contributorsAll': 'View all contributions ↗',
|
|
757
|
-
'ds.feedbackWrite': 'Write feedback', 'ds.feedbackWriteDesc': 'Submit from the app', 'ds.feedbackModalTitle': 'Write feedback', 'ds.feedbackIncludeDiagnostics': 'Include
|
|
767
|
+
'ds.feedbackWrite': 'Write feedback', 'ds.feedbackWriteDesc': 'Submit from the app', 'ds.feedbackModalTitle': 'Write feedback', 'ds.feedbackIncludeDiagnostics': 'Include client and gateway diagnostics (optional)', 'ds.feedbackDiagnosticsPrivacy': 'Uploads operation stages, error locations, storage sizes, versions and gateway status. No credentials, conversation bodies, answers or full paths. Preview below.', 'ds.feedbackIncludeCrashes': 'Include crash summary (optional)', 'ds.feedbackCrashPrivacy': 'Recorded locally by default. Opt in to upload up to 3 recent exit, restart and error-location records. No conversations, credentials or full paths.', 'ds.feedbackCrashPreview': 'Preview the log summary to upload', 'ds.feedbackCrashLoading': 'Reading local logs…', 'ds.feedbackCrashUnavailable': 'Logs are unavailable. Update the gateway or try again later.',
|
|
758
768
|
'ds.feedbackTypeBug': 'Bug', 'ds.feedbackTypeSuggestion': 'Suggestion', 'ds.feedbackTypeOther': 'Other',
|
|
759
|
-
'ds.feedbackMessagePlaceholder': 'Describe the bug or suggestion (required,
|
|
769
|
+
'ds.feedbackMessagePlaceholder': 'Describe the bug or suggestion (required, up to 20000 characters)',
|
|
760
770
|
'ds.feedbackContactPlaceholder': 'Contact (optional): email / WeChat / Bilibili ID',
|
|
761
771
|
'ds.feedbackCancel': 'Cancel', 'ds.feedbackSubmit': 'Submit',
|
|
762
|
-
'ds.feedbackEmpty': 'Please fill in the description', 'ds.feedbackTooLong': 'Description must be
|
|
772
|
+
'ds.feedbackEmpty': 'Please fill in the description', 'ds.feedbackTooLong': 'Description must be within 20000 characters; your text is preserved',
|
|
763
773
|
'ds.feedbackSubmitted': 'Submitted — thanks!',
|
|
764
774
|
'ds.feedbackRateLimited': 'Too frequent, try again in 5 minutes', 'ds.feedbackSubmitFailed': 'Submit failed: {msg}', 'ds.feedbackNetworkError': 'Network error',
|
|
765
775
|
'ds.questionTitle': 'Answer question', 'ds.ignore': 'Ignore', 'ds.submit': 'Submit',
|
|
@@ -803,7 +813,7 @@
|
|
|
803
813
|
'ds.groupsConfirmDelete': 'Delete group "{group}"? Its servers move to the default group.', 'ds.groupsDeleted': 'Group deleted',
|
|
804
814
|
'ds.groupsDrawerOpen': 'Switch server group', 'ds.groupsDrawerClose': 'Close group list', 'ds.groupsDrawerEyebrow': 'QUICK SWITCH', 'ds.groupsDrawerTitle': 'Switch server group', 'ds.groupsDrawerCurrent': 'Current connection group',
|
|
805
815
|
'ds.groupsDrawerManage': 'Manage servers and groups', 'ds.groupsDrawerManageDesc': 'Edit, test, and organize groups', 'ds.groupsServerCount': '{count} servers',
|
|
806
|
-
'ds.theme.default': 'Deep Space', 'ds.theme.dark': 'Sunset', 'ds.theme.light': 'Elbphilharmonie', 'ds.theme.neutral': 'Prairie Tower', 'ds.theme.mono': 'Monochrome', 'ds.theme.fish': 'Blue Fat Fish',
|
|
816
|
+
'ds.theme.default': 'Deep Space', 'ds.theme.dark': 'Sunset', 'ds.theme.light': 'Elbphilharmonie', 'ds.theme.neutral': 'Prairie Tower', 'ds.theme.mono': 'Monochrome', 'ds.theme.fish': 'Blue Fat Fish', 'ds.theme.penguin': 'Penguin Admin Day', 'ds.theme.penguin-night': 'Penguin Admin Night', 'ds.theme.bocchi': 'Bocchi', 'ds.theme.nijika': 'Nijika', 'ds.theme.ryo': 'Ryo', 'ds.theme.kita': 'Kita',
|
|
807
817
|
'ds.role.me': 'Me', 'ds.role.dsh': 'DSH', 'ds.toolDefault': 'tool',
|
|
808
818
|
'ds.eventSystemReminder': 'System reminder',
|
|
809
819
|
'ds.questionOptions': 'Options', 'ds.questionCustom': 'Custom answer',
|
|
@@ -862,6 +872,8 @@
|
|
|
862
872
|
<script src="../history.js"></script>
|
|
863
873
|
<script src="../activity.js"></script>
|
|
864
874
|
<script src="../turn-results.js"></script>
|
|
875
|
+
<script src="../image-cache.js"></script>
|
|
876
|
+
<script src="../chat-copy.js"></script>
|
|
865
877
|
<script src="../image-preview.js"></script>
|
|
866
878
|
<script src="../link-check.js"></script>
|
|
867
879
|
<script src="../network.js"></script>
|
|
@@ -877,6 +889,7 @@
|
|
|
877
889
|
<script src="../file-inbox.js"></script>
|
|
878
890
|
<link rel="stylesheet" href="../session-deck.css">
|
|
879
891
|
<script src="../session-deck.js"></script>
|
|
892
|
+
<script src="../theme.js"></script>
|
|
880
893
|
<script src="desktop.js"></script>
|
|
881
894
|
</body>
|
|
882
895
|
</html>
|
|
@@ -8,7 +8,7 @@ I18N.init(window.DESKTOP_STR)
|
|
|
8
8
|
const $ = (id) => document.getElementById(id)
|
|
9
9
|
const LS = {
|
|
10
10
|
get(k, d) { try { return localStorage.getItem(k) ?? d } catch { return d } },
|
|
11
|
-
set(k, v) { try { localStorage.setItem(k, v) } catch {} },
|
|
11
|
+
set(k, v) { try { localStorage.setItem(k, v); return true } catch(error) { try { globalThis.DshDiagnostics?.storageFailure(k,error) } catch {} return false } },
|
|
12
12
|
del(k) { try { localStorage.removeItem(k) } catch {} }
|
|
13
13
|
}
|
|
14
14
|
const CLIENT_ID = (() => {
|
|
@@ -33,7 +33,13 @@ const THEME_META = [
|
|
|
33
33
|
{ id: 'light', sw: ['#F5F7F8', '#FFFFFF', '#176B87'] },
|
|
34
34
|
{ id: 'neutral', sw: ['#EEF1E8', '#FAFBF6', '#47643C'] },
|
|
35
35
|
{ id: 'mono', sw: ['#050505', '#333333', '#F5F5F5'] },
|
|
36
|
-
{ id: 'fish', sw: ['#EAF6FF', '#FFFFFF', '#2F52D0'] }
|
|
36
|
+
{ id: 'fish', sw: ['#EAF6FF', '#FFFFFF', '#2F52D0'] },
|
|
37
|
+
{ id: 'penguin', sw: ['#EDF3FA', '#FFFFFF', '#2B6CB0'] },
|
|
38
|
+
{ id: 'penguin-night', sw: ['#10151B', '#1A222C', '#F2C230'] },
|
|
39
|
+
{ id: 'bocchi', sw: ['#FFD9E8', '#FFFFFF', '#D0105A'] },
|
|
40
|
+
{ id: 'nijika', sw: ['#FFF3D5', '#FFFFFF', '#94600C'] },
|
|
41
|
+
{ id: 'ryo', sw: ['#E9F1FA', '#FFFFFF', '#315D91'] },
|
|
42
|
+
{ id: 'kita', sw: ['#FFE9E5', '#FFFFFF', '#B6373C'] }
|
|
37
43
|
]
|
|
38
44
|
function themeGet() {
|
|
39
45
|
const v = LS.get('dshTheme', '')
|
|
@@ -117,6 +123,7 @@ for (const key of ['server', 'token']) {
|
|
|
117
123
|
if (next === value) return
|
|
118
124
|
cancelHistoryLoad()
|
|
119
125
|
value = next; connectionGeneration++
|
|
126
|
+
window.DshImagePreview?.reset?.()
|
|
120
127
|
clearTimeout(state.refreshTimer); state.refreshTimer = null
|
|
121
128
|
state.sessions = []; state.byId.clear(); state.pendingProjections.clear(); state.runtimeErrors = new Map()
|
|
122
129
|
state.hostInfo = null
|
|
@@ -527,6 +534,7 @@ function openFeedbackModal() {
|
|
|
527
534
|
$('fb-include-diagnostics').checked = false
|
|
528
535
|
$('fb-include-crashes').checked = false
|
|
529
536
|
$('fb-crash-details').open = false
|
|
537
|
+
updateFeedbackLength()
|
|
530
538
|
void loadCrashPreview()
|
|
531
539
|
$('modal-feedback').classList.remove('hidden')
|
|
532
540
|
setTimeout(() => $('fb-msg').focus(), 50)
|
|
@@ -651,14 +659,22 @@ async function checkNotesOnStart() {
|
|
|
651
659
|
} catch {}
|
|
652
660
|
}
|
|
653
661
|
async function loadCrashPreview() {
|
|
662
|
+
const generation=loadCrashPreview.generation=(loadCrashPreview.generation||0)+1
|
|
654
663
|
const connection=captureConnection(),preview=$('fb-crash-preview')
|
|
655
664
|
preview.textContent=t('ds.feedbackCrashLoading')
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
665
|
+
const selected=$('fb-include-diagnostics').checked,crashes=$('fb-include-crashes').checked
|
|
666
|
+
if(!selected&&!crashes){preview.textContent=I18N.lang==='en'?'Select a log option above to preview the attachment.':'勾选上方日志选项后,可在这里预览拟上传的附件。';return}
|
|
667
|
+
const read=async route=>{try{const response=await fetch(apiUrl(route),{headers:{authorization:'Bearer '+connection.token},signal:AbortSignal.timeout(5000),cache:'no-store'});if(!response.ok)throw Error();return await response.json()}catch{return {unavailable:true}}}
|
|
668
|
+
const evidence={}
|
|
669
|
+
if(selected){evidence.client=globalThis.DshDiagnostics?.report();evidence.gateway=await read('/diagnostics')}
|
|
670
|
+
if(crashes){const data=await read('/crash-logs');evidence.crashes=data.upload||data}
|
|
671
|
+
if(connection.valid()&&generation===loadCrashPreview.generation)preview.textContent=JSON.stringify(evidence,null,2)
|
|
672
|
+
}
|
|
673
|
+
function updateFeedbackLength() {
|
|
674
|
+
const length = $('fb-msg').value.trim().length, over = length > 20000
|
|
675
|
+
$('fb-length').textContent = I18N.lang === 'en' ? length + ' / 20000 characters' + (over ? ' — shorten before submitting; your text is preserved.' : '') : length + ' / 20000 字符' + (over ? ',请精简后提交;全文已保留。' : '')
|
|
676
|
+
$('fb-msg').setAttribute('aria-invalid', String(over))
|
|
677
|
+
$('fb-copy-draft').textContent = I18N.lang === 'en' ? 'Copy text' : '复制全文'
|
|
662
678
|
}
|
|
663
679
|
async function submitFeedback() {
|
|
664
680
|
const type = document.querySelector('#fb-chips .ds-fb-chip.current')?.dataset.fbType || 'bug'
|
|
@@ -666,8 +682,9 @@ async function submitFeedback() {
|
|
|
666
682
|
const contact = $('fb-contact').value.trim()
|
|
667
683
|
const includeDiagnostics = $('fb-include-diagnostics').checked
|
|
668
684
|
const includeCrashLogs = $('fb-include-crashes').checked
|
|
685
|
+
const clientDiagnostics=includeDiagnostics?globalThis.DshDiagnostics?.report():null
|
|
669
686
|
if (!message) { toast(t('ds.feedbackEmpty'), 'err'); return }
|
|
670
|
-
if (message.length >
|
|
687
|
+
if (message.length > 20000) { toast(t('ds.feedbackTooLong'), 'err'); return }
|
|
671
688
|
const btn = $('fb-submit')
|
|
672
689
|
btn.disabled = true
|
|
673
690
|
const diagnostic=globalThis.DshDiagnostics?.start('feedback.submit')
|
|
@@ -675,17 +692,25 @@ async function submitFeedback() {
|
|
|
675
692
|
const res = await fetch(apiUrl('/feedback'), {
|
|
676
693
|
method: 'POST',
|
|
677
694
|
headers: { 'content-type': 'application/json', authorization: 'Bearer ' + state.token },
|
|
678
|
-
body: JSON.stringify({ type, message, contact, appVersion: '', includeDiagnostics, includeCrashLogs })
|
|
695
|
+
body: JSON.stringify({ type, message, contact, appVersion: clientDiagnostics?.client.version||'', includeDiagnostics, includeCrashLogs,...(clientDiagnostics?{clientDiagnostics}:{}) })
|
|
679
696
|
})
|
|
680
697
|
diagnostic?.end({phase:res.ok?'complete':'failed',httpStatus:res.status})
|
|
681
698
|
let json = {}
|
|
682
699
|
try { json = await res.json() } catch {}
|
|
683
|
-
if (res.ok && json.ok) {
|
|
700
|
+
if (res.ok && json.ok) { closeFeedbackModal()
|
|
701
|
+
const saved=json.diagnostics?.saved===true&&json.diagnostics.reportId===clientDiagnostics?.reportId
|
|
702
|
+
toast(clientDiagnostics&&!saved?(I18N.lang==='en'?'Feedback received; complete diagnostic report not confirmed. Copy or export the local log.':'反馈已收到,但完整诊断日志未获保存确认,请复制或导出本地日志补充。'):t('ds.feedbackSubmitted'),clientDiagnostics&&!saved?'err':'ok')
|
|
703
|
+
}
|
|
684
704
|
else if (res.status === 429) { toast(t('ds.feedbackRateLimited'), 'err') }
|
|
705
|
+
else if (json.error === 'message too long' && Number.isSafeInteger(json.max)) { toast(I18N.lang === 'en' ? 'This gateway limits feedback to ' + json.max + ' characters. Your full text is preserved; update the host gateway.' : '当前网关正文上限为 ' + json.max + ' 字符,全文已保留;请更新主机网关。', 'err') }
|
|
706
|
+
else if (json.error === 'collector-message-limit') { toast(I18N.lang === 'en' ? 'The collector still limits feedback to ' + json.max + ' characters. Your full text is preserved; copy it before updating the collector.' : '收集器仍只支持 ' + json.max + ' 字符,全文已保留;可先复制全文,待收集器升级后再提交。', 'err') }
|
|
707
|
+
else if (json.error === 'collector-body-limit') { toast(I18N.lang === 'en' ? 'The collector rejected the request size. Your full text is preserved; copy it before updating the collector.' : '收集器请求体超限,全文已保留;请先复制,待收集器升级后再提交。', 'err') }
|
|
708
|
+
else if (json.error === 'feedback_service_unavailable') { toast(I18N.lang === 'en' ? 'Delivery is unconfirmed; it may have been received. Your text is preserved. Check before resubmitting.' : '发送结果未确认,可能已收到。全文已保留,请先核对,勿重复提交。', 'err') }
|
|
709
|
+
else if (json.error === 'feedback-content-unconfirmed') { toast(I18N.lang === 'en' ? 'The content receipt did not match. It may have been received; check before resubmitting. Your text is preserved.' : '正文保存回执不一致,可能已收到;请先核对,勿重复提交。全文已保留。', 'err') }
|
|
685
710
|
else { toast(t('ds.feedbackSubmitFailed', { msg: json.error || res.status }), 'err') }
|
|
686
711
|
} catch(error) {
|
|
687
712
|
diagnostic?.fail(error)
|
|
688
|
-
toast(
|
|
713
|
+
toast(I18N.lang === 'en' ? 'Delivery is unconfirmed; it may have been received. Your text is preserved. Check before resubmitting.' : '发送结果未确认,可能已收到。全文已保留,请先核对,勿重复提交。', 'err')
|
|
689
714
|
} finally {
|
|
690
715
|
btn.disabled = false
|
|
691
716
|
}
|
|
@@ -1230,6 +1255,8 @@ function editServer(id) {
|
|
|
1230
1255
|
function removeServer(id) {
|
|
1231
1256
|
const s = state.servers.find(x => x.id === id)
|
|
1232
1257
|
if (!s) return
|
|
1258
|
+
void window.DshImageCache?.clear(historyCacheScope(s.url,serverToken(s)))
|
|
1259
|
+
void window.DshHistory.cacheClear(historyCacheScope(s.url,serverToken(s)))
|
|
1233
1260
|
state.servers = state.servers.filter(x => x.id !== id)
|
|
1234
1261
|
const wasActive = state.server === s.url && state.token === serverToken(s)
|
|
1235
1262
|
for (const g of state.groups) if (state.groupActive[g] === id) state.groupActive[g] = ''
|
|
@@ -2190,7 +2217,11 @@ function restoreCachedSessionList() {
|
|
|
2190
2217
|
}
|
|
2191
2218
|
|
|
2192
2219
|
let conversationView = null
|
|
2193
|
-
function historyCacheScope() { const hash=new SHA256();hash.update(new TextEncoder().encode(JSON.stringify([
|
|
2220
|
+
function historyCacheScope(server=state.server,token=state.token) { const hash=new SHA256();hash.update(new TextEncoder().encode(JSON.stringify([server||location.origin,token])));return 'historyCacheV2:'+hash.hex() }
|
|
2221
|
+
function captureChatImage() {
|
|
2222
|
+
const connection=captureConnection(),sessionId=state.current
|
|
2223
|
+
return {scope:historyCacheScope(),valid:()=>connection.valid()&&state.current===sessionId}
|
|
2224
|
+
}
|
|
2194
2225
|
function historySource(value) {
|
|
2195
2226
|
state.history.source=value
|
|
2196
2227
|
const el=$('history-source')
|
|
@@ -2414,7 +2445,8 @@ function blockHtml(b,index=0,context={}) {
|
|
|
2414
2445
|
if (b.type==='thinking'||b.type==='reasoning') return window.DshActivity.reasoning({text:b.text??b.content??'',key:window.DshActivity.reasoningKey(context,index,key)})
|
|
2415
2446
|
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)})})
|
|
2416
2447
|
}
|
|
2417
|
-
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') }) : esc(b.text ?? '')}</div>` : ''
|
|
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>`
|
|
2418
2450
|
if (b.type === 'file' && typeof window !== 'undefined' && window.DshChatFiles) return window.DshChatFiles.render(b)
|
|
2419
2451
|
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>`
|
|
2420
2452
|
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>`
|
|
@@ -2470,7 +2502,7 @@ function eventHtml(entry) {
|
|
|
2470
2502
|
if (type === 'user/message' && !isHumanUserMessage(ev)) return ''
|
|
2471
2503
|
const text = blocks.map((block,index)=>blockHtml(block,index,{...data,seq:entry.seq,suppressBlockTools:state.history.suppressBlockTools})).join('')
|
|
2472
2504
|
if (!text) return ''
|
|
2473
|
-
return `<div class="ds-msg ${esc(role)}"><div class="role">${esc(role === 'user' ? t('ds.role.me') : t('ds.role.dsh'))}</div>${text}</div>`
|
|
2505
|
+
return `<div class="ds-msg ${esc(role)}"><div class="role">${esc(role === 'user' ? t('ds.role.me') : t('ds.role.dsh'))}${blocks.some(block => block?.type === 'text' && String(block.text ?? '').trim()) ? window.DshChatCopy?.button(entry.seq, state.history) || '' : ''}</div>${text}</div>`
|
|
2474
2506
|
}
|
|
2475
2507
|
if (type === 'tool/call') {
|
|
2476
2508
|
const name = data.name || data.toolName || t('ds.toolDefault')
|
|
@@ -2495,6 +2527,10 @@ function canForkTurnResult() {
|
|
|
2495
2527
|
return !!session && session.origin !== 'subagent' && session.formatStatus !== 'migration-required' && activeGatewayCapability('operations') === true
|
|
2496
2528
|
}
|
|
2497
2529
|
function bindTurnResultActions() {
|
|
2530
|
+
window.DshChatCopy?.bind($('history'), {
|
|
2531
|
+
capture: () => { const connection = captureConnection(), sessionId = state.current, history = state.history; return { history, valid: () => connection.valid() && state.current === sessionId && state.history === history } },
|
|
2532
|
+
copy: copyText, notice: toast,
|
|
2533
|
+
})
|
|
2498
2534
|
window.DshTurnResults.bind($('history'), {
|
|
2499
2535
|
capture: () => {
|
|
2500
2536
|
const connection = captureConnection(), sessionId = state.current, history = state.history
|
|
@@ -4299,6 +4335,10 @@ function bindUi() {
|
|
|
4299
4335
|
$('btn-doctor').addEventListener('click', openDoctor)
|
|
4300
4336
|
$('fb-cancel').addEventListener('click', closeFeedbackModal)
|
|
4301
4337
|
$('fb-submit').addEventListener('click', submitFeedback)
|
|
4338
|
+
$('fb-msg').addEventListener('input', updateFeedbackLength)
|
|
4339
|
+
$('fb-copy-draft').addEventListener('click', async () => { const ok = await copyText($('fb-msg').value); toast(I18N.lang === 'en' ? (ok ? 'Copied' : 'Copy failed') : (ok ? '已复制全文' : '复制失败,请重试'), ok ? 'ok' : 'err') })
|
|
4340
|
+
$('fb-include-diagnostics').addEventListener('change',()=>{void loadCrashPreview()})
|
|
4341
|
+
$('fb-include-crashes').addEventListener('change',()=>{void loadCrashPreview()})
|
|
4302
4342
|
document.querySelectorAll('#fb-chips .ds-fb-chip').forEach(btn =>
|
|
4303
4343
|
btn.addEventListener('click', () => {
|
|
4304
4344
|
document.querySelectorAll('#fb-chips .ds-fb-chip').forEach(b => b.classList.toggle('current', b === btn))
|
|
@@ -4362,9 +4402,10 @@ function bindUi() {
|
|
|
4362
4402
|
if (event.key === 'Enter' && !event.isComposing) { event.preventDefault(); void saveAccessTokenDesktop() }
|
|
4363
4403
|
})
|
|
4364
4404
|
$('btn-theme').addEventListener('click', () => {
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4405
|
+
window.DSHTheme.openPicker({
|
|
4406
|
+
themes: THEME_META, current: themeGet(), label: id => t('ds.theme.' + id),
|
|
4407
|
+
lang: I18N.lang, onSelect: themeSet
|
|
4408
|
+
})
|
|
4368
4409
|
})
|
|
4369
4410
|
$('btn-lang').addEventListener('click', () => {
|
|
4370
4411
|
I18N.setLang(I18N.lang === 'zh' ? 'en' : 'zh')
|
|
@@ -4418,7 +4459,7 @@ async function start() {
|
|
|
4418
4459
|
}
|
|
4419
4460
|
$('token-desc').textContent = state.token ? '● ' + state.token.slice(0, 12) + '…' : t('ds.toastAuth')
|
|
4420
4461
|
bindUi()
|
|
4421
|
-
window.DshImagePreview?.configure?.({ resolvePath: chatImageRequest, resolveAttachment: chatImageAttachment })
|
|
4462
|
+
window.DshImagePreview?.configure?.({ resolvePath: chatImageRequest, resolveAttachment: chatImageAttachment, capture: captureChatImage })
|
|
4422
4463
|
if (!state.token) { showView('view-settings'); $('desktop-token-input').focus() }
|
|
4423
4464
|
renderWorkbench()
|
|
4424
4465
|
updateConn()
|
|
@@ -4463,16 +4504,27 @@ function mountWorkflowDesktop() {
|
|
|
4463
4504
|
approvalRecords: renderApprovalRecordsDesktop,
|
|
4464
4505
|
clearApprovalRecords: resetApprovalRecords,
|
|
4465
4506
|
clear:async kind=>{
|
|
4466
|
-
const
|
|
4507
|
+
const en=window.I18N?.lang==='en'
|
|
4508
|
+
const messages={history:en?'Clear cached history? Host records will be kept.':'清除本机历史缓存?主机记录保留。',images:en?'Clear cached images? Images will download again when viewed.':'清除本机图片缓存?再次查看时会重新下载。',caches:en?'Clear history and image caches? Connections and preferences will be kept.':'清除本机历史和图片缓存?保留连接、凭证与偏好设置。',connection:en?'Remove this connection, credential and its caches?':'移除当前地址、保存的凭证及其缓存?其他连接条目保留。',all:en?'Clear all local Remote settings, credentials and caches?':'清除本机全部 Remote 配置、凭证与缓存?主机数据保留。'}
|
|
4509
|
+
const text=messages[kind]
|
|
4467
4510
|
if(!confirm(text))return
|
|
4468
4511
|
clearTimeout(scheduleHistoryCacheSave._t)
|
|
4469
4512
|
if(kind==='connection'){
|
|
4513
|
+
const connection=captureConnection(),scope=historyCacheScope()
|
|
4514
|
+
cancelHistoryLoad()
|
|
4515
|
+
await window.DshImageCache.clear(scope);await window.DshHistory.cacheClear(scope)
|
|
4516
|
+
if(!connection.valid())return
|
|
4470
4517
|
const current=currentServerEntry();if(current)state.servers=state.servers.filter(s=>s.id!==current.id)
|
|
4471
4518
|
state.groupActive[state.activeGroup]='';state.token='';state.server='';LS.del('token');LS.del('server');saveServers()
|
|
4472
4519
|
closeStream('mux');closeStream('host');stopPolling();renderServers();showView('view-settings');showSettingsPage('servers');return
|
|
4473
4520
|
}
|
|
4474
|
-
|
|
4475
|
-
if(kind
|
|
4521
|
+
const results=[]
|
|
4522
|
+
if(kind!=='images')cancelHistoryLoad()
|
|
4523
|
+
if(kind!=='images')results.push(await window.DshHistory.cacheClear())
|
|
4524
|
+
if(kind!=='history')results.push(await window.DshImageCache.clear())
|
|
4525
|
+
if(kind==='all'){window.DshWorkflow.clearStorage();location.reload()}
|
|
4526
|
+
else if(results.includes(false))toast(en?'Some caches could not be cleared. Retry shortly.':'部分缓存未能清除,请稍后重试。','err')
|
|
4527
|
+
else toast(en?'Cache cleared':'缓存已清除','ok')
|
|
4476
4528
|
},
|
|
4477
4529
|
recover:(row,receipt)=>{const value=receipt.result?.result?.value;if(row.method==='session.create'&&value?.sessionId)void openSession(value.sessionId);if(row.sessionId===state.current)void resyncCurrentSession()},
|
|
4478
4530
|
})
|