dsh-remote-plugin 0.8.0 → 0.8.2
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 -2
- package/README.md +2 -2
- package/apk/dsh-remote.apk +0 -0
- package/client.js +96 -115
- package/cordis.patch.yml +2 -1
- package/file-delivery.mjs +84 -0
- package/gateway.cjs +506 -15
- package/index.mjs +576 -50
- package/package.json +3 -2
- package/plugin-center.mjs +4 -0
- package/public/activity.js +8 -3
- package/public/admin.html +8 -0
- package/public/admin.js +60 -0
- package/public/announcements.json +202 -0
- package/public/app.js +189 -43
- package/public/approval-records.js +75 -3
- package/public/build.json +2 -2
- package/public/desktop/desktop.css +9 -1
- package/public/desktop/desktop.html +27 -8
- package/public/desktop/desktop.js +44 -22
- package/public/diagnostics.js +115 -21
- package/public/extensions.css +13 -0
- package/public/extensions.js +74 -3
- package/public/file-inbox.css +66 -0
- package/public/file-inbox.js +289 -0
- package/public/history.js +5 -4
- package/public/index.html +42 -22
- package/public/lan-discovery.js +94 -0
- package/public/plugin.js +21 -6
- package/public/session-deck.css +73 -0
- package/public/session-deck.js +180 -0
- package/public/styles.css +25 -2
- package/public/update.json +12 -12
- package/public/version.json +1 -1
- package/skills/dsh-remote-doctor/references/wiki/notifications.md +4 -0
- package/skills/dsh-remote-doctor/references/wiki/plugins.md +22 -1
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/* Foreground file inbox. Confirmation precedes every download; zero dependencies. */
|
|
2
|
+
;(function(root) {
|
|
3
|
+
'use strict'
|
|
4
|
+
const MAX = 50 * 1024 * 1024
|
|
5
|
+
const zh = () => root.I18N?.lang !== 'en'
|
|
6
|
+
const label = (cn, en) => zh() ? cn : en
|
|
7
|
+
async function hash(bytes) {
|
|
8
|
+
if (root.crypto?.subtle) return [...new Uint8Array(await root.crypto.subtle.digest('SHA-256', bytes))].map(n => n.toString(16).padStart(2, '0')).join('')
|
|
9
|
+
if (typeof root.SHA256 === 'function') return new root.SHA256().update(new Uint8Array(bytes)).hex()
|
|
10
|
+
throw Error(label('当前环境无法校验文件', 'File verification is unavailable'))
|
|
11
|
+
}
|
|
12
|
+
function createClient(config) {
|
|
13
|
+
let current = null, epoch = 0
|
|
14
|
+
const requests = new Set()
|
|
15
|
+
const stored = key => { try { return JSON.parse(root.localStorage.getItem(key) || 'null') } catch { return null } }
|
|
16
|
+
const persist = ctx => { if (ctx.valid()) root.localStorage.setItem(ctx.storage, JSON.stringify(ctx.prefs)) }
|
|
17
|
+
const requireCurrent = ctx => { if (!ctx.valid()) throw Error(label('连接已改变,请重新打开收件箱', 'Connection changed. Reopen the inbox.')) }
|
|
18
|
+
async function identity() {
|
|
19
|
+
const connection = config.capture(), generation = epoch
|
|
20
|
+
if (!connection.token) throw Error(label('请先连接主机', 'Connect to a host first'))
|
|
21
|
+
if (current?.valid()) return current
|
|
22
|
+
const scope = await hash(new TextEncoder().encode(config.url('/api/file-inbox') + '\0' + connection.token))
|
|
23
|
+
if (generation !== epoch || !connection.valid()) throw Error('connection-changed')
|
|
24
|
+
const storage = 'dshRemoteFileInboxV1:' + scope
|
|
25
|
+
let prefs = stored(storage)
|
|
26
|
+
if (!/^[a-f0-9]{64}$/.test(prefs?.key || '')) {
|
|
27
|
+
prefs = { key: [...root.crypto.getRandomValues(new Uint8Array(32))].map(n => n.toString(16).padStart(2, '0')).join(''), name: config.native?.() ? 'Android' : label('浏览器', 'Browser'), jobs: {}, receipts: {} }
|
|
28
|
+
}
|
|
29
|
+
prefs.jobs ||= {}; prefs.receipts ||= {}
|
|
30
|
+
const ctx = { connection, storage, prefs, lastRegister: 0, valid: () => generation === epoch && connection.valid() }
|
|
31
|
+
persist(ctx); current = ctx
|
|
32
|
+
return ctx
|
|
33
|
+
}
|
|
34
|
+
async function read(ctx, url, options, timeoutMs, decode) {
|
|
35
|
+
requireCurrent(ctx)
|
|
36
|
+
const controller = new AbortController(), timeout = AbortSignal.timeout(timeoutMs), abort = () => controller.abort()
|
|
37
|
+
requests.add(controller); timeout.addEventListener('abort', abort, { once: true })
|
|
38
|
+
try {
|
|
39
|
+
const response = await root.fetch(url, { ...options, signal: controller.signal, redirect: 'error' })
|
|
40
|
+
requireCurrent(ctx)
|
|
41
|
+
const data = await decode(response)
|
|
42
|
+
requireCurrent(ctx)
|
|
43
|
+
return data
|
|
44
|
+
} finally { requests.delete(controller); timeout.removeEventListener('abort', abort) }
|
|
45
|
+
}
|
|
46
|
+
async function api(ctx, body) {
|
|
47
|
+
const { response, data } = await read(ctx, config.url('/api/file-inbox'), { method: body ? 'POST' : 'GET', headers: { ...config.headers(ctx.connection), 'content-type': 'application/json', 'x-dsh-remote-inbox-key': ctx.prefs.key }, ...(body ? { body: JSON.stringify(body) } : {}) }, 12000, async response => ({ response, data: await response.json() }))
|
|
48
|
+
requireCurrent(ctx)
|
|
49
|
+
if (!response.ok) throw Error(response.status === 404 ? label('主机尚不支持文件收件箱,请升级 Remote 插件', 'Update the host Remote plugin to use the file inbox') : String(data.error || 'HTTP ' + response.status))
|
|
50
|
+
return data
|
|
51
|
+
}
|
|
52
|
+
async function acknowledge(ctx, id, phase) {
|
|
53
|
+
requireCurrent(ctx)
|
|
54
|
+
ctx.prefs.receipts[id] = phase; persist(ctx)
|
|
55
|
+
await api(ctx, { action: 'receipt', id, phase })
|
|
56
|
+
delete ctx.prefs.receipts[id]; persist(ctx)
|
|
57
|
+
}
|
|
58
|
+
async function sync() {
|
|
59
|
+
const ctx = await identity()
|
|
60
|
+
if (Date.now() - ctx.lastRegister > 20000) { ctx.device = await api(ctx, { action: 'register', name: ctx.prefs.name }); ctx.lastRegister = Date.now() }
|
|
61
|
+
const before = await api(ctx)
|
|
62
|
+
for (const id of Object.keys(ctx.prefs.jobs)) {
|
|
63
|
+
const row = before.transfers.find(row => row.id === id)
|
|
64
|
+
if (!row || ['expired', 'rejected', 'complete', 'downloaded'].includes(row.phase)) { delete ctx.prefs.jobs[id]; delete ctx.prefs.receipts[id]; persist(ctx) }
|
|
65
|
+
}
|
|
66
|
+
for (const id of Object.keys(ctx.prefs.receipts)) {
|
|
67
|
+
const row = before.transfers.find(row => row.id === id)
|
|
68
|
+
if (!row || ['expired', 'rejected', 'complete', 'downloaded'].includes(row.phase)) { delete ctx.prefs.receipts[id]; persist(ctx) }
|
|
69
|
+
}
|
|
70
|
+
for (const [id, job] of Object.entries(ctx.prefs.jobs)) {
|
|
71
|
+
requireCurrent(ctx)
|
|
72
|
+
let status
|
|
73
|
+
try { status = JSON.parse(config.native()?.getFileDownloadStatus(job)) } catch { continue }
|
|
74
|
+
// DownloadManager returns unknown after its record is removed. Let the
|
|
75
|
+
// user retry instead of retaining a job that can never finish.
|
|
76
|
+
if (!['complete', 'error', 'unknown'].includes(status?.phase)) continue
|
|
77
|
+
try { await acknowledge(ctx, id, status.phase === 'complete' ? 'complete' : 'failed'); delete ctx.prefs.jobs[id]; persist(ctx) } catch {}
|
|
78
|
+
}
|
|
79
|
+
for (const [id, phase] of Object.entries(ctx.prefs.receipts)) { try { await acknowledge(ctx, id, phase) } catch {} }
|
|
80
|
+
const value = await api(ctx)
|
|
81
|
+
return { ...value, device: ctx.device, name: ctx.prefs.name, jobs: { ...ctx.prefs.jobs } }
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
sync,
|
|
85
|
+
reset() { epoch++; current = null; for (const request of requests) request.abort(); requests.clear() },
|
|
86
|
+
async rename(name) { const ctx = await identity(); requireCurrent(ctx); ctx.prefs.name = String(name).trim().slice(0, 60) || 'Remote'; persist(ctx); ctx.lastRegister = 0; return sync() },
|
|
87
|
+
async reject(row) { const ctx = await identity(); return api(ctx, { action: 'reject', id: row.id }) },
|
|
88
|
+
async receive(row) {
|
|
89
|
+
const ctx = await identity()
|
|
90
|
+
const accepted = await api(ctx, { action: 'accept', id: row.id })
|
|
91
|
+
requireCurrent(ctx)
|
|
92
|
+
const url = new URL(config.url('/fs/inbox-file'), root.location.href)
|
|
93
|
+
url.searchParams.set('id', row.id); url.searchParams.set('ticket', accepted.ticket)
|
|
94
|
+
const native = config.native?.()
|
|
95
|
+
try {
|
|
96
|
+
if (native?.downloadToDownloads && native?.getFileDownloadStatus) {
|
|
97
|
+
const job = native.downloadToDownloads(url.href, accepted.fileName, ctx.connection.token)
|
|
98
|
+
if (!/^\d+$/.test(String(job))) throw Error(label('系统下载未启动', 'System download did not start'))
|
|
99
|
+
ctx.prefs.jobs[row.id] = String(job); persist(ctx)
|
|
100
|
+
return { native: true }
|
|
101
|
+
}
|
|
102
|
+
const bytes = await read(ctx, url.href, { headers: config.headers(ctx.connection) }, 20 * 60 * 1000, async response => {
|
|
103
|
+
if (!response.ok || accepted.size > MAX) throw Error(label('文件下载失败', 'Download failed'))
|
|
104
|
+
return response.arrayBuffer()
|
|
105
|
+
})
|
|
106
|
+
requireCurrent(ctx)
|
|
107
|
+
if (bytes.byteLength !== accepted.size || await hash(bytes) !== accepted.sha256) throw Error(label('文件校验失败', 'File verification failed'))
|
|
108
|
+
requireCurrent(ctx)
|
|
109
|
+
return { native: false, blob: new Blob([bytes], { type: 'application/octet-stream' }), name: accepted.fileName, id: row.id, valid: ctx.valid,
|
|
110
|
+
handedOff: () => acknowledge(ctx, row.id, 'downloaded') }
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (ctx.valid()) { try { await acknowledge(ctx, row.id, 'failed') } catch {} }
|
|
113
|
+
throw error
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const actionable = row => ['pending', 'accepted', 'downloading', 'failed'].includes(row.phase)
|
|
120
|
+
const sessionTransfers = (rows, sessionId) => sessionId ? rows.filter(row => row.sessionId === sessionId && actionable(row)) : []
|
|
121
|
+
let mounted
|
|
122
|
+
function mount(config) {
|
|
123
|
+
if (mounted || !root.document) return mounted
|
|
124
|
+
const client = createClient(config), doc = root.document
|
|
125
|
+
const node = (tag, text, cls) => { const el = doc.createElement(tag); if (text != null) el.textContent = text; if (cls) el.className = cls; return el }
|
|
126
|
+
const button = (text, action, key, primary = false) => {
|
|
127
|
+
const el = node('button', text, 'file-inbox-button' + (primary ? ' primary' : ''))
|
|
128
|
+
el.type = 'button'; el.dataset.inboxFocus = key; el.addEventListener('click', action); return el
|
|
129
|
+
}
|
|
130
|
+
const files = doc.getElementById('file-inbox-files'), session = doc.getElementById('file-inbox-session')
|
|
131
|
+
const slots = [files, session].filter(Boolean)
|
|
132
|
+
let snapshot, busy = false, polling = false, note = '', noteId = '', lastSignature = '', destroyed = false, generation = 0, revision = 0
|
|
133
|
+
let historyOpen = false, deviceOpen = false
|
|
134
|
+
const expanded = new Set(), ready = new Map()
|
|
135
|
+
const context = () => config.context?.() || { sessionId: '', inChat: false }
|
|
136
|
+
const releasePrepared = () => { ready.forEach(item => URL.revokeObjectURL(item.url)); ready.clear() }
|
|
137
|
+
const phases = () => ({ pending: label('等待接收', 'Awaiting acceptance'), accepted: label('准备下载', 'Preparing download'), downloading: label('下载中 / 等待回执', 'Downloading / awaiting receipt'), downloaded: label('已交给浏览器保存', 'Handed to browser'), complete: label('设备报告已保存', 'Device reports saved'), failed: label('接收失败', 'Receive failed'), rejected: label('已拒绝', 'Rejected'), expired: label('已过期', 'Expired') })
|
|
138
|
+
function reset() { generation++; client.reset(); snapshot = null; note = ''; noteId = ''; busy = false; polling = false; lastSignature = ''; historyOpen = false; deviceOpen = false; expanded.clear(); releasePrepared(); render() }
|
|
139
|
+
async function action(id, work) {
|
|
140
|
+
if (busy) return
|
|
141
|
+
const start = generation, scope = context(), active = doc.activeElement
|
|
142
|
+
const focusKey = slots.some(slot => slot.contains(active)) ? active?.dataset?.inboxFocus : ''
|
|
143
|
+
const actionRevision = ++revision
|
|
144
|
+
busy = true; noteId = id; note = label('处理中…', 'Working…'); render()
|
|
145
|
+
try { await work(); if (start !== generation) return; const value = await client.sync(); if (start !== generation) return; snapshot = value; note = ''; noteId = '' }
|
|
146
|
+
catch (error) { if (start === generation) note = error.message }
|
|
147
|
+
finally { if (start === generation) { busy = false; render(); restoreActionFocus(focusKey, scope, start, actionRevision) } }
|
|
148
|
+
}
|
|
149
|
+
function restoreActionFocus(key, scope, start, actionRevision) {
|
|
150
|
+
if (!key) return
|
|
151
|
+
// Wait for the session deck to select and reveal the replacement card.
|
|
152
|
+
root.requestAnimationFrame(() => {
|
|
153
|
+
const current = context(), active = doc.activeElement
|
|
154
|
+
if (destroyed || start !== generation || actionRevision !== revision || busy ||
|
|
155
|
+
current.sessionId !== scope.sessionId || current.inChat !== scope.inChat ||
|
|
156
|
+
(active && active !== doc.body && active !== doc.documentElement)) return
|
|
157
|
+
const visible = el => el && !el.disabled && !el.closest('[hidden],.hidden,[inert]') && el.getClientRects().length
|
|
158
|
+
const candidates = slots.flatMap(slot => [...slot.querySelectorAll('[data-inbox-focus]')])
|
|
159
|
+
const keys = [key.replace(/:accept$/, ':save'), key, key.replace(/:[^:]+$/, ':card')]
|
|
160
|
+
const target = keys.map(value => candidates.find(el => el.dataset.inboxFocus === value && visible(el))).find(Boolean)
|
|
161
|
+
|| candidates.find(el => el.dataset.inboxFocus.startsWith('session:') && visible(el))
|
|
162
|
+
|| (scope.inChat ? [doc.getElementById('session-deck-stage'), doc.getElementById('composer-input'), doc.getElementById('composer')].find(visible)
|
|
163
|
+
: candidates.find(el => el.dataset.inboxFocus === 'files:heading' && visible(el)))
|
|
164
|
+
target?.focus({ preventScroll: true })
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
function card(row, placement) {
|
|
168
|
+
const compact = placement === 'session', prepared = ready.get(row.id)
|
|
169
|
+
const el = node('article', null, 'file-inbox-card' + (compact ? ' is-compact' : '') + (actionable(row) ? ' needs-action' : ''))
|
|
170
|
+
el.dataset.transferId = row.id
|
|
171
|
+
const key = action => placement + ':' + row.id + ':' + action
|
|
172
|
+
el.tabIndex = -1; el.dataset.inboxFocus = key('card')
|
|
173
|
+
const head = node('div', null, 'file-inbox-card-head'), icon = node('span', '↓', 'file-inbox-icon'), names = node('div', null, 'file-inbox-names')
|
|
174
|
+
icon.setAttribute('aria-hidden', 'true')
|
|
175
|
+
const size = row.size < 1024 ? row.size + ' B' : row.size < 1048576 ? (row.size / 1024).toFixed(1) + ' KiB' : (row.size / 1048576).toFixed(2) + ' MiB'
|
|
176
|
+
const purpose = [row.title && row.title !== row.fileName ? row.title : '', row.message].filter(Boolean).join(' · ')
|
|
177
|
+
if (compact) {
|
|
178
|
+
names.append(node('strong', row.fileName, 'file-inbox-filename'))
|
|
179
|
+
const extension = /\.([a-z0-9]{1,10})$/i.exec(row.fileName)?.[1]?.toUpperCase()
|
|
180
|
+
const meta = node('div', null, 'file-inbox-inline-meta'); meta.append(node('span', (extension ? extension + ' · ' : '') + size, 'file-inbox-size'))
|
|
181
|
+
if (prepared || row.phase !== 'pending') meta.append(node('span', prepared ? label('传输校验通过', 'Transfer verified') : phases()[row.phase] || row.phase, 'file-inbox-phase ' + row.phase))
|
|
182
|
+
head.append(names, meta); el.append(head, node('p', purpose || label('未附文件说明', 'No file description provided'), 'file-inbox-message'))
|
|
183
|
+
} else {
|
|
184
|
+
names.append(node('span', label('文件接收请求', 'File delivery'), 'file-inbox-eyebrow'), node('strong', row.fileName, 'file-inbox-filename'))
|
|
185
|
+
head.append(icon, names, node('span', phases()[row.phase] || row.phase, 'file-inbox-phase ' + row.phase)); el.append(head)
|
|
186
|
+
el.append(node('p', size + (row.title && row.title !== row.fileName ? ' · ' + row.title : ''), 'file-inbox-meta'))
|
|
187
|
+
if (row.message) el.append(node('p', row.message, 'file-inbox-message'))
|
|
188
|
+
}
|
|
189
|
+
const details = node('details', null, 'file-inbox-details'); details.open = expanded.has(key('details'))
|
|
190
|
+
details.append(node('summary', compact ? label('详情', 'Details') : label('查看详情', 'Details')))
|
|
191
|
+
if (compact) details.append(node('p', label('文件:', 'File: ') + row.fileName), node('p', label('说明:', 'Description: ') + (purpose || label('未提供', 'Not provided'))))
|
|
192
|
+
details.append(node('p', label('来源会话:', 'Session: ') + (config.sessionTitle?.(row.sessionId) || row.sessionId)), node('p', label('到期:', 'Expires: ') + new Date(row.expiresAt).toLocaleString()))
|
|
193
|
+
details.addEventListener('toggle', () => details.open ? expanded.add(key('details')) : expanded.delete(key('details')))
|
|
194
|
+
if (!compact) el.append(details)
|
|
195
|
+
const actions = node('div', null, 'file-inbox-actions')
|
|
196
|
+
if (prepared) {
|
|
197
|
+
if (!compact) el.append(node('p', label('已校验,点击保存文件。', 'Verified. Save the file to continue.'), 'file-inbox-meta'))
|
|
198
|
+
actions.append(button(label('保存文件', 'Save file'), () => action(row.id, async () => {
|
|
199
|
+
if (!prepared.valid()) throw Error(label('连接已改变', 'Connection changed'))
|
|
200
|
+
const anchor = node('a'); anchor.href = prepared.url; anchor.download = prepared.name; doc.body.append(anchor); anchor.click(); anchor.remove()
|
|
201
|
+
await prepared.handedOff(); URL.revokeObjectURL(prepared.url); ready.delete(row.id)
|
|
202
|
+
}), key('save'), true))
|
|
203
|
+
} else if (actionable(row) && !snapshot.jobs?.[row.id]) {
|
|
204
|
+
actions.append(button(row.phase === 'pending' ? label('接收文件', 'Accept file') : label('重新接收', 'Receive again'), () => action(row.id, async () => {
|
|
205
|
+
const out = await client.receive(row)
|
|
206
|
+
if (!out.native) ready.set(row.id, { ...out, url: URL.createObjectURL(out.blob) })
|
|
207
|
+
}), key('accept'), true))
|
|
208
|
+
if (row.phase === 'pending') actions.append(button(label('拒绝', 'Reject'), () => action(row.id, () => client.reject(row)), key('reject')))
|
|
209
|
+
}
|
|
210
|
+
if (compact) actions.append(details)
|
|
211
|
+
if (actions.children.length) el.append(actions)
|
|
212
|
+
if (note && noteId === row.id) el.append(node('p', note, 'file-inbox-note'))
|
|
213
|
+
return el
|
|
214
|
+
}
|
|
215
|
+
function render() {
|
|
216
|
+
if (destroyed) return
|
|
217
|
+
const active = doc.activeElement, focused = active?.dataset?.inboxFocus, hadFocus = slots.some(slot => slot.contains(active))
|
|
218
|
+
const rows = snapshot?.transfers || [], current = context()
|
|
219
|
+
if (session) {
|
|
220
|
+
const selected = current.inChat ? sessionTransfers(rows, current.sessionId) : []
|
|
221
|
+
session.hidden = !selected.length
|
|
222
|
+
session.replaceChildren()
|
|
223
|
+
if (selected.length) {
|
|
224
|
+
const header = node('div', null, 'file-inbox-head'), heading = node('h3', label('待接收文件', 'Incoming files'))
|
|
225
|
+
header.append(heading, node('span', String(selected.length), 'file-inbox-count'))
|
|
226
|
+
const list = node('div', null, 'file-inbox-list'); for (const row of selected) list.append(card(row, 'session'))
|
|
227
|
+
session.append(header, list)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (files) {
|
|
231
|
+
files.replaceChildren()
|
|
232
|
+
const header = node('header', null, 'file-inbox-head'), heading = node('h2', label('文件收件箱', 'File inbox'))
|
|
233
|
+
heading.tabIndex = -1; heading.dataset.inboxFocus = 'files:heading'
|
|
234
|
+
const count = rows.filter(actionable).length
|
|
235
|
+
header.append(heading, node('span', String(count), 'file-inbox-count'), button(label('刷新', 'Refresh'), tick, 'files:refresh'))
|
|
236
|
+
files.append(header)
|
|
237
|
+
files.append(node('p', label('DSH 发来的文件,确认后才会接收。', 'Files sent by DSH are downloaded only after you accept.'), 'file-inbox-intro'))
|
|
238
|
+
if (note && !noteId) files.append(node('p', note, 'file-inbox-note'))
|
|
239
|
+
const incoming = rows.filter(actionable), list = node('div', null, 'file-inbox-list')
|
|
240
|
+
for (const row of incoming) list.append(card(row, 'files'))
|
|
241
|
+
if (!incoming.length) list.append(node('p', snapshot ? label('暂无待接收文件', 'No incoming files') : label('连接主机后可接收文件', 'Connect to a host to receive files'), 'file-inbox-empty'))
|
|
242
|
+
files.append(list)
|
|
243
|
+
const history = rows.filter(row => !actionable(row))
|
|
244
|
+
if (history.length) {
|
|
245
|
+
const group = node('details', null, 'file-inbox-history'); group.open = historyOpen
|
|
246
|
+
group.append(node('summary', label('已处理', 'History') + ' (' + history.length + ')'))
|
|
247
|
+
const items = node('div', null, 'file-inbox-list'); for (const row of history) items.append(card(row, 'history'))
|
|
248
|
+
group.append(items); group.addEventListener('toggle', () => { historyOpen = group.open }); files.append(group)
|
|
249
|
+
}
|
|
250
|
+
if (snapshot) {
|
|
251
|
+
const device = node('details', null, 'file-inbox-device'); device.open = deviceOpen
|
|
252
|
+
device.append(node('summary', label('接收设备 · ', 'Receiving device · ') + snapshot.name))
|
|
253
|
+
const field = node('label', label('设备名称 ', 'Device name ')), input = node('input'); input.value = snapshot.name; input.maxLength = 60; input.dataset.inboxFocus = 'files:name'
|
|
254
|
+
field.append(input); device.append(field, button(label('保存名称', 'Save name'), () => action('', async () => { await client.rename(input.value) }), 'files:rename'), node('small', label('设备编号:', 'Device id: ') + (snapshot.device?.id || '—')))
|
|
255
|
+
device.addEventListener('toggle', () => { deviceOpen = device.open }); files.append(device)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
for (const slot of slots) for (const el of slot.querySelectorAll('button,input')) el.disabled = busy
|
|
259
|
+
if (hadFocus && focused) {
|
|
260
|
+
const target = slots.flatMap(slot => [...slot.querySelectorAll('[data-inbox-focus]')]).find(el => el.dataset.inboxFocus === focused)
|
|
261
|
+
if (target?.tagName === 'INPUT') target.value = active.value
|
|
262
|
+
if (target && !target.disabled) target.focus()
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async function tick() {
|
|
266
|
+
if (destroyed || polling || busy || doc.visibilityState === 'hidden') return
|
|
267
|
+
const start = generation, readRevision = revision
|
|
268
|
+
polling = true
|
|
269
|
+
try {
|
|
270
|
+
const next = await client.sync(), signature = JSON.stringify(next)
|
|
271
|
+
if (start !== generation || readRevision !== revision) return
|
|
272
|
+
snapshot = next; note = ''; noteId = ''
|
|
273
|
+
for (const [id, item] of ready) if (!next.transfers.some(row => row.id === id && row.phase === 'downloading')) { URL.revokeObjectURL(item.url); ready.delete(id) }
|
|
274
|
+
if (signature !== lastSignature && doc.activeElement?.tagName !== 'INPUT') { render(); lastSignature = signature }
|
|
275
|
+
} catch (error) { if (start === generation && readRevision === revision) { note = error.message; noteId = ''; render() } }
|
|
276
|
+
finally { if (start === generation) polling = false }
|
|
277
|
+
}
|
|
278
|
+
async function open() { config.openFiles?.(); render(); files?.querySelector('h2')?.focus(); await tick() }
|
|
279
|
+
const entries = [...doc.querySelectorAll('[data-file-inbox-open]')]
|
|
280
|
+
for (const el of entries) el.addEventListener('click', open)
|
|
281
|
+
const timer = root.setInterval(tick, 10000)
|
|
282
|
+
doc.addEventListener('visibilitychange', tick)
|
|
283
|
+
mounted = { open, render, reset, close: () => false, refresh: tick, destroy() { client.reset(); releasePrepared(); root.clearInterval(timer); doc.removeEventListener('visibilitychange', tick); for (const el of entries) el.removeEventListener('click', open); for (const slot of slots) slot.replaceChildren(); if (session) session.hidden = true; destroyed = true; mounted = null } }
|
|
284
|
+
render(); void tick()
|
|
285
|
+
return mounted
|
|
286
|
+
}
|
|
287
|
+
root.DshFileInbox = { createClient, sessionTransfers, mount, reset: () => mounted?.reset(), refresh: () => mounted?.refresh(), render: () => mounted?.render(), open: () => mounted?.open(), close: () => mounted?.close() }
|
|
288
|
+
if (typeof module !== 'undefined') module.exports = root.DshFileInbox
|
|
289
|
+
})(typeof window !== 'undefined' ? window : globalThis)
|
package/public/history.js
CHANGED
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
if(db){const value=await new Promise(resolve=>{
|
|
186
186
|
let tx,settled=false
|
|
187
187
|
const done=value=>{if(settled)return;settled=true;clearTimeout(timer);resolve(value)}
|
|
188
|
-
|
|
188
|
+
const timer=setTimeout(()=>{globalThis.DshDiagnostics?.storageFailure(scope,{name:'TimeoutError'},'indexeddb');done(null);try{tx?.abort()}catch{}},1500)
|
|
189
189
|
try{tx=db.transaction('history');const request=tx.objectStore('history').get(key);request.onsuccess=()=>done(request.result);request.onerror=tx.onabort=tx.onerror=()=>done(null)}catch{done(null)}
|
|
190
190
|
});if(value)return value}
|
|
191
191
|
try{const value=JSON.parse(localStorage.getItem(key)||'null');if(value)return value}catch{}
|
|
@@ -202,12 +202,13 @@
|
|
|
202
202
|
const tx=db.transaction('history','readwrite'),store=tx.objectStore('history');store.put(data)
|
|
203
203
|
let count=0;const request=store.index('scopeTime').openKeyCursor(IDBKeyRange.bound([scope,0],[scope,Number.MAX_SAFE_INTEGER]),'prev')
|
|
204
204
|
request.onsuccess=()=>{const cursor=request.result;if(!cursor)return;if(++count>10)store.delete(cursor.primaryKey);cursor.continue()}
|
|
205
|
-
tx.oncomplete=()=>resolve(true);tx.onabort=tx.onerror=()=>resolve(false)
|
|
206
|
-
});if(saved)return true}catch{}
|
|
205
|
+
tx.oncomplete=()=>resolve(true);tx.onabort=tx.onerror=()=>{globalThis.DshDiagnostics?.storageFailure(scope,tx.error||{name:'UnknownError'},'indexeddb');resolve(false)}
|
|
206
|
+
});if(saved)return true}catch(error){globalThis.DshDiagnostics?.storageFailure(scope,error,'indexeddb')}
|
|
207
207
|
if(epoch!==cacheEpoch)return false
|
|
208
208
|
try{
|
|
209
209
|
const indexKey=scope+':cache-index',index=JSON.parse(localStorage.getItem(indexKey)||'[]').filter(item=>item!==key),serialized=JSON.stringify(data)
|
|
210
|
-
|
|
210
|
+
let diagnosed=false
|
|
211
|
+
while(true){try{localStorage.setItem(key,serialized);break}catch(error){if(!diagnosed){diagnosed=true;globalThis.DshDiagnostics?.storageFailure(scope,error)}if(!index.length)throw error;localStorage.removeItem(index.pop())}}
|
|
211
212
|
index.unshift(key)
|
|
212
213
|
for(const removed of index.splice(10))localStorage.removeItem(removed)
|
|
213
214
|
localStorage.setItem(indexKey,JSON.stringify(index));return kept.length>0
|
package/public/index.html
CHANGED
|
@@ -34,8 +34,12 @@
|
|
|
34
34
|
<div class="topbar-right">
|
|
35
35
|
<button id="btn-donate" class="topbar-btn icon-btn" data-i18n-title="settings.donate" data-i18n-aria="settings.donate"><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="M6 8h11v6a4 4 0 0 1-4 4H10a4 4 0 0 1-4-4Z"/><path d="M17 10h1.5a2.5 2.5 0 0 1 0 5H17M9 4c0 1 1 1.2 1 2M13 4c0 1 1 1.2 1 2M5 20h13"/></svg></button>
|
|
36
36
|
<button id="btn-feedback" class="topbar-btn icon-btn" data-i18n-title="feedback.title" data-i18n-aria="feedback.title" aria-haspopup="menu" aria-expanded="false"><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="M20 11.5a7.5 7.5 0 0 1-7.5 7.5H7l-3 2 .8-3.1A7.5 7.5 0 1 1 20 11.5Z"/><path d="M8 11.5h.01M12 11.5h.01M16 11.5h.01"/></svg></button>
|
|
37
|
-
<
|
|
38
|
-
|
|
37
|
+
<div class="ext-shortcuts">
|
|
38
|
+
<button id="btn-plugin-shortcuts" class="topbar-btn icon-btn" type="button" aria-haspopup="menu" aria-controls="plugin-shortcuts-menu" aria-expanded="false" data-i18n-title="nav.plugins" data-i18n-aria="nav.plugins"><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" y="3" width="7" height="7" rx="2"/><rect x="14" y="3" width="7" height="7" rx="2"/><rect x="3" y="14" width="7" height="7" rx="2"/><rect x="14" y="14" width="7" height="7" rx="2"/></svg></button>
|
|
39
|
+
<div id="plugin-shortcuts-menu" class="ext-shortcuts-menu hidden" role="menu" data-i18n-aria="nav.plugins"></div>
|
|
40
|
+
</div>
|
|
41
|
+
<button id="conn-badge" type="button" class="topbar-btn conn-badge off" aria-describedby="conn-refresh-hint" data-i18n="conn.off" data-i18n-title="conn.refresh">未连接</button>
|
|
42
|
+
<span id="conn-refresh-hint" class="ext-sr-only" data-i18n="conn.refresh">点击刷新连接与数据</span>
|
|
39
43
|
</div>
|
|
40
44
|
</header>
|
|
41
45
|
|
|
@@ -92,6 +96,7 @@
|
|
|
92
96
|
<label for="fs-workspace" data-i18n="fs.workspace">DSH 工作区</label>
|
|
93
97
|
<select id="fs-workspace" class="workspace-select" data-i18n-aria="workspace.select"></select>
|
|
94
98
|
</div>
|
|
99
|
+
<section id="file-inbox-files" class="file-inbox-files" aria-label="文件收件箱"></section>
|
|
95
100
|
<div class="fs-head">
|
|
96
101
|
<button id="fs-up" class="icon-btn" data-i18n-title="fs.up" data-i18n-aria="fs.up">‹</button>
|
|
97
102
|
<div id="fs-path" class="fs-path" data-i18n="fs.loading">加载中…</div>
|
|
@@ -127,11 +132,16 @@
|
|
|
127
132
|
</div>
|
|
128
133
|
|
|
129
134
|
<button id="session-sub" class="session-sub" type="button" aria-haspopup="dialog" aria-controls="session-info"></button>
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
<section id="session-deck" class="session-deck">
|
|
136
|
+
<div id="session-deck-stage" class="session-deck-stage">
|
|
137
|
+
<div id="session-cards" class="cards"></div>
|
|
138
|
+
<div id="queue-dock" class="queue-dock hidden" aria-live="polite"></div>
|
|
139
|
+
<div class="session-attention">
|
|
140
|
+
<section id="session-pending" class="session-pending hidden" aria-live="polite"></section>
|
|
141
|
+
<section id="file-inbox-session" class="file-inbox-session" aria-label="待接收文件" aria-live="polite" hidden></section>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</section>
|
|
135
145
|
|
|
136
146
|
<div class="section-head small">
|
|
137
147
|
<span data-i18n="session.history">对话</span>
|
|
@@ -424,6 +434,7 @@
|
|
|
424
434
|
</div>
|
|
425
435
|
<div id="server-list" class="server-list"></div>
|
|
426
436
|
<div class="server-add">
|
|
437
|
+
<button id="btn-lan-discover" class="mini-btn hidden" type="button" data-i18n="settings.lanDiscover">搜索电脑</button>
|
|
427
438
|
<input id="server-input" type="url" placeholder="http://IP:8787">
|
|
428
439
|
<button id="btn-server-add" class="mini-btn" data-i18n="settings.add">添加</button>
|
|
429
440
|
</div>
|
|
@@ -454,11 +465,12 @@
|
|
|
454
465
|
<label class="switch"><input type="checkbox" id="opt-peak-remind" aria-label="峰谷计费提醒 · dsh-cost-meter"><span class="slider"></span></label>
|
|
455
466
|
</div>
|
|
456
467
|
<div class="setting-row">
|
|
457
|
-
<div><div class="setting-name" data-i18n="settings.testNotifyTitle">测试通知</div><div class="setting-desc" data-i18n="settings.testNotifyDesc"
|
|
468
|
+
<div><div class="setting-name" data-i18n="settings.testNotifyTitle">测试通知</div><div class="setting-desc" data-i18n="settings.testNotifyDesc">Android 使用所选类型的实际通知渠道测试,不执行真实任务</div></div>
|
|
469
|
+
<select id="test-notify-kind" class="setting-select" aria-label="通知测试类型"><option value="approval" data-i18n="settings.testApproval">审批提醒</option><option value="turn" data-i18n="settings.testTurn">本轮结束</option><option value="error" data-i18n="settings.testError">执行失败</option></select>
|
|
458
470
|
<button id="btn-test-notify" class="mini-btn" data-i18n="settings.testNotify">发送测试通知</button>
|
|
459
471
|
</div>
|
|
460
472
|
<div class="setting-row">
|
|
461
|
-
<div><div class="setting-name" data-i18n="settings.bgTitle">后台轮询</div><div class="setting-desc" data-i18n="settings.bgDesc"
|
|
473
|
+
<div><div class="setting-name" data-i18n="settings.bgTitle">后台轮询</div><div class="setting-desc" data-i18n="settings.bgDesc">退后台后由前台服务接收事件;系统省电与服务时限可能延迟提醒</div><div id="bg-auth-status" class="setting-desc hidden" data-i18n="settings.bgAuthFailed">登录失效:连续 3 次 401,后台轮询已停止</div></div>
|
|
462
474
|
<label class="switch"><input type="checkbox" id="opt-bg-poll"><span class="slider"></span></label>
|
|
463
475
|
</div>
|
|
464
476
|
<div class="setting-row">
|
|
@@ -471,7 +483,7 @@
|
|
|
471
483
|
</select>
|
|
472
484
|
</div>
|
|
473
485
|
<div class="setting-row">
|
|
474
|
-
<div><div class="setting-name" data-i18n="settings.taskDoneTitle">任务结束通知</div><div class="setting-desc" data-i18n="settings.taskDoneDesc"
|
|
486
|
+
<div><div class="setting-name" data-i18n="settings.taskDoneTitle">任务结束通知</div><div class="setting-desc" data-i18n="settings.taskDoneDesc">分别提醒本轮结束、目标完成与执行失败,点击进入对应会话</div></div>
|
|
475
487
|
<label class="switch"><input type="checkbox" id="opt-task-done"><span class="slider"></span></label>
|
|
476
488
|
</div>
|
|
477
489
|
<div class="setting-row">
|
|
@@ -660,10 +672,10 @@
|
|
|
660
672
|
</div>
|
|
661
673
|
<textarea id="fb-msg" class="fb-textarea" rows="5" maxlength="2000" data-i18n-placeholder="feedback.messagePlaceholder" placeholder="请描述遇到的问题或建议(必填,≤2000 字)"></textarea>
|
|
662
674
|
<input id="fb-contact" class="fb-input" maxlength="200" data-i18n-placeholder="feedback.contactPlaceholder" placeholder="联系方式(可选):邮箱 / 微信 / B站 ID">
|
|
663
|
-
<label class="fb-diagnostics"><input id="fb-include-diagnostics" type="checkbox"> <span data-i18n="feedback.includeDiagnostics"
|
|
675
|
+
<label class="fb-diagnostics"><input id="fb-include-diagnostics" type="checkbox"> <span data-i18n="feedback.includeDiagnostics">附带客户端与网关诊断(可选)</span><small data-i18n="feedback.diagnosticsPrivacy">上传客户端操作与错误位置、存储占用、版本和网关链路状态;不含令牌、Cookie、对话正文、答案或完整路径。可在下方预览。</small></label>
|
|
664
676
|
<label class="fb-diagnostics"><input id="fb-include-crashes" type="checkbox"> <span data-i18n="feedback.includeCrashes">附带崩溃日志摘要(可选)</span><small data-i18n="feedback.crashPrivacy">默认仅在本机记录。勾选后上传最近 3 条退出、重启和错误位置摘要,不含对话、密钥或完整路径。</small></label>
|
|
665
677
|
<section class="client-diagnostics" aria-label="操作诊断日志">
|
|
666
|
-
<p data-log-label="privacy"
|
|
678
|
+
<p data-log-label="privacy">操作日志默认保存在此设备。提交反馈时勾选诊断选项可附带脱敏日志,也可复制或导出。</p>
|
|
667
679
|
<details id="fb-client-log-details"><summary data-log-label="details">查看操作诊断日志</summary><pre id="fb-client-log-preview"></pre></details>
|
|
668
680
|
<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>
|
|
669
681
|
<p id="fb-client-log-status" role="status" aria-live="polite"></p>
|
|
@@ -685,6 +697,7 @@
|
|
|
685
697
|
</div>
|
|
686
698
|
<div id="feedback-success-title" class="modal-title feedback-success-title" data-i18n="feedback.successTitle">反馈发送成功</div>
|
|
687
699
|
<div class="modal-body feedback-success-body" data-i18n="feedback.successBody">服务器已确认收到这条反馈,感谢你的帮助。</div>
|
|
700
|
+
<p id="feedback-diagnostics-status" class="hidden" role="status" aria-live="polite"></p>
|
|
688
701
|
<div class="modal-actions">
|
|
689
702
|
<button id="feedback-success-confirm" class="btn primary" data-i18n="feedback.successConfirm">知道了</button>
|
|
690
703
|
</div>
|
|
@@ -967,6 +980,7 @@
|
|
|
967
980
|
'conn.reconnectIn': '重连中 {n}s', 'conn.offline': '离线', 'conn.failed': '连接失败',
|
|
968
981
|
'conn.poll': '轮询', 'conn.pollTitle': '当前网络不支持实时推送,已降级为轮询(延迟数秒)',
|
|
969
982
|
'conn.titleGroup': '{group} · {url}({ms})',
|
|
983
|
+
'conn.refresh': '点击刷新连接与数据',
|
|
970
984
|
'common.refreshing': '刷新中…', 'select.choose': '请选择', 'select.cancel': '取消',
|
|
971
985
|
'nav.sessions': '会话', 'nav.files': '文件', 'nav.pending': '待办', 'nav.overview': '总览', 'nav.home': '主页', 'nav.plugins': '插件', 'nav.settings': '设置',
|
|
972
986
|
'overview.eyebrow': 'SYSTEM OVERVIEW', 'overview.title': '主页', 'overview.subtitle': '实时状态与需要你处理的事项',
|
|
@@ -1149,7 +1163,7 @@
|
|
|
1149
1163
|
'settings.servers': '服务器地址(可多个)', 'settings.speedTest': '测速', 'settings.add': '添加',
|
|
1150
1164
|
'settings.scanTitle': '扫码连接', 'settings.scanDesc': '实时相机识别二维码,也可拍照/相册本地解码;无需谷歌服务', 'settings.scan': '扫码',
|
|
1151
1165
|
'settings.notifyTitle': '通知', 'settings.notifyDesc': '收到审批/提问时推送', 'settings.announcementHistoryTitle': '历史公告', 'settings.announcementHistoryDesc': '查看以前收到的公告', 'settings.announcementHistory': '查看记录',
|
|
1152
|
-
'settings.testNotifyTitle': '测试通知', 'settings.testNotifyDesc': '
|
|
1166
|
+
'settings.testApproval': '审批提醒', 'settings.testTurn': '本轮结束', 'settings.testError': '执行失败', 'settings.testNotifyTitle': '测试通知', 'settings.testNotifyDesc': 'Android 使用所选类型的实际通知渠道测试,不执行真实任务', 'settings.testNotify': '发送测试通知',
|
|
1153
1167
|
'settings.testNotifySent': '测试通知已排定,3 秒后到达', 'settings.testNotifyFailed': '发送测试通知失败:{msg}', 'settings.testNotifyUnavailable': '测试通知仅在 App 内可用',
|
|
1154
1168
|
'settings.peakRemindTitle': '峰谷计费提醒 · dsh-cost-meter', 'settings.peakRemindDesc': '按费用插件的峰谷窗口、节假日、提前量与提醒类型发送 Android 通知。无需保持 DSH 页面打开;请允许通知并将系统省电设为无限制。',
|
|
1155
1169
|
'peakRemind.enterPeak': '已进入高峰计费时段', 'peakRemind.enterOff': '已进入空闲计费时段',
|
|
@@ -1157,13 +1171,13 @@
|
|
|
1157
1171
|
'peakRemind.peak1418': '高峰 14:00-18:00', 'peakRemind.off1809': '空闲 18:00-次日 9:00',
|
|
1158
1172
|
'peakRemind.browserOnly': '峰谷提醒仅在 App 内有效',
|
|
1159
1173
|
'peakRemind.on': '峰谷提醒已开启', 'peakRemind.off': '峰谷提醒已关闭', 'peakRemind.failed': '峰谷提醒服务启动失败,请重试',
|
|
1160
|
-
'settings.bgTitle': '后台轮询', 'settings.bgDesc': '
|
|
1174
|
+
'settings.bgTitle': '后台轮询', 'settings.bgDesc': '退后台后由前台服务接收事件;系统省电与服务时限可能延迟提醒',
|
|
1161
1175
|
'settings.bgIntervalTitle': '轮询间隔', 'settings.bgIntervalDesc': '灭屏后系统可能拉长间隔(Doze 平台限制)',
|
|
1162
1176
|
'settings.bgInterval30s': '30 秒', 'settings.bgInterval1m': '1 分钟', 'settings.bgInterval5m': '5 分钟', 'settings.bgInterval15m': '15 分钟',
|
|
1163
1177
|
'settings.bgOn': '后台轮询已开启', 'settings.bgOff': '后台轮询已关闭',
|
|
1164
1178
|
'settings.bgNativeOnly': '后台轮询仅 Android App 内可用', 'settings.bgNeedToken': '请先设置访问令牌',
|
|
1165
1179
|
'settings.bgAuthFailed': '登录失效:连续 3 次 401,后台轮询已停止',
|
|
1166
|
-
'settings.taskDoneTitle': '任务结束通知', 'settings.taskDoneDesc': '
|
|
1180
|
+
'settings.lanDiscover': '搜索电脑', 'settings.taskDoneTitle': '任务结束通知', 'settings.taskDoneDesc': '分别提醒本轮结束、目标完成与执行失败,点击进入对应会话',
|
|
1167
1181
|
'bg.eventTitle': 'dsh-remote:{n} 条新事件', 'bg.eventText': '点击查看',
|
|
1168
1182
|
'presets.title': '预设提示词', 'presets.desc': '常用提示词,对话界面一键插入(最多 20 条)',
|
|
1169
1183
|
'presets.add': '新增', 'presets.edit': '编辑', 'presets.delete': '删除', 'presets.empty': '暂无预设',
|
|
@@ -1192,7 +1206,7 @@
|
|
|
1192
1206
|
'feedback.doctor': 'AI 排查问题', 'feedback.doctorDesc': '使用你的 DSH 和模型,只读诊断',
|
|
1193
1207
|
'feedback.biliDesc': 'UP 动态页交流', 'feedback.copyLink': '复制项目链接', 'feedback.copyDesc': '手动分享给朋友',
|
|
1194
1208
|
'feedback.copied': '项目链接已复制', 'feedback.copyFailed': '复制失败,请手动复制',
|
|
1195
|
-
'feedback.write': '写反馈', 'feedback.writeDesc': 'App 内直接提交', 'feedback.modalTitle': '写反馈', 'feedback.includeDiagnostics': '
|
|
1209
|
+
'feedback.write': '写反馈', 'feedback.writeDesc': 'App 内直接提交', 'feedback.modalTitle': '写反馈', 'feedback.includeDiagnostics': '附带客户端与网关诊断(可选)', 'feedback.diagnosticsPrivacy': '上传客户端操作与错误位置、存储占用、版本和网关链路状态;不含令牌、Cookie、对话正文、答案或完整路径。可在下方预览。', 'feedback.includeCrashes': '附带崩溃日志摘要(可选)', 'feedback.crashPrivacy': '默认仅在本机记录。勾选后上传最近 3 条退出、重启和错误位置摘要,不含对话、密钥或完整路径。', 'feedback.crashPreview': '查看拟上传的日志摘要', 'feedback.crashLoading': '读取本机日志…', 'feedback.crashUnavailable': '当前网关暂时无法读取日志,请更新网关或稍后重试。',
|
|
1196
1210
|
'feedback.typeBug': 'Bug', 'feedback.typeSuggestion': '建议', 'feedback.typeOther': '其他',
|
|
1197
1211
|
'feedback.messagePlaceholder': '请描述遇到的问题或建议(必填,≤2000 字)',
|
|
1198
1212
|
'feedback.contactPlaceholder': '联系方式(可选):邮箱 / 微信 / B站 ID',
|
|
@@ -1209,7 +1223,7 @@
|
|
|
1209
1223
|
'modal.approvalTitle': '工具审批', 'modal.reject': '拒绝', 'modal.allowOnce': '允许一次',
|
|
1210
1224
|
'modal.questionTitle': 'DSH 需要你回答', 'modal.later': '稍后', 'modal.submit': '提交',
|
|
1211
1225
|
'modal.goalTitle': '目标控制', 'modal.close': '关闭', 'modal.updateGoal': '更新目标',
|
|
1212
|
-
'announcement.label': '公告', 'announcement.later': '稍后再看', 'announcement.gotIt': '全部知道了', 'announcement.open': '查看详情', 'announcement.previous': '上一条公告', 'announcement.next': '下一条公告', 'announcement.page': '第 {current} / {total} 条', 'announcement.historyLabel': '公告记录', 'announcement.historyTitle': '历史公告', 'announcement.historyEmpty': '暂无历史公告', 'announcement.close': '关闭', 'announcement.noDate': '未标注日期',
|
|
1226
|
+
'announcement.label': '公告', 'announcement.later': '稍后再看', 'announcement.gotIt': '全部知道了', 'announcement.open': '查看详情', 'announcement.expand': '展开', 'announcement.collapse': '收起', 'announcement.previous': '上一条公告', 'announcement.next': '下一条公告', 'announcement.page': '第 {current} / {total} 条', 'announcement.historyLabel': '公告记录', 'announcement.historyTitle': '历史公告', 'announcement.historyEmpty': '暂无历史公告', 'announcement.close': '关闭', 'announcement.noDate': '未标注日期',
|
|
1213
1227
|
'announcement.voteSubmit': '提交投票', 'announcement.voteChoose': '请先选择一项', 'announcement.voteThanks': '已投票:{option}', 'announcement.voteFailed': '投票失败:{msg}', 'announcement.voteNetworkError': '网络错误', 'announcement.voteAgainLater': '提交太频繁,请稍后再试', 'announcement.voteFromHistory': '参与投票',
|
|
1214
1228
|
'modal.statsTitle': '本轮统计',
|
|
1215
1229
|
'time.justNow': '刚刚', 'time.minAgo': ' 分钟前', 'time.hourAgo': ' 小时前'
|
|
@@ -1231,6 +1245,7 @@
|
|
|
1231
1245
|
'conn.reconnectIn': 'Reconnecting {n}s', 'conn.offline': 'Offline', 'conn.failed': 'Connection failed',
|
|
1232
1246
|
'conn.poll': 'Polling', 'conn.pollTitle': 'Realtime push is unavailable on this network; degraded to polling (a few seconds delay)',
|
|
1233
1247
|
'conn.titleGroup': '{group} · {url} ({ms})',
|
|
1248
|
+
'conn.refresh': 'Click to refresh connection and data',
|
|
1234
1249
|
'common.refreshing': 'Refreshing…', 'select.choose': 'Choose an option', 'select.cancel': 'Cancel',
|
|
1235
1250
|
'nav.sessions': 'Sessions', 'nav.files': 'Files', 'nav.pending': 'Inbox', 'nav.overview': 'Overview', 'nav.home': 'Home', 'nav.plugins': 'Plugins', 'nav.settings': 'Settings',
|
|
1236
1251
|
'overview.eyebrow': 'SYSTEM OVERVIEW', 'overview.title': 'Home', 'overview.subtitle': 'Live status and items needing your attention',
|
|
@@ -1413,7 +1428,7 @@
|
|
|
1413
1428
|
'settings.servers': 'Servers (one or more)', 'settings.speedTest': 'Test', 'settings.add': 'Add',
|
|
1414
1429
|
'settings.scanTitle': 'Scan to pair', 'settings.scanDesc': 'Use the live camera or photo/gallery QR decoding; no Google services required', 'settings.scan': 'Scan',
|
|
1415
1430
|
'settings.notifyTitle': 'Notifications', 'settings.notifyDesc': 'Push on approvals / questions', 'settings.announcementHistoryTitle': 'Announcement history', 'settings.announcementHistoryDesc': 'Review announcements you received before', 'settings.announcementHistory': 'View history',
|
|
1416
|
-
'settings.testNotifyTitle': 'Test notification', 'settings.testNotifyDesc': '
|
|
1431
|
+
'settings.testNotifyTitle': 'Test notification', 'settings.testNotifyDesc': 'Test the selected Android notification channel without running a task', 'settings.testNotify': 'Send test notification',
|
|
1417
1432
|
'settings.testNotifySent': 'Test notification scheduled, arriving in 3s', 'settings.testNotifyFailed': 'Failed to send test notification: {msg}', 'settings.testNotifyUnavailable': 'Test notification is only available in the app',
|
|
1418
1433
|
'settings.peakRemindTitle': 'Peak/off-peak reminders · dsh-cost-meter', 'settings.peakRemindDesc': 'Android notifications follow the plugin’s windows, holidays, lead time and reminder type. The DSH page can be closed. Allow notifications and unrestricted battery use.',
|
|
1419
1434
|
'peakRemind.enterPeak': 'Peak pricing period started', 'peakRemind.enterOff': 'Off-peak pricing period started',
|
|
@@ -1421,13 +1436,13 @@
|
|
|
1421
1436
|
'peakRemind.peak1418': 'Peak 14:00-18:00', 'peakRemind.off1809': 'Off-peak 18:00-9:00 next day',
|
|
1422
1437
|
'peakRemind.browserOnly': 'Peak reminders only work in the app',
|
|
1423
1438
|
'peakRemind.on': 'Peak reminders enabled', 'peakRemind.off': 'Peak reminders disabled', 'peakRemind.failed': 'Could not start peak reminder service; try again',
|
|
1424
|
-
'settings.bgTitle': 'Background polling', 'settings.bgDesc': 'A foreground service
|
|
1439
|
+
'settings.bgTitle': 'Background polling', 'settings.bgDesc': 'A foreground service receives background events; system power and service limits may delay alerts',
|
|
1425
1440
|
'settings.bgIntervalTitle': 'Polling interval', 'settings.bgIntervalDesc': 'Screen-off may stretch the interval (Doze platform limit)',
|
|
1426
1441
|
'settings.bgInterval30s': '30 seconds', 'settings.bgInterval1m': '1 minute', 'settings.bgInterval5m': '5 minutes', 'settings.bgInterval15m': '15 minutes',
|
|
1427
1442
|
'settings.bgOn': 'Background polling enabled', 'settings.bgOff': 'Background polling disabled',
|
|
1428
1443
|
'settings.bgNativeOnly': 'Background polling is only available in the Android app', 'settings.bgNeedToken': 'Set an access token first',
|
|
1429
1444
|
'settings.bgAuthFailed': 'Login expired: 3 consecutive 401s, background polling stopped',
|
|
1430
|
-
'settings.taskDoneTitle': 'Task
|
|
1445
|
+
'settings.lanDiscover': 'Find computer', 'settings.testApproval': 'Approval', 'settings.testTurn': 'Turn finished', 'settings.testError': 'Execution failed', 'settings.taskDoneTitle': 'Task result notifications', 'settings.taskDoneDesc': 'Separate turn, goal and failure alerts; tap to open the session',
|
|
1431
1446
|
'bg.eventTitle': 'dsh-remote: {n} new events', 'bg.eventText': 'Tap to view',
|
|
1432
1447
|
'presets.title': 'Prompt presets', 'presets.desc': 'Common prompts, insert into the composer in one tap (max 20)',
|
|
1433
1448
|
'presets.add': 'Add', 'presets.edit': 'Edit', 'presets.delete': 'Delete', 'presets.empty': 'No presets yet',
|
|
@@ -1456,7 +1471,7 @@
|
|
|
1456
1471
|
'feedback.doctor': 'AI diagnosis', 'feedback.doctorDesc': 'Read-only diagnosis with your own DSH and model',
|
|
1457
1472
|
'feedback.biliDesc': 'Chat on the UP\'s Bilibili page', 'feedback.copyLink': 'Copy project link', 'feedback.copyDesc': 'Share it manually',
|
|
1458
1473
|
'feedback.copied': 'Project link copied', 'feedback.copyFailed': 'Copy failed, copy manually',
|
|
1459
|
-
'feedback.write': 'Write feedback', 'feedback.writeDesc': 'Submit from the app', 'feedback.modalTitle': 'Write feedback', 'feedback.includeDiagnostics': 'Include
|
|
1474
|
+
'feedback.write': 'Write feedback', 'feedback.writeDesc': 'Submit from the app', 'feedback.modalTitle': 'Write feedback', 'feedback.includeDiagnostics': 'Include client and gateway diagnostics (optional)', 'feedback.diagnosticsPrivacy': 'Uploads operation stages, error locations, storage sizes, versions and gateway status. No credentials, conversation bodies, answers or full paths. Preview below.', 'feedback.includeCrashes': 'Include crash summary (optional)', 'feedback.crashPrivacy': 'Recorded locally by default. Opt in to upload up to 3 recent exit, restart and error-location records. No conversations, credentials or full paths.', 'feedback.crashPreview': 'Preview the log summary to upload', 'feedback.crashLoading': 'Reading local logs…', 'feedback.crashUnavailable': 'Logs are unavailable. Update the gateway or try again later.',
|
|
1460
1475
|
'feedback.typeBug': 'Bug', 'feedback.typeSuggestion': 'Suggestion', 'feedback.typeOther': 'Other',
|
|
1461
1476
|
'feedback.messagePlaceholder': 'Describe the bug or suggestion (required, ≤2000 chars)',
|
|
1462
1477
|
'feedback.contactPlaceholder': 'Contact (optional): email / WeChat / Bilibili ID',
|
|
@@ -1473,7 +1488,7 @@
|
|
|
1473
1488
|
'modal.approvalTitle': 'Tool approval', 'modal.reject': 'Reject', 'modal.allowOnce': 'Allow once',
|
|
1474
1489
|
'modal.questionTitle': 'DSH needs your answer', 'modal.later': 'Later', 'modal.submit': 'Submit',
|
|
1475
1490
|
'modal.goalTitle': 'Goal control', 'modal.close': 'Close', 'modal.updateGoal': 'Update goal',
|
|
1476
|
-
'announcement.label': 'Announcement', 'announcement.later': 'Later', 'announcement.gotIt': 'Mark all read', 'announcement.open': 'View details', 'announcement.previous': 'Previous announcement', 'announcement.next': 'Next announcement', 'announcement.page': 'Announcement {current} of {total}', 'announcement.historyLabel': 'Announcement archive', 'announcement.historyTitle': 'Announcement history', 'announcement.historyEmpty': 'No announcement history', 'announcement.close': 'Close', 'announcement.noDate': 'No date',
|
|
1491
|
+
'announcement.label': 'Announcement', 'announcement.later': 'Later', 'announcement.gotIt': 'Mark all read', 'announcement.open': 'View details', 'announcement.expand': 'Expand', 'announcement.collapse': 'Collapse', 'announcement.previous': 'Previous announcement', 'announcement.next': 'Next announcement', 'announcement.page': 'Announcement {current} of {total}', 'announcement.historyLabel': 'Announcement archive', 'announcement.historyTitle': 'Announcement history', 'announcement.historyEmpty': 'No announcement history', 'announcement.close': 'Close', 'announcement.noDate': 'No date',
|
|
1477
1492
|
'announcement.voteSubmit': 'Submit vote', 'announcement.voteChoose': 'Choose an option first', 'announcement.voteThanks': 'Voted: {option}', 'announcement.voteFailed': 'Vote failed: {msg}', 'announcement.voteNetworkError': 'Network error', 'announcement.voteAgainLater': 'Too many submissions; try again later', 'announcement.voteFromHistory': 'Vote now',
|
|
1478
1493
|
'modal.statsTitle': 'This round',
|
|
1479
1494
|
'time.justNow': 'just now', 'time.minAgo': ' min ago', 'time.hourAgo': ' hr ago'
|
|
@@ -1514,6 +1529,11 @@
|
|
|
1514
1529
|
<script src="approval-records.js"></script>
|
|
1515
1530
|
<script src="doctor-entry.js"></script>
|
|
1516
1531
|
<script src="onboarding.js"></script>
|
|
1532
|
+
<link rel="stylesheet" href="file-inbox.css">
|
|
1533
|
+
<script src="file-inbox.js"></script>
|
|
1534
|
+
<link rel="stylesheet" href="session-deck.css">
|
|
1535
|
+
<script src="session-deck.js"></script>
|
|
1536
|
+
<script src="lan-discovery.js"></script>
|
|
1517
1537
|
<script src="app.js"></script>
|
|
1518
1538
|
</body>
|
|
1519
1539
|
</html>
|