dsh-remote-plugin 0.5.7 → 0.5.9
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.en.md +2 -0
- package/README.md +2 -0
- package/apk/dsh-remote.apk +0 -0
- package/gateway.cjs +119 -0
- package/package.json +1 -1
- package/public/admin.html +91 -15
- package/public/admin.js +26 -0
- package/public/app.js +466 -44
- package/public/desktop/desktop.css +270 -0
- package/public/desktop/desktop.html +328 -0
- package/public/desktop/desktop.js +1027 -0
- package/public/desktop/i18n.js +53 -0
- package/public/index.html +146 -3
- package/public/styles.css +100 -351
- package/public/theme-vars.css +351 -0
- package/public/update.json +3 -3
- package/public/version.json +1 -1
package/README.en.md
CHANGED
|
@@ -29,6 +29,7 @@ dsh plugin --profile web add "github:Blank-not-black/dsh-Remote#main&path:/packa
|
|
|
29
29
|
- Token lives in `~/.dsh-remote/token` (auto-generated on first run, reused and never overwritten), shown in the drawer and copyable; supports **QR pairing** and **one-click rotation**.
|
|
30
30
|
- Env var `DSH_REMOTE_AUTOSTART=0` disables auto management.
|
|
31
31
|
- File endpoints: `/fs/list` (list directory), `/fs/file` (download with Range support), `/fs/upload` (chunked resume with pause/cancel, SHA-256 verified before writing to disk); default root is `~`, and `DSH_REMOTE_FS_ROOT` opens multiple roots (`:`-separated).
|
|
32
|
+
- Feedback endpoint: `POST /feedback` (the app / desktop "Write feedback" dialog), forwarded by the gateway to the feedback collector; default `http://100.84.128.29/submit` (Tailscale internal network), overridable via `DSH_REMOTE_FEEDBACK_URL` — no tokens to configure.
|
|
32
33
|
|
|
33
34
|
## Mobile App
|
|
34
35
|
|
|
@@ -37,6 +38,7 @@ The app is embedded in the plugin package (`apk/dsh-remote.apk`) — install the
|
|
|
37
38
|
- Tap **QR code** in the desktop drawer → scan it with the phone to open the admin page → download the app from that page
|
|
38
39
|
- Or open `http://<gateway-IP>:8787` in a browser to download
|
|
39
40
|
- App updates are pushed by the gateway too (`update.json` relative path), never touching GitHub
|
|
41
|
+
- A desktop browser opening `http://<gateway-IP>:8787` auto-enters the desktop WebUI (sidebar sessions + files + settings + stats + approval notification stack)
|
|
40
42
|
|
|
41
43
|
The app has built-in multi-server latency switching and offline chat history caching; downloaded files are stored in the system `Download/dsh-remote` folder.
|
|
42
44
|
|
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ dsh plugin --profile web add "github:Blank-not-black/dsh-Remote#main&path:/packa
|
|
|
29
29
|
- 令牌在 `~/.dsh-remote/token`(首次自动生成,重复使用不覆盖),抽屉里显示并可复制;支持**二维码扫码配对**与**一键轮换**。
|
|
30
30
|
- 环境变量 `DSH_REMOTE_AUTOSTART=0` 可关闭自动管理。
|
|
31
31
|
- 文件端点:`/fs/list`(列目录)、`/fs/file`(下载,支持 Range)、`/fs/upload`(分块续传,支持暂停/取消,落盘前 SHA-256 校验);默认根目录 `~`,`DSH_REMOTE_FS_ROOT` 可开多根(`:` 分隔)。
|
|
32
|
+
- 反馈端点:`POST /feedback`(App / 桌面端「写反馈」),网关转发到反馈收集器;默认 `http://100.84.128.29/submit`(Tailscale 内网),可用 `DSH_REMOTE_FEEDBACK_URL` 覆盖,无需配置任何 token。
|
|
32
33
|
|
|
33
34
|
## 手机 App
|
|
34
35
|
|
|
@@ -37,6 +38,7 @@ App 已随插件包内嵌(`apk/dsh-remote.apk`),装好插件即可获取
|
|
|
37
38
|
- 桌面抽屉点「二维码」→ 手机扫码打开管理页 → 页面提供 App 下载
|
|
38
39
|
- 或浏览器直接访问 `http://<网关IP>:8787` 下载
|
|
39
40
|
- App 更新同样走网关自动推送(`update.json` 相对路径),全程不绕 GitHub
|
|
41
|
+
- 电脑浏览器打开 `http://<网关IP>:8787` 自动进入桌面端 WebUI(侧栏会话 + 文件 + 设置 + 统计 + 审批通知卡片栈)
|
|
40
42
|
|
|
41
43
|
App 内置多服务器测速切换与聊天记录离线缓存,下载文件统一放系统「下载/dsh-remote」。
|
|
42
44
|
|
package/apk/dsh-remote.apk
CHANGED
|
Binary file
|
package/gateway.cjs
CHANGED
|
@@ -493,6 +493,124 @@ function serveStats(req, res, url) {
|
|
|
493
493
|
res.end(JSON.stringify({ error: 'not found' }))
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
// ---------- 反馈提交 ----------
|
|
497
|
+
const feedbackThrottle = new Map() // ip -> 上次受理时间戳
|
|
498
|
+
const FEEDBACK_WINDOW_MS = 60 * 1000
|
|
499
|
+
// 反馈收集器: 环境变量可覆盖, 默认 Tailscale 内网地址
|
|
500
|
+
const FEEDBACK_URL = process.env.DSH_REMOTE_FEEDBACK_URL || 'http://100.84.128.29/submit'
|
|
501
|
+
|
|
502
|
+
function maskIp(ip) {
|
|
503
|
+
if (!ip) return 'unknown'
|
|
504
|
+
const s = String(ip).replace(/^::ffff:/, '')
|
|
505
|
+
if (s.includes(':')) {
|
|
506
|
+
const groups = s.split(':').filter(Boolean)
|
|
507
|
+
return (groups.slice(0, 2).join(':') || '::') + '::x'
|
|
508
|
+
}
|
|
509
|
+
const parts = s.split('.')
|
|
510
|
+
if (parts.length === 4) return parts.slice(0, 3).join('.') + '.x'
|
|
511
|
+
return s
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function serveFeedback(req, res, url) {
|
|
515
|
+
cors(res)
|
|
516
|
+
if (req.method === 'OPTIONS') {
|
|
517
|
+
res.writeHead(204)
|
|
518
|
+
res.end()
|
|
519
|
+
return
|
|
520
|
+
}
|
|
521
|
+
if (req.method !== 'POST') {
|
|
522
|
+
res.writeHead(405, { 'content-type': 'application/json; charset=utf-8' })
|
|
523
|
+
res.end(JSON.stringify({ error: 'method not allowed' }))
|
|
524
|
+
return
|
|
525
|
+
}
|
|
526
|
+
if (!authorized(req, url)) {
|
|
527
|
+
authFailures++
|
|
528
|
+
touchDevice(req, { failedAuth: true })
|
|
529
|
+
res.writeHead(401, { 'content-type': 'application/json; charset=utf-8' })
|
|
530
|
+
res.end(JSON.stringify({ error: 'unauthorized' }))
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
touchDevice(req)
|
|
534
|
+
|
|
535
|
+
let body = ''
|
|
536
|
+
req.on('data', c => { body += c; if (body.length > 16 * 1024) req.destroy() })
|
|
537
|
+
req.on('end', () => {
|
|
538
|
+
let payload
|
|
539
|
+
try {
|
|
540
|
+
payload = JSON.parse(body || '{}')
|
|
541
|
+
} catch {
|
|
542
|
+
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
543
|
+
res.end(JSON.stringify({ error: 'invalid json' }))
|
|
544
|
+
return
|
|
545
|
+
}
|
|
546
|
+
const type = payload.type
|
|
547
|
+
const message = String(payload.message || '').trim()
|
|
548
|
+
const contact = String(payload.contact || '').trim()
|
|
549
|
+
const appVersion = String(payload.appVersion || '').trim()
|
|
550
|
+
if (!['bug', 'suggestion', 'other'].includes(type)) {
|
|
551
|
+
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
552
|
+
res.end(JSON.stringify({ error: 'invalid type', expect: 'bug|suggestion|other' }))
|
|
553
|
+
return
|
|
554
|
+
}
|
|
555
|
+
if (!message) {
|
|
556
|
+
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
557
|
+
res.end(JSON.stringify({ error: 'message required' }))
|
|
558
|
+
return
|
|
559
|
+
}
|
|
560
|
+
if (message.length > 2000) {
|
|
561
|
+
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
562
|
+
res.end(JSON.stringify({ error: 'message too long', max: 2000 }))
|
|
563
|
+
return
|
|
564
|
+
}
|
|
565
|
+
if (contact.length > 200) {
|
|
566
|
+
res.writeHead(400, { 'content-type': 'application/json; charset=utf-8' })
|
|
567
|
+
res.end(JSON.stringify({ error: 'contact too long', max: 200 }))
|
|
568
|
+
return
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const ip = ipOf(req)
|
|
572
|
+
const now = Date.now()
|
|
573
|
+
const last = feedbackThrottle.get(ip) || 0
|
|
574
|
+
if (now - last < FEEDBACK_WINDOW_MS) {
|
|
575
|
+
res.writeHead(429, { 'content-type': 'application/json; charset=utf-8', 'retry-after': String(Math.ceil((FEEDBACK_WINDOW_MS - (now - last)) / 1000)) })
|
|
576
|
+
res.end(JSON.stringify({ error: 'rate_limited', retryAfter: Math.ceil((FEEDBACK_WINDOW_MS - (now - last)) / 1000) }))
|
|
577
|
+
return
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// 转发收集器(收集器服务端已做校验/节流/落盘)。节流只在收集器确认成功后占位,
|
|
581
|
+
// 失败(429/502/网络错误)不占位, 用户可立即重试。
|
|
582
|
+
fetch(FEEDBACK_URL, {
|
|
583
|
+
method: 'POST',
|
|
584
|
+
headers: { 'content-type': 'application/json' },
|
|
585
|
+
body: JSON.stringify({
|
|
586
|
+
type,
|
|
587
|
+
message,
|
|
588
|
+
contact: contact || undefined,
|
|
589
|
+
appVersion: appVersion || 'unknown',
|
|
590
|
+
gatewayVersion: VERSION,
|
|
591
|
+
clientIp: maskIp(ip)
|
|
592
|
+
}),
|
|
593
|
+
signal: AbortSignal.timeout(8000)
|
|
594
|
+
}).then(async (r) => {
|
|
595
|
+
const data = await r.json().catch(() => ({}))
|
|
596
|
+
if (r.status === 429) {
|
|
597
|
+
res.writeHead(429, { 'content-type': 'application/json; charset=utf-8' })
|
|
598
|
+
res.end(JSON.stringify({ error: 'rate_limited' }))
|
|
599
|
+
} else if (r.ok && data.ok) {
|
|
600
|
+
feedbackThrottle.set(ip, now)
|
|
601
|
+
res.writeHead(200, { 'content-type': 'application/json; charset=utf-8' })
|
|
602
|
+
res.end(JSON.stringify({ ok: true }))
|
|
603
|
+
} else {
|
|
604
|
+
res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
605
|
+
res.end(JSON.stringify({ error: 'upstream_error' }))
|
|
606
|
+
}
|
|
607
|
+
}).catch(() => {
|
|
608
|
+
res.writeHead(502, { 'content-type': 'application/json; charset=utf-8' })
|
|
609
|
+
res.end(JSON.stringify({ error: 'feedback_service_unavailable' }))
|
|
610
|
+
})
|
|
611
|
+
})
|
|
612
|
+
}
|
|
613
|
+
|
|
496
614
|
// ---------- 静态文件 ----------
|
|
497
615
|
function serveStatic(req, res, url) {
|
|
498
616
|
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
@@ -1427,6 +1545,7 @@ const server = http.createServer((req, res) => {
|
|
|
1427
1545
|
try {
|
|
1428
1546
|
const url = new URL(req.url, 'http://dsh-remote.local')
|
|
1429
1547
|
if (url.pathname === '/fs' || url.pathname.startsWith('/fs/')) return serveFs(req, res, url)
|
|
1548
|
+
if (url.pathname === '/feedback') return serveFeedback(req, res, url)
|
|
1430
1549
|
if (url.pathname.startsWith('/admin/api')) return serveAdminApi(req, res, url)
|
|
1431
1550
|
if (url.pathname.startsWith('/stats')) return serveStats(req, res, url)
|
|
1432
1551
|
if (url.pathname.startsWith('/api/')) return proxyApi(req, res, url)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-remote-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "DSH Remote 官方 bundle 插件:DSH 左侧原生边栏入口 + 右侧抽屉内嵌管理控制台;内置网关随 DSH 自动启停(systemd 独立单元),抽屉直显令牌与设备监控;网关提供 /fs/* 文件传输端点(列表/断点下载/上传),配合 Android App 远程操控会话/审批/提问/goal 与文件互传(多服务器测速切换、聊天记录离线缓存)。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
package/public/admin.html
CHANGED
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
<link rel="stylesheet" href="../styles.css">
|
|
10
10
|
<style>
|
|
11
11
|
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px 40px; }
|
|
12
|
-
.admin-title {
|
|
12
|
+
.admin-title {
|
|
13
|
+
position: sticky; top: 0; z-index: 40;
|
|
14
|
+
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
15
|
+
margin-bottom: 14px; padding: 10px 0;
|
|
16
|
+
background: var(--dsr-bg); /* 实色背景: 滚动时内容不穿透, 不用毛玻璃(小米/MIUI WebView 图层丢花屏) */
|
|
17
|
+
backdrop-filter: none;
|
|
18
|
+
}
|
|
13
19
|
.admin-title h1 { font-size: 20px; margin: 0; white-space: nowrap; }
|
|
14
20
|
.login-card { background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius); padding: 16px; display: flex; gap: 8px; }
|
|
15
21
|
.login-card input { flex: 1; background: var(--dsr-bg); color: var(--dsr-text); border: 1px solid var(--dsr-line); border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; }
|
|
@@ -78,7 +84,6 @@
|
|
|
78
84
|
@media (max-width: 720px) {
|
|
79
85
|
.admin-title h1 { font-size: 16px; }
|
|
80
86
|
.admin-title .right { gap: 6px; }
|
|
81
|
-
.gh-btn { display: none; }
|
|
82
87
|
#btn-close-drawer span { display: none; }
|
|
83
88
|
#btn-close-drawer { padding: 5px 9px; }
|
|
84
89
|
#btn-console span { display: none; }
|
|
@@ -109,34 +114,100 @@
|
|
|
109
114
|
a.mini-btn { text-decoration: none; display: inline-flex; align-items: center; }
|
|
110
115
|
.gh-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--dsr-text); }
|
|
111
116
|
.gh-btn svg { width: 16px; height: 16px; fill: currentColor; }
|
|
112
|
-
.admin-title .
|
|
113
|
-
|
|
117
|
+
.admin-title .left { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
|
|
118
|
+
.admin-title .right { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; justify-content: flex-end; }
|
|
119
|
+
/* 顶栏按钮统一高度/基线: GitHub / 反馈 / 主题 / 语言 / 连接徽章 */
|
|
120
|
+
.tb-btn {
|
|
121
|
+
height: 36px; box-sizing: border-box; max-width: 100%;
|
|
122
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
123
|
+
padding: 0 12px; line-height: 1; vertical-align: middle;
|
|
124
|
+
flex-shrink: 0; white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
.tb-btn svg { flex-shrink: 0; }
|
|
127
|
+
.conn-badge.tb-btn { border-radius: 999px; font-size: 12px; }
|
|
128
|
+
.fb-wrap { position: relative; flex-shrink: 0; }
|
|
129
|
+
.fb-btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
|
|
130
|
+
.fb-btn svg { width: 17px; height: 17px; }
|
|
131
|
+
.fb-menu {
|
|
132
|
+
position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
|
|
133
|
+
width: 248px; background: var(--dsr-bg-2); border: 1px solid var(--dsr-line); border-radius: 14px;
|
|
134
|
+
box-shadow: 0 12px 34px var(--dsr-shadow); padding: 6px;
|
|
135
|
+
display: flex; flex-direction: column; gap: 2px;
|
|
136
|
+
animation: fb-in .18s ease;
|
|
137
|
+
}
|
|
138
|
+
.fb-item {
|
|
139
|
+
min-height: 44px; display: flex; align-items: center; gap: 10px;
|
|
140
|
+
padding: 7px 8px; border-radius: 10px; border: none; background: transparent; color: var(--dsr-text);
|
|
141
|
+
font: inherit; font-size: 13px; text-align: left; cursor: pointer; text-decoration: none;
|
|
142
|
+
}
|
|
143
|
+
.fb-item:hover, .fb-item:focus-visible { background: var(--dsr-bg); outline: none; }
|
|
144
|
+
.fb-item.primary { background: var(--dsr-accent-soft); border: 1px solid var(--dsr-accent-line); }
|
|
145
|
+
.fb-ico {
|
|
146
|
+
width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
|
|
147
|
+
display: grid; place-items: center; background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-accent-strong);
|
|
148
|
+
}
|
|
149
|
+
.fb-item.primary .fb-ico { background: var(--dsr-accent-strong); border-color: var(--dsr-accent-strong); color: var(--dsr-on-accent); }
|
|
150
|
+
.fb-ico svg { width: 16px; height: 16px; fill: currentColor; }
|
|
151
|
+
.fb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
152
|
+
.fb-name { font-weight: 600; }
|
|
153
|
+
.fb-desc { font-size: 11px; color: var(--dsr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
154
|
+
@keyframes fb-in { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: translateY(0) } }
|
|
155
|
+
/* 窄屏压缩顶栏: 图标化文字按钮, 保证全部按钮完整可见 */
|
|
156
|
+
@media (max-width: 900px) {
|
|
157
|
+
.gh-label, .t-label { display: none; }
|
|
158
|
+
.tb-btn { padding: 0 10px; }
|
|
159
|
+
.admin-title .right { gap: 6px; }
|
|
160
|
+
.admin-title .left { gap: 6px; }
|
|
161
|
+
}
|
|
114
162
|
@media (max-width: 720px) {
|
|
115
|
-
|
|
163
|
+
#btn-console span, #btn-close-drawer span { display: none; }
|
|
164
|
+
#btn-console, #btn-close-drawer { padding: 0 9px; }
|
|
165
|
+
.admin-title h1 { font-size: 17px; }
|
|
116
166
|
}
|
|
117
|
-
@media (max-width:
|
|
118
|
-
.admin-title h1
|
|
167
|
+
@media (max-width: 440px) {
|
|
168
|
+
.admin-title h1 { display: none; }
|
|
169
|
+
.admin-title .right { gap: 4px; }
|
|
170
|
+
.tb-btn { padding: 0 8px; }
|
|
119
171
|
}
|
|
120
172
|
</style>
|
|
121
173
|
</head>
|
|
122
174
|
<body>
|
|
123
175
|
<div class="admin-wrap">
|
|
124
176
|
<div class="admin-title">
|
|
125
|
-
<div
|
|
126
|
-
<a id="btn-console" class="mini-btn" href="../" data-i18n-title="consoleTitle">‹ <span data-i18n="console">控制台</span></a>
|
|
127
|
-
<button id="btn-close-drawer" class="mini-btn hidden" data-i18n-title="collapse">‹ <span data-i18n="collapse">收起面板</span></button>
|
|
177
|
+
<div class="left">
|
|
178
|
+
<a id="btn-console" class="mini-btn tb-btn" href="../" data-i18n-title="consoleTitle">‹ <span data-i18n="console">控制台</span></a>
|
|
179
|
+
<button id="btn-close-drawer" class="mini-btn tb-btn hidden" data-i18n-title="collapse">‹ <span data-i18n="collapse">收起面板</span></button>
|
|
128
180
|
<h1>DSH Remote <span data-i18n="admin">管理</span></h1>
|
|
129
181
|
</div>
|
|
130
182
|
<div class="right">
|
|
131
|
-
<a class="mini-btn gh-btn" href="https://github.com/Blank-not-black/dsh-Remote" target="_blank" rel="noopener" title="GitHub">
|
|
183
|
+
<a class="mini-btn gh-btn tb-btn" href="https://github.com/Blank-not-black/dsh-Remote" target="_blank" rel="noopener" title="GitHub">
|
|
132
184
|
<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>
|
|
133
|
-
<span data-i18n="repo">仓库</span>
|
|
185
|
+
<span class="gh-label" data-i18n="repo">仓库</span>
|
|
134
186
|
</a>
|
|
135
|
-
<
|
|
187
|
+
<div class="fb-wrap">
|
|
188
|
+
<button id="btn-feedback" class="mini-btn fb-btn tb-btn" data-i18n-title="feedbackTitle" data-i18n-aria="feedbackTitle" aria-haspopup="menu" aria-expanded="false">
|
|
189
|
+
<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>
|
|
190
|
+
</button>
|
|
191
|
+
<div id="fb-menu" class="fb-menu hidden" role="menu" data-i18n-aria="feedbackTitle">
|
|
192
|
+
<a class="fb-item primary" href="https://github.com/Blank-not-black/dsh-Remote" target="_blank" rel="noopener" role="menuitem">
|
|
193
|
+
<span class="fb-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>
|
|
194
|
+
<span class="fb-body"><span class="fb-name">GitHub</span><span class="fb-desc" data-i18n="feedback.githubDesc">反馈 bug / 提建议</span></span>
|
|
195
|
+
</a>
|
|
196
|
+
<a class="fb-item" href="https://gitee.com/Blankneverfails/dsh-Remote" target="_blank" rel="noopener" role="menuitem">
|
|
197
|
+
<span class="fb-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>
|
|
198
|
+
<span class="fb-body"><span class="fb-name">Gitee</span><span class="fb-desc" data-i18n="feedback.giteeDesc">国内镜像,无需代理</span></span>
|
|
199
|
+
</a>
|
|
200
|
+
<a class="fb-item" href="https://space.bilibili.com/419009275/dynamic" target="_blank" rel="noopener" role="menuitem">
|
|
201
|
+
<span class="fb-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>
|
|
202
|
+
<span class="fb-body"><span class="fb-name">B站</span><span class="fb-desc" data-i18n="feedback.biliDesc">UP 动态页交流</span></span>
|
|
203
|
+
</a>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
<button id="btn-theme" class="mini-btn tb-btn" title="">
|
|
136
207
|
<span id="theme-swatch" class="theme-swatch-dot"></span><span id="theme-label" class="t-label">默认深空</span>
|
|
137
208
|
</button>
|
|
138
|
-
<button id="btn-lang" class="mini-btn" title="Language / 语言">EN</button>
|
|
139
|
-
<button id="conn-badge" class="conn-badge off" title="网关面板"><span data-i18n="unauth">未认证</span></button>
|
|
209
|
+
<button id="btn-lang" class="mini-btn tb-btn" title="Language / 语言">EN</button>
|
|
210
|
+
<button id="conn-badge" class="conn-badge tb-btn off" title="网关面板"><span data-i18n="unauth">未认证</span></button>
|
|
140
211
|
</div>
|
|
141
212
|
</div>
|
|
142
213
|
|
|
@@ -185,6 +256,7 @@
|
|
|
185
256
|
</table>
|
|
186
257
|
<div id="device-empty" class="empty hidden" data-i18n="noDevices">暂无设备记录</div>
|
|
187
258
|
</div>
|
|
259
|
+
|
|
188
260
|
</div>
|
|
189
261
|
</div>
|
|
190
262
|
|
|
@@ -210,6 +282,8 @@
|
|
|
210
282
|
'theme.default': '默认深空', 'theme.dark': '落日', 'theme.light': '易北爱乐厅', 'theme.neutral': '草原孤塔',
|
|
211
283
|
'theme.panelTitle': '选择配色', 'theme.close': '关闭',
|
|
212
284
|
'repo': '仓库',
|
|
285
|
+
'feedbackTitle': '反馈渠道',
|
|
286
|
+
'feedback.githubDesc': '反馈 bug / 提建议', 'feedback.giteeDesc': '国内镜像,无需代理', 'feedback.biliDesc': 'UP 动态页交流',
|
|
213
287
|
'unauth': '未认证',
|
|
214
288
|
'tokenPlaceholder': '输入网关访问令牌',
|
|
215
289
|
'enter': '进入',
|
|
@@ -282,6 +356,8 @@
|
|
|
282
356
|
'theme.default': 'Default', 'theme.dark': 'Sunset', 'theme.light': 'Elbphilharmonie', 'theme.neutral': 'Prairie Tower',
|
|
283
357
|
'theme.panelTitle': 'Choose theme', 'theme.close': 'Close',
|
|
284
358
|
'repo': 'Repo',
|
|
359
|
+
'feedbackTitle': 'Feedback',
|
|
360
|
+
'feedback.githubDesc': 'Report bugs · suggest features', 'feedback.giteeDesc': 'Mirror in China, no proxy needed', 'feedback.biliDesc': 'Chat on the UP\'s Bilibili page',
|
|
285
361
|
'unauth': 'Not connected',
|
|
286
362
|
'tokenPlaceholder': 'Gateway access token',
|
|
287
363
|
'enter': 'Enter',
|
package/public/admin.js
CHANGED
|
@@ -120,6 +120,21 @@ function toast(text, kind = '') {
|
|
|
120
120
|
toast._t = setTimeout(() => el.classList.add('hidden'), 2600)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/* ---------------- 反馈 ---------------- */
|
|
124
|
+
function openFeedbackMenu() {
|
|
125
|
+
$('fb-menu').classList.remove('hidden')
|
|
126
|
+
$('btn-feedback').setAttribute('aria-expanded', 'true')
|
|
127
|
+
const first = $('fb-menu').querySelector('[role="menuitem"]')
|
|
128
|
+
if (first) first.focus()
|
|
129
|
+
}
|
|
130
|
+
function closeFeedbackMenu() {
|
|
131
|
+
$('fb-menu').classList.add('hidden')
|
|
132
|
+
$('btn-feedback').setAttribute('aria-expanded', 'false')
|
|
133
|
+
}
|
|
134
|
+
function toggleFeedbackMenu() {
|
|
135
|
+
$('fb-menu').classList.contains('hidden') ? openFeedbackMenu() : closeFeedbackMenu()
|
|
136
|
+
}
|
|
137
|
+
|
|
123
138
|
function fmtUptime(sec) {
|
|
124
139
|
if (sec < 60) return sec + t('unit.sec')
|
|
125
140
|
if (sec < 3600) return Math.floor(sec / 60) + t('unit.min')
|
|
@@ -477,6 +492,17 @@ $('btn-lang').addEventListener('click', () => {
|
|
|
477
492
|
|
|
478
493
|
$('btn-theme').addEventListener('click', openThemePanel)
|
|
479
494
|
$('theme-close').addEventListener('click', () => $('modal-theme').classList.add('hidden'))
|
|
495
|
+
// 反馈
|
|
496
|
+
$('btn-feedback').addEventListener('click', (e) => { e.stopPropagation(); toggleFeedbackMenu() })
|
|
497
|
+
$('fb-menu').addEventListener('click', (e) => {
|
|
498
|
+
if (e.target.closest('a[role="menuitem"]')) closeFeedbackMenu()
|
|
499
|
+
})
|
|
500
|
+
document.addEventListener('click', (e) => {
|
|
501
|
+
if (!e.target.closest('.fb-wrap')) closeFeedbackMenu()
|
|
502
|
+
})
|
|
503
|
+
document.addEventListener('keydown', (e) => {
|
|
504
|
+
if (e.key === 'Escape' && !$('fb-menu').classList.contains('hidden')) { closeFeedbackMenu(); $('btn-feedback').focus() }
|
|
505
|
+
})
|
|
480
506
|
|
|
481
507
|
function start(showLogin) {
|
|
482
508
|
if (!showLogin) {
|