dsh-remote-plugin 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apk/dsh-remote.apk +0 -0
- package/gateway.cjs +35 -9
- package/index.mjs +4 -0
- package/package.json +1 -1
- package/public/admin.html +29 -29
- package/public/admin.js +23 -5
- package/public/app.js +61 -7
- package/public/build.json +2 -2
- package/public/desktop/desktop.html +64 -62
- package/public/desktop/desktop.js +13 -1
- package/public/doctor.css +1 -1
- package/public/e2ee-transport.js +35 -11
- package/public/index.html +72 -68
- package/public/operations.js +39 -7
- package/public/plugin.html +25 -25
- package/public/relay-autopair.js +60 -26
- package/public/relay-devices.js +11 -5
- package/public/relay-settings.css +9 -0
- package/public/relay-settings.js +67 -9
- package/public/skins/blue-fish/preview.html +3 -3
- package/public/skins/bocchi/preview.html +5 -5
- package/public/skins/kita/preview.html +6 -6
- package/public/skins/nijika/preview.html +6 -6
- package/public/skins/penguin/preview.html +3 -3
- package/public/skins/ryo/preview.html +6 -6
- package/public/update.json +8 -8
- package/public/version.json +1 -1
- package/public/workflow.css +2 -2
- package/public/workflow.js +20 -13
- package/skills/dsh-remote-doctor/references/wiki/connection.md +2 -0
package/public/relay-autopair.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Bootstrap a device pairing through an authenticated, user-confirmed LAN host. */
|
|
2
2
|
;(function(root) {
|
|
3
3
|
'use strict'
|
|
4
|
-
const bridge = root.NativeE2ee, attempts = new Set(), pairedOrigins = new Map()
|
|
4
|
+
const bridge = root.NativeE2ee, attempts = new Set(), pairedOrigins = new Map(), progress = new Map()
|
|
5
5
|
let busy = false
|
|
6
6
|
const text = (zh, en) => root.I18N?.lang === 'en' ? en : zh
|
|
7
7
|
const LOG_KEY = 'dshRelayPairLogV1', LOG_MAX = 240, WAIT_LIMIT_SECONDS = 90, WAIT_STEP_MS = 2000
|
|
@@ -61,15 +61,17 @@
|
|
|
61
61
|
E2EE_HOST_MISMATCH: ['主机证书与返回的公网地址不匹配。', 'The host certificate does not match the returned public address.'],
|
|
62
62
|
E2EE_STORAGE_UNAVAILABLE: ['手机保存配对失败,请检查存储空间后重试。', 'The phone could not store the pairing. Check storage and retry.'],
|
|
63
63
|
E2EE_CANCELLED: ['已取消自动配对。', 'Automatic pairing was cancelled.'],
|
|
64
|
-
E2EE_PAIR_REQUEST_FAILED: ['
|
|
64
|
+
E2EE_PAIR_REQUEST_FAILED: ['未收到电脑的配对回执。请先在电脑的中转设备列表检查是否已经创建,再决定是否重试。', 'The computer did not return a pairing receipt. Check its relay device list before retrying.'],
|
|
65
65
|
E2EE_NOT_CONFIGURED: ['电脑尚未开启端到端加密中转。', 'Encrypted relay is not enabled on the computer.'],
|
|
66
66
|
E2EE_PAIRING_CHANGED: ['主机证书已变化,请在手机上重新确认后重试。', 'The host certificate changed. Confirm again on the phone and retry.'],
|
|
67
67
|
LOCAL_PAIRING_REQUIRED: ['配对请求必须来自直接局域网连接。', 'The pairing request must come from a direct LAN connection.'],
|
|
68
68
|
RELAY_OPERATION_BUSY: ['主机正在处理另一项中转操作,请稍后重试。', 'The host is busy with another relay operation. Retry shortly.'],
|
|
69
|
+
E2EE_SETUP_ALREADY_USED: ['电脑已收到这张连接码的配对请求。若手机未保存配对,请在电脑关闭连接码,再生成新码。', 'The computer already received a pairing for this code. If the phone did not save it, close the code on the computer and generate a new one.'],
|
|
69
70
|
E2EE_DEVICE_LIMIT: ['这台主机的配对设备数量已达上限。', 'This host has reached its paired-device limit.'],
|
|
70
71
|
E2EE_PAIRING_INVALID: ['主机返回的配对数据不完整或无效。', 'The host returned incomplete or invalid pairing data.'],
|
|
71
72
|
E2EE_IMPORT_FAILED: ['手机未能保存配对(证书可能已变化)。', 'The phone could not store the pairing (the certificate may have changed).'],
|
|
72
73
|
E2EE_RELAY_OFFLINE: ['配对已保存,但主机公网通道在约 90 秒内未就绪;请稍后重试。局域网连接保留。', 'The pairing was saved, but the host relay channel did not become ready within about 90 seconds. Retry later; the LAN connection is kept.'],
|
|
74
|
+
E2EE_SESSION_VERIFY_FAILED: ['已验证公网主机身份,但未能读取会话列表。请检查电脑上的 DSH 后重新验证。', 'The public host identity was verified, but the session list could not be read. Check DSH on the computer, then verify again.'],
|
|
73
75
|
E2EE_VERIFY_FAILED: ['公网通道已在线,但主机身份验证未通过,请稍后重试。局域网连接保留。', 'The relay channel was online but the host identity check failed. Retry later; the LAN connection is kept.'],
|
|
74
76
|
E2EE_BAD_RESPONSE: ['主机返回了无法解析的响应。', 'The host returned an unreadable response.'],
|
|
75
77
|
}
|
|
@@ -77,10 +79,10 @@
|
|
|
77
79
|
const status = error?.httpStatus ? ` HTTP ${error.httpStatus}` : ''
|
|
78
80
|
return text(`${entry[0]}(${code}${status})`, `${entry[1]} (${code}${status})`)
|
|
79
81
|
}
|
|
80
|
-
async function read(c, url, timeout = 8000) {
|
|
82
|
+
async function read(c, url, timeout = 8000, options = {}) {
|
|
81
83
|
let response
|
|
82
84
|
try {
|
|
83
|
-
response = await root.fetch(url, { headers: c.headers, cache: 'no-store', redirect: 'error', signal: root.AbortSignal.timeout(timeout) })
|
|
85
|
+
response = await root.fetch(url, { headers: c.headers, cache: 'no-store', redirect: 'error', signal: root.AbortSignal.timeout(timeout), ...options })
|
|
84
86
|
} catch {
|
|
85
87
|
throw fail('E2EE_HOST_UNAVAILABLE')
|
|
86
88
|
}
|
|
@@ -93,21 +95,24 @@
|
|
|
93
95
|
}
|
|
94
96
|
async function waitOnline(c, endpoint, onProgress) {
|
|
95
97
|
let last = ''
|
|
96
|
-
|
|
98
|
+
const started = Date.now(), deadline = started + WAIT_LIMIT_SECONDS * 1000
|
|
99
|
+
while (c.valid() && Date.now() < deadline) {
|
|
97
100
|
try {
|
|
98
|
-
const status = await read(c, endpoint.href)
|
|
101
|
+
const status = await read(c, endpoint.href, Math.max(1, Math.min(8000, deadline - Date.now())))
|
|
99
102
|
const phase = String(status?.phase || 'unknown')
|
|
100
103
|
if (phase !== last) { last = phase; record('relay.phase', { phase }) }
|
|
101
104
|
if (phase === 'online') return true
|
|
102
105
|
} catch (error) {
|
|
103
106
|
record('relay.phase.error', { code: error?.code || 'E2EE_HOST_UNAVAILABLE', httpStatus: error?.httpStatus })
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
if (!c.valid()) return false
|
|
109
|
+
onProgress?.(Math.min(WAIT_LIMIT_SECONDS, Math.floor((Date.now() - started) / 1000)))
|
|
110
|
+
const remaining = deadline - Date.now()
|
|
111
|
+
if (remaining > 0) await new Promise(resolve => root.setTimeout(resolve, Math.min(WAIT_STEP_MS, remaining)))
|
|
107
112
|
}
|
|
108
113
|
return false
|
|
109
114
|
}
|
|
110
|
-
async function
|
|
115
|
+
async function verifyIdentity(c, origin, pin) {
|
|
111
116
|
for (let attempt = 1; attempt <= 4 && c.valid(); attempt++) {
|
|
112
117
|
try {
|
|
113
118
|
const remote = await read(c, origin + '/relay')
|
|
@@ -121,9 +126,38 @@
|
|
|
121
126
|
}
|
|
122
127
|
return false
|
|
123
128
|
}
|
|
129
|
+
async function verifySessions(c, origin) {
|
|
130
|
+
const method = 'session.list', rpcId = 'relay-check-' + Date.now()
|
|
131
|
+
try {
|
|
132
|
+
const response = await read(c, origin + '/api/' + method, 8000, {
|
|
133
|
+
method: 'POST',
|
|
134
|
+
headers: { ...c.headers, 'content-type': 'application/json', 'x-dsh-remote-client': 'app' },
|
|
135
|
+
body: JSON.stringify({ type: 'client-request', rpcId, method, payload: {} }),
|
|
136
|
+
})
|
|
137
|
+
return response?.result?.ok === true && Array.isArray(response.result.value?.items)
|
|
138
|
+
} catch { return false }
|
|
139
|
+
}
|
|
140
|
+
function contextKey(c) {
|
|
141
|
+
return JSON.stringify([new URL(c.url('/relay'), root.location.href).origin, c.headers?.authorization || ''])
|
|
142
|
+
}
|
|
143
|
+
async function finish(c, endpoint, origin, pin, onPaired, notify) {
|
|
144
|
+
notify(text('公网通道已在线,正在验证主机身份…', 'Relay channel is online. Verifying the host…'))
|
|
145
|
+
if (!await verifyIdentity(c, origin, pin)) throw fail('E2EE_VERIFY_FAILED')
|
|
146
|
+
if (!c.valid()) throw fail('E2EE_CONNECTION_INVALID')
|
|
147
|
+
notify(text('公网主机身份已验证,正在读取会话列表…', 'Public host identity verified. Reading the session list…'))
|
|
148
|
+
if (!await verifySessions(c, origin)) throw fail('E2EE_SESSION_VERIFY_FAILED')
|
|
149
|
+
if (!c.valid()) throw fail('E2EE_CONNECTION_INVALID')
|
|
150
|
+
pairedOrigins.set(endpoint.origin, origin)
|
|
151
|
+
onPaired?.(origin, c)
|
|
152
|
+
notify(text('电脑已确认配对,公网会话读取已验证。局域网连接保留。', 'The computer confirmed pairing and the session list was read over the relay. The LAN connection is kept.'), false, 'ready')
|
|
153
|
+
}
|
|
124
154
|
async function offer({ connection, onPaired, onStatus = () => {}, force = false }) {
|
|
125
155
|
const manual = force === true
|
|
126
|
-
|
|
156
|
+
let key = ''
|
|
157
|
+
const notify = (message, error, phase = error ? 'error' : 'working') => {
|
|
158
|
+
if (key) progress.set(key, { message, phase })
|
|
159
|
+
onStatus?.(message, error === true)
|
|
160
|
+
}
|
|
127
161
|
if (!bridge?.configure) {
|
|
128
162
|
if (manual) { record('skipped', { reason: 'native-unavailable' }); notify(reason('E2EE_NATIVE_UNAVAILABLE')) }
|
|
129
163
|
return { ok: false, code: 'E2EE_NATIVE_UNAVAILABLE' }
|
|
@@ -147,9 +181,10 @@
|
|
|
147
181
|
if (manual) notify(reason('E2EE_CONNECTION_INVALID'), true)
|
|
148
182
|
return { ok: false, code: 'E2EE_CONNECTION_INVALID' }
|
|
149
183
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
attempts.
|
|
184
|
+
key = contextKey(c)
|
|
185
|
+
const attempt = JSON.stringify([key, c.setupId || ''])
|
|
186
|
+
if (!force && attempts.has(attempt)) return { ok: false, code: 'E2EE_ALREADY_ATTEMPTED' }
|
|
187
|
+
attempts.add(attempt); busy = true
|
|
153
188
|
const started = Date.now()
|
|
154
189
|
record('start', { force: manual })
|
|
155
190
|
try {
|
|
@@ -166,11 +201,8 @@
|
|
|
166
201
|
record('existing', { deviceId: old.deviceId })
|
|
167
202
|
notify(text('已保留配对,正在等待公网通道就绪…', 'Saved pairing found. Waiting for the relay channel…'))
|
|
168
203
|
if (host.phase !== 'online' && !await waitOnline(c, endpoint, seconds => notify(text(`已保留配对,正在等待公网通道就绪(${seconds}s)…`, `Saved pairing found. Waiting for the relay channel (${seconds}s)…`)))) throw fail('E2EE_RELAY_OFFLINE')
|
|
169
|
-
|
|
170
|
-
if (!await verify(c, origin, pin)) throw fail('E2EE_VERIFY_FAILED')
|
|
171
|
-
if (c.valid()) { pairedOrigins.set(endpoint.origin, origin); onPaired?.(origin, c) }
|
|
204
|
+
await finish(c, endpoint, origin, pin, onPaired, notify)
|
|
172
205
|
record('verified', { mode: 'existing', ms: Date.now() - started })
|
|
173
|
-
notify(text('公网配对已验证,局域网连接保留。', 'Relay pairing verified. The LAN connection is kept.'))
|
|
174
206
|
return { ok: true, mode: 'existing' }
|
|
175
207
|
}
|
|
176
208
|
if (old.error && old.error !== 'E2EE_DEVICE_EXPIRED') throw fail('E2EE_STORAGE_UNAVAILABLE')
|
|
@@ -179,14 +211,14 @@
|
|
|
179
211
|
+ (old.fingerprint && old.fingerprint !== pin ? '\n' + text('主机证书已改变,将替换旧配对。', 'The host certificate changed. This replaces the previous pairing.') : '')
|
|
180
212
|
if (!root.confirm(message) || !c.valid()) {
|
|
181
213
|
record('cancelled')
|
|
182
|
-
notify(text('已取消自动配对。', 'Automatic pairing was cancelled.'))
|
|
214
|
+
notify(text('已取消自动配对。', 'Automatic pairing was cancelled.'), false, 'idle')
|
|
183
215
|
return { ok: false, code: 'E2EE_CANCELLED' }
|
|
184
216
|
}
|
|
185
217
|
notify(text('正在通过局域网创建并保存配对…', 'Creating and storing the pairing over LAN…'))
|
|
186
218
|
const pairUrl = new URL(endpoint.href); pairUrl.pathname = pairUrl.pathname.replace(/\/$/, '') + '/pair'
|
|
187
219
|
let response, data = {}
|
|
188
220
|
try {
|
|
189
|
-
response = await root.fetch(pairUrl.href, { headers: { ...c.headers, 'content-type': 'application/json' }, cache: 'no-store', redirect: 'error', method: 'POST', body: JSON.stringify({ fingerprint: pin, label: text('Android 手机', 'Android phone') }), signal: root.AbortSignal.timeout(15000) })
|
|
221
|
+
response = await root.fetch(pairUrl.href, { headers: { ...c.headers, 'content-type': 'application/json' }, cache: 'no-store', redirect: 'error', method: 'POST', body: JSON.stringify({ fingerprint: pin, label: text('Android 手机', 'Android phone'), ...(c.setupId ? {setupId:c.setupId} : {}) }), signal: root.AbortSignal.timeout(15000) })
|
|
190
222
|
data = await response.json().catch(() => ({}))
|
|
191
223
|
} catch { throw fail('E2EE_PAIR_REQUEST_FAILED') }
|
|
192
224
|
record('pair.response', { httpStatus: response.status, error: typeof data?.error === 'string' ? data.error : '' })
|
|
@@ -194,24 +226,26 @@
|
|
|
194
226
|
if (!response.ok) throw fail(typeof data?.error === 'string' ? data.error : 'E2EE_HTTP_' + response.status)
|
|
195
227
|
const pair = data.pairing, url = pair && new URL(pair.relayUrl)
|
|
196
228
|
if (!pair || pair.fingerprint !== pin || url.origin !== origin || url.protocol !== 'https:' || url.pathname !== '/relay/v1/e2ee' || url.search || url.hash || url.username || url.password) throw fail('E2EE_PAIRING_INVALID')
|
|
229
|
+
notify(text('电脑已收到并创建设备,正在保存到手机…', 'The computer received the request and created a device. Saving to this phone…'))
|
|
197
230
|
record('paired', { deviceId: String(pair.deviceId || '').slice(0, 64), expiresAt: Number(pair.expiresAt) || 0 })
|
|
198
231
|
const result = JSON.parse(bridge.configure(JSON.stringify(pair), old.fingerprint || ''))
|
|
199
232
|
if (result?.error || result?.origin !== origin) throw fail('E2EE_IMPORT_FAILED')
|
|
200
233
|
record('configured', { origin })
|
|
201
|
-
notify(text('
|
|
234
|
+
notify(text('电脑已确认配对,手机已保存。正在等待公网通道就绪(最多约 90 秒)…', 'The computer confirmed pairing and the phone saved it. Waiting for the relay channel (up to about 90 seconds)…'))
|
|
202
235
|
if (!await waitOnline(c, endpoint, seconds => notify(text(`配对已保存,正在等待主机公网通道就绪(${seconds}s)…`, `Pairing saved. Waiting for the host relay channel (${seconds}s)…`)))) throw fail('E2EE_RELAY_OFFLINE')
|
|
203
|
-
|
|
204
|
-
if (!await verify(c, origin, pin)) throw fail('E2EE_VERIFY_FAILED')
|
|
205
|
-
if (c.valid()) { pairedOrigins.set(endpoint.origin, origin); onPaired?.(origin, c) }
|
|
236
|
+
await finish(c, endpoint, origin, pin, onPaired, notify)
|
|
206
237
|
record('verified', { mode: 'new', ms: Date.now() - started })
|
|
207
|
-
notify(text('公网配对已保存并验证,局域网连接保留。', 'Relay pairing saved and verified. The LAN connection is kept.'))
|
|
208
238
|
return { ok: true, mode: 'new' }
|
|
209
239
|
} catch (error) {
|
|
210
240
|
const code = typeof error?.code === 'string' ? error.code : 'E2EE_PAIR_FAILED'
|
|
211
241
|
record('failed', { code, ms: Date.now() - started, httpStatus: error?.httpStatus })
|
|
212
242
|
if (c.valid()) notify(reason(code, error), true)
|
|
213
243
|
return { ok: false, code }
|
|
214
|
-
} finally {
|
|
244
|
+
} finally {
|
|
245
|
+
if (!c.valid() && progress.get(key)?.phase === 'working') progress.delete(key)
|
|
246
|
+
busy = false
|
|
247
|
+
}
|
|
215
248
|
}
|
|
216
|
-
root.DshRelayAutoPair = { offer, localUrl, logText, clearLog,
|
|
249
|
+
root.DshRelayAutoPair = { offer, localUrl, logText, clearLog,
|
|
250
|
+
progress: c => { try { return progress.get(contextKey(c)) } catch { return undefined } }, pairedOrigin: value => { try { return pairedOrigins.get(new URL(value, root.location.href).origin) || '' } catch { return '' } } }
|
|
217
251
|
})(typeof window !== 'undefined' ? window : globalThis)
|
package/public/relay-devices.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
const make=(tag,value)=>{const e=document.createElement(tag);if(value)e.textContent=value;return e}
|
|
6
6
|
root.DshRelayDevices={mount(target,{connection,path,credentials}){
|
|
7
7
|
const title=make('h3',text('中转设备与配对','Relay devices and pairing'))
|
|
8
|
-
const hint=make('p',text('
|
|
8
|
+
const hint=make('p',text('设备管理请在主机本地地址打开。手机扫码后创建的配对会出现在这里。每台设备的配对独立,最长有效 30 天。','Open management locally on the host. Devices appear here after they pair. Each device pairing is separate and valid for up to 30 days.'))
|
|
9
9
|
const panel=make('div'),enable=make('button',text('启用主机加密入口','Enable encrypted host entry')),refresh=make('button',text('刷新设备','Refresh devices'))
|
|
10
|
+
const manual=make('details'),manualTitle=make('summary',text('手动创建配对文件','Create a pairing file manually'))
|
|
10
11
|
const form=make('form'),label=make('input'),days=make('select'),create=make('button',text('创建设备配对','Create device pairing'))
|
|
11
12
|
form.className='relay-device-form'
|
|
12
13
|
label.placeholder=text('设备名称,例如:我的手机','Device name, e.g. My phone');label.maxLength=80;label.required=true;label.setAttribute('aria-label',label.placeholder)
|
|
@@ -17,7 +18,8 @@
|
|
|
17
18
|
const notice=make('p'),download=make('button',text('保存配对文件(仅本次可用)','Save pairing file (available this time only)'))
|
|
18
19
|
notice.setAttribute('role','status');download.hidden=true
|
|
19
20
|
for(const b of [enable,refresh,rotate,download])b.type='button'
|
|
20
|
-
|
|
21
|
+
manual.append(manualTitle,form,download)
|
|
22
|
+
panel.append(enable,refresh,list,manual,rotate);target.append(title,hint,panel,notice)
|
|
21
23
|
let host=null,data=null,identity='',busy=false,abort=null,pairing=null,disposed=false
|
|
22
24
|
function ctx(){
|
|
23
25
|
const c=connection(),endpoint=new URL(c.url(path.replace(/\/e2ee$/,'')),root.location?.href||'http://localhost/')
|
|
@@ -28,17 +30,21 @@
|
|
|
28
30
|
function valid(c){return !disposed&&c.valid()&&identity===JSON.stringify([c.endpoint,c.headers?.authorization||''])}
|
|
29
31
|
function render(){
|
|
30
32
|
panel.hidden=host?.canManageDevices!==true
|
|
31
|
-
enable.hidden=host?.e2ee?.enabled===true;
|
|
33
|
+
enable.hidden=host?.e2ee?.enabled===true;manual.hidden=!host?.e2ee?.enabled;rotate.hidden=!host?.configured
|
|
32
34
|
for(const b of [enable,refresh,rotate,create,label,days])b.disabled=busy
|
|
33
35
|
download.hidden=!pairing;list.replaceChildren()
|
|
34
36
|
for(const d of data?.devices||[]){
|
|
35
37
|
const row=make('div');row.className='relay-device-row'
|
|
36
|
-
const
|
|
38
|
+
const connection=d.firstPublicAccessAt
|
|
39
|
+
?text('已从公网访问','Reached host over public relay')
|
|
40
|
+
:text('已创建设备','Device created')
|
|
41
|
+
const state=d.active?connection+' · '+text('有效至 ','Valid until ')+new Date(d.expiresAt).toLocaleString():d.revokedAt?text('已撤销','Revoked'):text('已到期','Expired')
|
|
42
|
+
const name=make('span',d.label+' · '+state)
|
|
37
43
|
const revoke=make('button',text('撤销','Revoke'));revoke.type='button';revoke.disabled=busy||!d.active
|
|
38
44
|
revoke.addEventListener('click',()=>{if(root.confirm(text('撤销此设备?连接会立即断开,需要新配对才能再次访问。\n','Revoke this device? Its connections will close and a new pairing will be required.\n')+d.label))void run({action:'revoke-device',id:d.id})})
|
|
39
45
|
row.append(name,revoke);list.append(row)
|
|
40
46
|
}
|
|
41
|
-
if(data&&!data.devices?.length)list.append(make('p',text('
|
|
47
|
+
if(data&&!data.devices?.length)list.append(make('p',text('尚无中转设备,等待手机配对。','No relay devices yet. Pair a phone to get started.')))
|
|
42
48
|
}
|
|
43
49
|
async function run(value){
|
|
44
50
|
const c=ctx();if(busy||host?.canManageDevices!==true)return
|
|
@@ -13,3 +13,12 @@
|
|
|
13
13
|
.relay-pair-log-text{max-height:190px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;font:11px/1.5 ui-monospace,Consolas,monospace;padding:8px;margin:8px 0;border-radius:8px;background:var(--dsr-soft,rgba(127,127,127,.08));color:var(--dsr-muted,var(--text-secondary,#9aa4b2))}
|
|
14
14
|
.relay-pair-log-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
15
15
|
.relay-pair-log-hint{margin:6px 0 0;color:var(--dsr-muted,var(--text-secondary,#9aa4b2))}
|
|
16
|
+
|
|
17
|
+
.relay-pair-guide{margin:14px 0;padding:14px;border:1px solid var(--dsr-accent-line,var(--border,#77889950));border-radius:12px;scroll-margin-top:70px}
|
|
18
|
+
.relay-pair-guide h3{margin:0 0 8px;font-size:16px}
|
|
19
|
+
.relay-pair-guide p{font-size:13px;line-height:1.6;overflow-wrap:anywhere}
|
|
20
|
+
.relay-pair-guide button{margin:0 8px 6px 0}
|
|
21
|
+
.relay-pair-progress[data-phase=ready]{color:var(--success,#237858)}
|
|
22
|
+
.relay-pair-progress[data-phase=error]{color:var(--warning,#9d4b27)}
|
|
23
|
+
.relay-phone-code:not(:empty){display:block;width:min(220px,100%);padding:8px;margin:8px 0;background:#fff;border-radius:8px}
|
|
24
|
+
.relay-phone-code svg{display:block;width:100%;height:auto}
|
package/public/relay-settings.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
INVALID_RESPONSE:['主机返回了无法识别的中转状态,请检查连接地址和主机 Remote 版本。','Unrecognized relay response. Check the host URL and Remote version.'],
|
|
15
15
|
UNSUPPORTED_GATEWAY:['此主机尚不支持云中转设置,请更新主机 Remote。','Update the host Remote to use cloud relay settings.'],
|
|
16
16
|
}
|
|
17
|
-
function mount(target, { connection, path = '/relay', credentials } = {}) {
|
|
17
|
+
function mount(target, { connection, path = '/relay', credentials, phonePairingCode, deviceManagement = true } = {}) {
|
|
18
18
|
if (!target || target.dataset.relayMounted) return
|
|
19
19
|
target.dataset.relayMounted='true';target.classList.add('relay-settings')
|
|
20
20
|
const heading=el('div','relay-heading'),title=el('h3'),badge=el('span','relay-badge')
|
|
@@ -30,24 +30,82 @@
|
|
|
30
30
|
const submit=el('button','relay-primary');submit.type='submit';form.append(keyLabel,adminLabel,submit)
|
|
31
31
|
const actions=el('div','relay-actions'),toggle=el('button'),refresh=el('button'),takeover=el('button');toggle.type=refresh.type=takeover.type='button';actions.append(takeover,toggle,refresh)
|
|
32
32
|
const hint=el('p','relay-muted'),notice=el('p','relay-notice');notice.setAttribute('role','status')
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
33
|
+
const phoneGuide=el('section','relay-pair-guide'),phoneTitle=el('h3'),phoneHint=el('p','relay-muted')
|
|
34
|
+
const showCode=el('button','relay-primary'),hideCode=el('button'),code=el('div','relay-phone-code'),phoneStatus=el('p','relay-pair-progress')
|
|
35
|
+
showCode.type=hideCode.type='button';phoneStatus.setAttribute('role','status')
|
|
36
|
+
phoneTitle.textContent=text('配对一台 Android 手机','Pair an Android phone')
|
|
37
|
+
phoneHint.textContent=text('手机与电脑连接同一局域网。在 DSH Remote 的「主机与连接」扫描下方连接码,并在手机确认。连接码含访问凭据,请私下使用。','Connect the phone and computer to the same LAN. Scan this code in DSH Remote under Hosts and connections, then confirm on the phone. Keep the code private.')
|
|
38
|
+
showCode.textContent=text('添加手机并显示连接码','Add a phone and show connection code')
|
|
39
|
+
hideCode.textContent=text('关闭连接码','Close connection code')
|
|
40
|
+
const recentPair=el('p','relay-muted')
|
|
41
|
+
phoneGuide.append(phoneTitle,phoneHint,showCode,hideCode,code,phoneStatus,recentPair)
|
|
42
|
+
target.append(heading,intro,status)
|
|
43
|
+
if(phonePairingCode)target.append(phoneGuide)
|
|
44
|
+
target.append(sponsor,address,plan,quota,binding,form,actions,hint,notice)
|
|
45
|
+
const deviceTarget=el('div')
|
|
46
|
+
if(deviceManagement)target.append(deviceTarget)
|
|
47
|
+
const devices=deviceManagement?root.DshRelayDevices?.mount(deviceTarget,{connection,path:path+'/e2ee',credentials}):null
|
|
48
|
+
let activeSetup='',pendingSetup=''
|
|
49
|
+
function closeCode(){
|
|
50
|
+
activeSetup='';pendingSetup='';code.textContent='';phoneStatus.textContent=''
|
|
51
|
+
hideCode.hidden=true;showCode.disabled=false
|
|
52
|
+
}
|
|
53
|
+
hideCode.addEventListener('click',closeCode)
|
|
54
|
+
showCode.addEventListener('click',async()=>{
|
|
55
|
+
const ctx=syncIdentity()
|
|
56
|
+
if(pendingSetup||activeSetup||value?.canManageDevices!==true||!value.enabled||!value.e2ee?.configured)return
|
|
57
|
+
const random=root.crypto.getRandomValues(new Uint8Array(16))
|
|
58
|
+
const setup=Array.from(random,byte=>byte.toString(16).padStart(2,'0')).join('')
|
|
59
|
+
pendingSetup=setup;showCode.disabled=true
|
|
60
|
+
phoneStatus.textContent=text('正在生成连接码…','Preparing the connection code…')
|
|
61
|
+
try{
|
|
62
|
+
const svg=await phonePairingCode(setup)
|
|
63
|
+
if(!current(ctx)||pendingSetup!==setup)return
|
|
64
|
+
if(!svg)throw Error('PAIR_CODE_UNAVAILABLE')
|
|
65
|
+
code.innerHTML=svg;activeSetup=setup;hideCode.hidden=false
|
|
66
|
+
phoneStatus.textContent=text('等待手机扫码并确认…','Waiting for the phone to scan and confirm…')
|
|
67
|
+
lastRead=0
|
|
68
|
+
void load()
|
|
69
|
+
}catch{
|
|
70
|
+
if(current(ctx)&&pendingSetup===setup)phoneStatus.textContent=text('暂时无法生成连接码。请确认网关已启动、存在可用局域网地址,再试一次。','Could not prepare the connection code. Check that the gateway is running and has a LAN address, then retry.')
|
|
71
|
+
}finally{if(current(ctx)&&pendingSetup===setup){pendingSetup='';showCode.disabled=!!activeSetup}}
|
|
72
|
+
})
|
|
36
73
|
let identity='',value=null,lastRead=0,busy=false,loading=false,controller=null,destroyed=false,readError=false,failures=0
|
|
37
74
|
function context() { const ctx=connection();return { ...ctx, endpoint:ctx.url(path) } }
|
|
38
75
|
function current(ctx) { return !destroyed && ctx.valid() && identity===JSON.stringify([ctx.endpoint,ctx.headers?.authorization||'']) }
|
|
39
76
|
function syncIdentity() {
|
|
40
77
|
const ctx=context(),next=JSON.stringify([ctx.endpoint,ctx.headers?.authorization||''])
|
|
41
|
-
if(next!==identity){identity=next;controller?.abort();controller=null;keyInput.value='';adminInput.value='';value=null;notice.textContent='';lastRead=0;loading=false;busy=false;readError=false;failures=0;render()}
|
|
78
|
+
if(next!==identity){identity=next;controller?.abort();controller=null;keyInput.value='';adminInput.value='';value=null;notice.textContent='';lastRead=0;loading=false;busy=false;readError=false;failures=0;closeCode();render()}
|
|
42
79
|
return ctx
|
|
43
80
|
}
|
|
44
81
|
function render() {
|
|
45
82
|
devices?.update(value)
|
|
83
|
+
if(phonePairingCode){
|
|
84
|
+
phoneGuide.hidden=value?.canManageDevices!==true||!value.enabled||!value.e2ee?.configured
|
|
85
|
+
if(phoneGuide.hidden&&(activeSetup||pendingSetup))closeCode()
|
|
86
|
+
const activity=Array.isArray(value?.pairingActivity)?value.pairingActivity:[]
|
|
87
|
+
if(activeSetup){
|
|
88
|
+
const recent=activity.find(device=>device.setupId===activeSetup)
|
|
89
|
+
const message=recent?.firstPublicAccessAt
|
|
90
|
+
?text('手机已从公网访问这台电脑。请在手机查看会话验证结果。','The phone reached this computer over the relay. Check the session verification result on the phone.')
|
|
91
|
+
:recent?text('电脑已收到配对,等待手机验证公网。','Pairing received. Waiting for the phone to verify public access.')
|
|
92
|
+
:text('等待手机扫码并确认…','Waiting for the phone to scan and confirm…')
|
|
93
|
+
if(phoneStatus.textContent!==message)phoneStatus.textContent=message
|
|
94
|
+
}
|
|
95
|
+
const latest=activity[activity.length-1]
|
|
96
|
+
recentPair.hidden=!latest
|
|
97
|
+
if(latest){
|
|
98
|
+
const when=new Date(latest.createdAt).toLocaleString()
|
|
99
|
+
const state=latest.firstPublicAccessAt?text('已从公网访问','Reached over public relay'):text('已创建设备,等待公网验证','Device created, awaiting public verification')
|
|
100
|
+
const message=text('最近的设备配对 · ','Most recent device pairing · ')+when+' · '+state
|
|
101
|
+
if(recentPair.textContent!==message)recentPair.textContent=message
|
|
102
|
+
}
|
|
103
|
+
}
|
|
46
104
|
root.DshSponsor?.mount(sponsor)
|
|
47
105
|
title.textContent=text('云服务器中转','Cloud relay')
|
|
48
106
|
intro.textContent=text('让手机通过公网连接这台主机。每位用户使用自己的中转密钥,首次开通会绑定此主机。','Connect to this host over the internet. Your personal relay key binds to this host when activated.')
|
|
49
107
|
const phase=value?.phase||(readError?'unavailable':loading?'loading':'unconfigured')
|
|
50
|
-
const names={loading:['正在读取','Loading'],unavailable:['状态读取失败','Status unavailable'],unconfigured:['尚未开通','Not configured'],disabled:['已停用','Disabled'],connecting:['正在连接','Connecting'],online:['
|
|
108
|
+
const names={loading:['正在读取','Loading'],unavailable:['状态读取失败','Status unavailable'],unconfigured:['尚未开通','Not configured'],disabled:['已停用','Disabled'],connecting:['正在连接','Connecting'],online:['主机中转在线','Host relay online'],reconnecting:['正在重连','Reconnecting'],expired:['授权已到期','Expired'],'authorization-inactive':['授权已撤销或到期','Authorization inactive'],'quota-exceeded':['今日流量已用完','Daily quota reached'],'quota-unavailable':['流量服务暂不可用','Quota service unavailable'],error:['连接异常','Connection error']}
|
|
51
109
|
badge.textContent=phase==='quota-exceeded'&&value?.daily?.period==='month'?text('本月流量已用完','Monthly quota reached'):text(...(names[phase]||names.error));badge.dataset.phase=phase
|
|
52
110
|
status.textContent=busy?text('正在保存并绑定,请稍候…','Saving and binding…'):value?.error?text('请检查主机配置或刷新状态。','Check the host configuration or refresh.'):text('开通后会随 Remote 网关启动,无需单独运行工具。','Starts with the Remote gateway after activation.')
|
|
53
111
|
let safeUrl=''
|
|
@@ -77,7 +135,7 @@
|
|
|
77
135
|
toggle.hidden=!value?.configured;toggle.disabled=busy;toggle.textContent=text(value?.enabled?'停用中转':'开启中转',value?.enabled?'Disable relay':'Enable relay')
|
|
78
136
|
refresh.textContent=text('刷新状态','Refresh');refresh.disabled=busy||loading
|
|
79
137
|
takeover.hidden=!value?.legacyAvailable;takeover.disabled=busy;takeover.textContent=text('接管已有试用连接','Take over existing trial')
|
|
80
|
-
hint.textContent=value?.quotaPending?text('等待云端确认流量额度…','Waiting for cloud quota…'):value?.e2ee?.configured?text('
|
|
138
|
+
hint.textContent=value?.quotaPending?text('等待云端确认流量额度…','Waiting for cloud quota…'):value?.e2ee?.configured?text('Android 可从局域网扫码配对。配对文件可在设备管理中手动创建。','Pair Android over the LAN using a connection code. Manual pairing files are available in device management.'):text('手机使用此公网地址和原 Remote 访问令牌。停用会断开通过此入口的连接;授权到期或用满后,请通过本地地址管理。','Use this URL and your existing Remote access token. Disabling disconnects this route; use a local address after expiry or quota exhaustion.')
|
|
81
139
|
}
|
|
82
140
|
async function load(force=false) {
|
|
83
141
|
const ctx=syncIdentity()
|
|
@@ -115,7 +173,7 @@
|
|
|
115
173
|
const response=await root.fetch(ctx.endpoint,{method:'POST',headers:{...ctx.headers,...(admin?{authorization:'Bearer '+admin}:{}),'content-type':'application/json'},credentials,body:JSON.stringify({action,...(action==='enroll'?{key}:{})}),signal:abort.signal})
|
|
116
174
|
const data=await response.json();if(!current(ctx))return
|
|
117
175
|
if(!response.ok)throw Object.assign(Error(data.error),{code:data.error})
|
|
118
|
-
value=data;notice.textContent=text(action==='disable'?'中转已停用。':'设置已保存,正在确认云端连接。',action==='disable'?'Relay disabled.':'Saved. Confirming the cloud connection.')
|
|
176
|
+
value={...data,canManageDevices:value?.canManageDevices};notice.textContent=text(action==='disable'?'中转已停用。':'设置已保存,正在确认云端连接。',action==='disable'?'Relay disabled.':'Saved. Confirming the cloud connection.')
|
|
119
177
|
}catch(error){if(current(ctx))notice.textContent=messages[error.code]?text(...messages[error.code]):text('暂时无法确认操作结果。请刷新状态后再决定是否重试。','Result unconfirmed. Refresh status before deciding whether to retry.')}
|
|
120
178
|
finally{clearTimeout(timer);if(current(ctx)){busy=false;lastRead=0;render()}}
|
|
121
179
|
}
|
|
@@ -130,7 +188,7 @@
|
|
|
130
188
|
})
|
|
131
189
|
function tick(){if(destroyed)return;syncIdentity();render();void load()}
|
|
132
190
|
const timer=setInterval(tick,1000);tick()
|
|
133
|
-
return { refresh:()=>load(true),destroy:()=>{destroyed=true;clearInterval(timer);controller?.abort();devices?.destroy();keyInput.value='';adminInput.value=''} }
|
|
191
|
+
return { refresh:()=>load(true),destroy:()=>{destroyed=true;clearInterval(timer);controller?.abort();closeCode();devices?.destroy();keyInput.value='';adminInput.value=''} }
|
|
134
192
|
}
|
|
135
193
|
root.DshRelaySettings={mount}
|
|
136
194
|
})(typeof window!=='undefined'?window:globalThis)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!doctype html><html lang="zh-CN" data-theme="fish"><head><meta name="dsh-remote-build" content="
|
|
2
|
-
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>蓝色大肥鱼 · 晴空海湾 · 组件预览</title><link rel="stylesheet" href="../../styles.css?dsr-build=
|
|
1
|
+
<!doctype html><html lang="zh-CN" data-theme="fish"><head><meta name="dsh-remote-build" content="7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
2
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>蓝色大肥鱼 · 晴空海湾 · 组件预览</title><link rel="stylesheet" href="../../styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="../../workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><style>body{padding:28px 20px 40px}.preview-shell{max-width:980px;margin:auto}.preview-header{margin-bottom:26px}.preview-header h1{font-size:29px;line-height:1.3;margin:10px 0}.preview-header p{font-size:14px;max-width:680px;color:var(--dsr-muted)}.preview-layout{display:grid;grid-template-columns:390px minmax(0,1fr);gap:26px;align-items:start}iframe{display:block;width:100%;height:844px;border:1px solid var(--dsr-line);border-radius:18px;background:var(--dsr-bg)}.preview-card{padding:22px;margin:0 0 18px;background:var(--dsr-panel);border:1px solid var(--dsr-line);border-radius:12px}.preview-card h2{font-size:17px;margin:0 0 14px}.preview-card p,.preview-card li{font-size:13px;line-height:1.8;color:var(--dsr-muted)}.preview-icons{display:flex;align-items:center;gap:18px}.preview-icons img{width:58px;height:54px;object-fit:contain}.preview-links,.preview-switch{display:flex;gap:12px;flex-wrap:wrap;font-size:13px;margin:12px 0}.preview-links a{color:var(--dsr-accent-strong)}.preview-switch button{padding:8px 16px;border:1px solid var(--dsr-line);border-radius:8px;background:var(--dsr-panel);color:var(--dsr-text);font:inherit}.preview-switch button[aria-pressed=true]{background:var(--dsr-accent);color:var(--dsr-on-accent)}@media(max-width:760px){.preview-layout{grid-template-columns:minmax(0,390px);justify-content:center}.preview-header h1{font-size:25px}}</style></head><body><main class="preview-shell"><header class="preview-header"><h1>蓝色大肥鱼 · 晴空海湾</h1><p>气泡、爱心、星星与蓝白内容卡。表情导航保留文字,立绘增加柔和贴纸边框。</p><nav class="preview-links"><a href="DESIGN.md">皮肤维护说明</a><a href="../../index.html?layout=mobile">实际手机入口</a><a href="../../desktop/desktop.html">实际桌面入口</a></nav><div class="preview-switch" role="group" aria-label="预览配色"><button type="button" data-preview-theme="fish" aria-pressed="true">蓝色大肥鱼</button></div></header><section class="preview-layout"><iframe id="phone" title="手机组件预览"></iframe><aside><section class="preview-card"><h2>表情导航 · 文字保留</h2><div class="preview-icons"><img src="icon.png" alt="会话表情"><img src="icon-wink.png" alt="文件表情"><img src="icon-star.png" alt="更多表情"></div><p>表情在原有图标位内展示,不向列表上方额外挂一排头像。文字、未读徽标与原有点击区保留。</p></section><section class="preview-card"><h2>角色与阅读层级</h2><p>原有角色图片全部保留,加入眨眼贴纸、粉色导航小圆垫和虚线贴纸框。气泡与星星留在阅读留白处。</p></section><section class="preview-card"><h2>实际界面验收</h2><ol><li>320/390px 手机与桌面布局。</li><li>立绘不压住标题和连接入口。</li><li>导航、输入区保持既有固定定位。</li><li>归档关闭、半滑、展开与确认框。</li></ol><p>此页是无主机连接的静态组件样板;完整交互以实际 WebUI 验收为准。</p></section></aside></section></main><template id="phone-components">
|
|
3
3
|
<header class="topbar"><div class="brand"><span class="brand-dot"></span><span>DSH Remote</span></div><span class="pill">未连接</span></header>
|
|
4
4
|
<main class="main" id="main"><section class="view" id="view-home">
|
|
5
5
|
<section class="workflow-start"><div class="workflow-page-head"><h1>工作空间</h1><button type="button" class="workflow-connection">工作电脑 · 连接详情</button><button type="button" class="home-doctor"><span>AI 排查问题</span><small>使用你的 DSH 和模型,只读诊断</small><b>›</b></button></div><div class="workspace-nav"><span>DSH Remote</span><button type="button" class="mini-btn">查看文件</button></div><button type="button" id="btn-new-session" class="mini-btn workflow-new-session">+ 新会话</button></section>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<div class="session-swipe"><div class="session-card"><div class="sc-title">准备版本更新说明</div><div class="sc-meta">3 分钟前</div><div class="sc-workspace">⌂ dsh-remote</div></div></div>
|
|
10
10
|
</section></main>
|
|
11
11
|
<nav class="bottom-nav"><button type="button" class="nav-btn active" data-view="view-home"><span class="nav-ico">▦</span><span class="nav-label">会话</span></button><button type="button" class="nav-btn" data-view="view-files"><span class="nav-ico">↕</span><span class="nav-label">文件</span></button><button type="button" class="nav-btn" data-view="view-settings"><span class="nav-ico">⚙</span><span class="nav-label">更多</span></button></nav>
|
|
12
|
-
</template><script>const base=new URL('../../',location.href).href;const frame=document.getElementById('phone');frame.srcdoc='<!doctype html><html lang="zh-CN" data-theme="fish"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=
|
|
12
|
+
</template><script>const base=new URL('../../',location.href).href;const frame=document.getElementById('phone');frame.srcdoc='<!doctype html><html lang="zh-CN" data-theme="fish"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/blue-fish/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"></head><body class="workflow-v8">'+document.getElementById('phone-components').innerHTML+'</body></html>';document.querySelectorAll('[data-preview-theme]').forEach(button=>button.addEventListener('click',()=>{document.documentElement.dataset.theme=button.dataset.previewTheme;if(frame.contentDocument?.documentElement)frame.contentDocument.documentElement.dataset.theme=button.dataset.previewTheme;document.querySelectorAll('[data-preview-theme]').forEach(b=>b.setAttribute('aria-pressed',String(b===button)))}));</script></body></html>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="zh-CN" data-theme="bocchi">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="dsh-remote-build" content="
|
|
4
|
+
<meta name="dsh-remote-build" content="7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
5
5
|
<meta charset="utf-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
7
|
<title>后藤一里 · 皮肤样板预览</title>
|
|
8
|
-
<link rel="stylesheet" href="../../styles.css?dsr-build=
|
|
9
|
-
<link rel="stylesheet" href="../../workflow.css?dsr-build=
|
|
10
|
-
<link rel="stylesheet" href="skin.css?dsr-build=
|
|
8
|
+
<link rel="stylesheet" href="../../styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
9
|
+
<link rel="stylesheet" href="../../workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
10
|
+
<link rel="stylesheet" href="skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
11
11
|
<style>
|
|
12
12
|
/* 只负责展示页排版;画框内完全复用实际组件样式,不重画玻璃或背景。 */
|
|
13
13
|
body{padding:28px 20px 40px}.preview-shell{max-width:980px;margin:auto}.preview-label{font:11px ui-monospace,monospace;letter-spacing:.15em;color:var(--dsr-muted)}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
<script>
|
|
51
51
|
const base=new URL('../../',location.href).href
|
|
52
|
-
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="bocchi"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=
|
|
52
|
+
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="bocchi"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/bocchi/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"></head><body class="workflow-v8">'+document.getElementById('phone-components').innerHTML+'</body></html>'
|
|
53
53
|
</script>
|
|
54
54
|
</body>
|
|
55
55
|
</html>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="zh-CN" data-theme="kita">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="dsh-remote-build" content="
|
|
4
|
+
<meta name="dsh-remote-build" content="7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
5
5
|
<meta charset="utf-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
7
|
<title>喜多郁代 · 皮肤样板预览</title>
|
|
8
|
-
<link rel="stylesheet" href="../../styles.css?dsr-build=
|
|
9
|
-
<link rel="stylesheet" href="../../workflow.css?dsr-build=
|
|
10
|
-
<link rel="stylesheet" href="../kessoku/skin.css?dsr-build=
|
|
11
|
-
<link rel="stylesheet" href="skin.css?dsr-build=
|
|
8
|
+
<link rel="stylesheet" href="../../styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
9
|
+
<link rel="stylesheet" href="../../workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
10
|
+
<link rel="stylesheet" href="../kessoku/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
11
|
+
<link rel="stylesheet" href="skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
12
12
|
<style>
|
|
13
13
|
/* 只负责展示页排版;画框内完全复用实际组件样式,不重画玻璃或背景。 */
|
|
14
14
|
body{padding:28px 20px 40px}.preview-shell{max-width:980px;margin:auto}.preview-label{font:11px ui-monospace,monospace;letter-spacing:.15em;color:var(--dsr-muted)}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
<script>
|
|
52
52
|
const base=new URL('../../',location.href).href
|
|
53
|
-
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="kita"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=
|
|
53
|
+
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="kita"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/kessoku/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/kita/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"></head><body class="workflow-v8">'+document.getElementById('phone-components').innerHTML+'</body></html>'
|
|
54
54
|
</script>
|
|
55
55
|
</body>
|
|
56
56
|
</html>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="zh-CN" data-theme="nijika">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="dsh-remote-build" content="
|
|
4
|
+
<meta name="dsh-remote-build" content="7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
5
5
|
<meta charset="utf-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
7
|
<title>伊地知虹夏 · 皮肤样板预览</title>
|
|
8
|
-
<link rel="stylesheet" href="../../styles.css?dsr-build=
|
|
9
|
-
<link rel="stylesheet" href="../../workflow.css?dsr-build=
|
|
10
|
-
<link rel="stylesheet" href="../kessoku/skin.css?dsr-build=
|
|
11
|
-
<link rel="stylesheet" href="skin.css?dsr-build=
|
|
8
|
+
<link rel="stylesheet" href="../../styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
9
|
+
<link rel="stylesheet" href="../../workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
10
|
+
<link rel="stylesheet" href="../kessoku/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
11
|
+
<link rel="stylesheet" href="skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
12
12
|
<style>
|
|
13
13
|
/* 只负责展示页排版;画框内完全复用实际组件样式,不重画玻璃或背景。 */
|
|
14
14
|
body{padding:28px 20px 40px}.preview-shell{max-width:980px;margin:auto}.preview-label{font:11px ui-monospace,monospace;letter-spacing:.15em;color:var(--dsr-muted)}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
<script>
|
|
52
52
|
const base=new URL('../../',location.href).href
|
|
53
|
-
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="nijika"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=
|
|
53
|
+
document.getElementById('phone').srcdoc='<!doctype html><html lang="zh-CN" data-theme="nijika"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/kessoku/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/nijika/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"></head><body class="workflow-v8">'+document.getElementById('phone-components').innerHTML+'</body></html>'
|
|
54
54
|
</script>
|
|
55
55
|
</body>
|
|
56
56
|
</html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!doctype html><html lang="zh-CN" data-theme="penguin"><head><meta name="dsh-remote-build" content="
|
|
2
|
-
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>企鹅女管 · 黑黄工业终端 · 组件预览</title><link rel="stylesheet" href="../../styles.css?dsr-build=
|
|
1
|
+
<!doctype html><html lang="zh-CN" data-theme="penguin"><head><meta name="dsh-remote-build" content="7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3">
|
|
2
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>企鹅女管 · 黑黄工业终端 · 组件预览</title><link rel="stylesheet" href="../../styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="../../workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><style>body{padding:28px 20px 40px}.preview-shell{max-width:980px;margin:auto}.preview-header{margin-bottom:26px}.preview-header h1{font-size:29px;line-height:1.3;margin:10px 0}.preview-header p{font-size:14px;max-width:680px;color:var(--dsr-muted)}.preview-layout{display:grid;grid-template-columns:390px minmax(0,1fr);gap:26px;align-items:start}iframe{display:block;width:100%;height:844px;border:1px solid var(--dsr-line);border-radius:18px;background:var(--dsr-bg)}.preview-card{padding:22px;margin:0 0 18px;background:var(--dsr-panel);border:1px solid var(--dsr-line);border-radius:12px}.preview-card h2{font-size:17px;margin:0 0 14px}.preview-card p,.preview-card li{font-size:13px;line-height:1.8;color:var(--dsr-muted)}.preview-icons{display:flex;align-items:center;gap:18px}.preview-icons img{width:58px;height:54px;object-fit:contain}.preview-links,.preview-switch{display:flex;gap:12px;flex-wrap:wrap;font-size:13px;margin:12px 0}.preview-links a{color:var(--dsr-accent-strong)}.preview-switch button{padding:8px 16px;border:1px solid var(--dsr-line);border-radius:8px;background:var(--dsr-panel);color:var(--dsr-text);font:inherit}.preview-switch button[aria-pressed=true]{background:var(--dsr-accent);color:var(--dsr-on-accent)}@media(max-width:760px){.preview-layout{grid-template-columns:minmax(0,390px);justify-content:center}.preview-header h1{font-size:25px}}</style></head><body><main class="preview-shell"><header class="preview-header"><h1>企鹅女管 · 黑黄工业终端</h1><p>新增官网三角阵列、终末地工业铭牌和帝江/集成工业主题线路图,保留黑黄终端界面。 </p><nav class="preview-links"><a href="DESIGN.md">皮肤维护说明</a><a href="../../index.html?layout=mobile">实际手机入口</a><a href="../../desktop/desktop.html">实际桌面入口</a></nav><div class="preview-switch" role="group" aria-label="预览配色"><button type="button" data-preview-theme="penguin" aria-pressed="true">白昼</button><button type="button" data-preview-theme="penguin-night" aria-pressed="false">极夜</button></div></header><section class="preview-layout"><iframe id="phone" title="手机组件预览"></iframe><aside><section class="preview-card"><h2>表情导航 · 文字保留</h2><div class="preview-icons"><img src="icon.png" alt="会话表情"><img src="icon-dizzy.png" alt="文件表情"><img src="icon-wink.png" alt="更多表情"></div><p>表情在原有图标位内展示,不向列表上方额外挂一排头像。文字、未读徽标与原有点击区保留。</p></section><section class="preview-card"><h2>角色与阅读层级</h2><p>白昼使用冷白与墨黑操作条,极夜使用炭黑与信号黄。三角标记、切角和工程网格在两套中保持一致;线路图为主题装饰示意。</p></section><section class="preview-card"><h2>实际界面验收</h2><ol><li>320/390px 手机与桌面布局。</li><li>立绘不压住标题和连接入口。</li><li>导航、输入区保持既有固定定位。</li><li>归档关闭、半滑、展开与确认框。</li></ol><p>此页是无主机连接的静态组件样板;完整交互以实际 WebUI 验收为准。</p></section></aside></section></main><template id="phone-components">
|
|
3
3
|
<header class="topbar"><div class="brand"><span class="brand-dot"></span><span>DSH Remote</span></div><span class="pill">未连接</span></header>
|
|
4
4
|
<main class="main" id="main"><section class="view" id="view-home">
|
|
5
5
|
<section class="workflow-start"><div class="workflow-page-head"><h1>工作空间</h1><button type="button" class="workflow-connection">工作电脑 · 连接详情</button><button type="button" class="home-doctor"><span>AI 排查问题</span><small>使用你的 DSH 和模型,只读诊断</small><b>›</b></button></div><div class="workspace-nav"><span>DSH Remote</span><button type="button" class="mini-btn">查看文件</button></div><button type="button" id="btn-new-session" class="mini-btn workflow-new-session">+ 新会话</button></section>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<div class="session-swipe"><div class="session-card"><div class="sc-title">准备版本更新说明</div><div class="sc-meta">3 分钟前</div><div class="sc-workspace">⌂ dsh-remote</div></div></div>
|
|
10
10
|
</section></main>
|
|
11
11
|
<nav class="bottom-nav"><button type="button" class="nav-btn active" data-view="view-home"><span class="nav-ico">▦</span><span class="nav-label">会话</span></button><button type="button" class="nav-btn" data-view="view-files"><span class="nav-ico">↕</span><span class="nav-label">文件</span></button><button type="button" class="nav-btn" data-view="view-settings"><span class="nav-ico">⚙</span><span class="nav-label">更多</span></button></nav>
|
|
12
|
-
</template><script>const base=new URL('../../',location.href).href;const frame=document.getElementById('phone');frame.srcdoc='<!doctype html><html lang="zh-CN" data-theme="penguin"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=
|
|
12
|
+
</template><script>const base=new URL('../../',location.href).href;const frame=document.getElementById('phone');frame.srcdoc='<!doctype html><html lang="zh-CN" data-theme="penguin"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><base href="'+base+'"><link rel="stylesheet" href="styles.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="workflow.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"><link rel="stylesheet" href="skins/penguin/skin.css?dsr-build=7b7352352544bd35e441ffdb4de480368defbe9386c58dff9a6ed41c2318b2e3"></head><body class="workflow-v8">'+document.getElementById('phone-components').innerHTML+'</body></html>';document.querySelectorAll('[data-preview-theme]').forEach(button=>button.addEventListener('click',()=>{document.documentElement.dataset.theme=button.dataset.previewTheme;if(frame.contentDocument?.documentElement)frame.contentDocument.documentElement.dataset.theme=button.dataset.previewTheme;document.querySelectorAll('[data-preview-theme]').forEach(b=>b.setAttribute('aria-pressed',String(b===button)))}));</script></body></html>
|