dsh-remote-plugin 0.8.8 → 0.9.0
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 +16 -5
- package/README.md +15 -4
- package/apk/dsh-remote.apk +0 -0
- package/gateway.cjs +527 -78
- package/index.mjs +1 -0
- package/package.json +8 -3
- package/public/activity.js +53 -4
- package/public/admin.html +34 -33
- package/public/admin.js +10 -2
- package/public/app.js +1204 -174
- package/public/bc-integration.css +81 -0
- package/public/build.json +2 -2
- package/public/composer-tools.css +184 -0
- package/public/composer-tools.js +888 -0
- package/public/desktop/desktop.html +92 -73
- package/public/desktop/desktop.js +631 -77
- package/public/file-inbox.js +77 -18
- package/public/genui.css +10 -0
- package/public/genui.js +22 -4
- package/public/host-queue.js +232 -0
- package/public/host-schedule.js +301 -0
- package/public/host-state.css +19 -0
- package/public/index.html +330 -140
- package/public/md.js +21 -1
- package/public/network.js +33 -1
- package/public/onboarding.js +3 -3
- package/public/operations.js +4 -3
- package/public/plan-review.css +297 -0
- package/public/plan-review.js +621 -0
- package/public/plugin.html +29 -28
- package/public/relay-autopair.js +25 -10
- package/public/relay-settings.css +11 -0
- package/public/relay-settings.js +350 -28
- package/public/session-management.css +61 -0
- package/public/session-management.js +742 -0
- package/public/session-search.css +137 -0
- package/public/session-search.js +977 -0
- 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/miku/SOURCES.json +10 -0
- package/public/skins/miku/chibi.png +0 -0
- package/public/skins/miku/preview.html +33 -0
- package/public/skins/miku/skin.css +82 -0
- 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/slash-suggestions.js +15 -3
- package/public/sponsor-entry.js +11 -3
- package/public/styles.css +141 -21
- package/public/subagents.css +5 -0
- package/public/subagents.js +52 -0
- package/public/theme-vars.css +65 -1
- package/public/theme.js +4 -3
- package/public/turn-diff.css +323 -0
- package/public/turn-diff.js +778 -0
- package/public/update.json +8 -8
- package/public/version.json +1 -1
- package/public/workflow.css +305 -34
- package/public/workflow.js +141 -41
package/public/workflow.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
const label = (zh,en) => root.I18N?.lang === 'en' ? en : zh
|
|
10
10
|
function element(tag,cls,text) { const el=document.createElement(tag);if(cls)el.className=cls;if(text)el.textContent=text;return el }
|
|
11
11
|
function icon(name) {
|
|
12
|
-
const paths={host:'M3 4h18v12H3zM8 21h8m-4-5v5',plugins:'M9 3h6v6h6v6h-6v6H9v-6H3V9h6z',
|
|
12
|
+
const paths={host:'M3 4h18v12H3zM8 21h8m-4-5v5',plugins:'M9 3h6v6h6v6h-6v6H9v-6H3V9h6z',schedule:'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0ZM12 7v5l3 2',
|
|
13
|
+
relay:'M6 18a4 4 0 1 1 .4-8A6 6 0 0 1 18 9a4.5 4.5 0 0 1-.5 9H6Z',
|
|
13
14
|
receipts:'M6 3h12v18l-3-2-3 2-3-2-3 2zM9 8h6m-6 4h6',general:'M12 3v3m0 12v3M3 12h3m12 0h3M6 6l2 2m8 8 2 2M6 18l2-2M16 8l2-2M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0',
|
|
14
15
|
model:'m12 3 9 5-9 5-9-5zM3 12l9 5 9-5M3 16l9 5 9-5',notify:'M6 9a6 6 0 0 1 12 0c0 7 3 7 3 8H3c0-1 3-1 3-8m4 12h4',about:'M12 11v6m0-10v.1M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0'}
|
|
15
16
|
const svg=document.createElementNS('http://www.w3.org/2000/svg','svg')
|
|
@@ -125,7 +126,24 @@
|
|
|
125
126
|
function connectionDetails() {
|
|
126
127
|
const content=element('div','workflow-connection-content'),snapshot=config.snapshot()
|
|
127
128
|
content.append(element('p','',snapshot.host||label('当前页面主机','Current host')))
|
|
128
|
-
|
|
129
|
+
const issue=snapshot.connectionIssue
|
|
130
|
+
if(snapshot.address&&snapshot.address!==snapshot.host)content.append(element('p','workflow-muted workflow-connection-address',snapshot.address))
|
|
131
|
+
if(issue){
|
|
132
|
+
const guide=element('section','workflow-connection-guide'),steps=element('ol')
|
|
133
|
+
guide.append(element('h3','',issue===426
|
|
134
|
+
?label('公网需要加密配对(426)','Public access requires encrypted pairing (426)')
|
|
135
|
+
:label('当前地址访问被拒绝(401)','Access denied at this address (401)')))
|
|
136
|
+
for(const step of [
|
|
137
|
+
label('在「主机与连接」核对当前域名或地址,确认它和电脑显示的公网入口一致。','In Hosts and connections, match the selected address to the public address shown on the host.'),
|
|
138
|
+
issue===426
|
|
139
|
+
?label('切到可用的局域网地址,在「云中转 → 手机公网配对」完成验证,再切回公网。','Switch to a working LAN address. Verify pairing under Cloud relay → Pair this phone, then switch back to public access.')
|
|
140
|
+
:label('如果仅公网报错,先切回可用的局域网地址,再到「云中转」验证公网配对。如果局域网也报错,在电脑上核对当前地址对应的 Remote 访问令牌。','If only public access fails, switch to the working LAN address and verify pairing in Cloud relay. If LAN also fails, verify the Remote access token for that address on the host.'),
|
|
141
|
+
label('如果这个地址无法提交反馈,可以先复制或导出本地操作日志。','If feedback cannot be sent on this connection, copy or export the local operation log.')
|
|
142
|
+
])steps.append(element('li','',step))
|
|
143
|
+
guide.append(steps);content.append(guide)
|
|
144
|
+
}else{
|
|
145
|
+
content.append(element('p','workflow-muted',label('连接主机后,工作区与会话始终归属这台主机。','Workspaces and conversations belong to the selected host.')))
|
|
146
|
+
}
|
|
129
147
|
const links=$(config.desktop?'view-overview':'view-activity')
|
|
130
148
|
if(links){
|
|
131
149
|
const details=element('details','workflow-technical'),summary=element('summary','',label('连接与运行详情','Connection details'))
|
|
@@ -135,9 +153,17 @@
|
|
|
135
153
|
}
|
|
136
154
|
details.append(clone);content.append(details)
|
|
137
155
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
const actions=issue?element('div','workflow-connection-actions'):content
|
|
157
|
+
actions.append(button('重新检查','Check connection',()=>{config.retry();close()}),button('主机与连接','Hosts and connections',()=>{close();config.settings('servers')}))
|
|
158
|
+
if(issue){
|
|
159
|
+
actions.append(button('本地操作日志','Local operation log',()=>{close();root.DshDiagnostics?.show()}),
|
|
160
|
+
button('写反馈','Write feedback',()=>{close();config.feedback?.({preserveDraft:true})}))
|
|
161
|
+
content.append(actions)
|
|
162
|
+
}else{
|
|
163
|
+
if (!config.desktop && config.doctor) content.append(button('AI 排查问题', 'AI diagnosis', () => { close(); config.doctor() }))
|
|
164
|
+
if(snapshot.gateway)content.append(button('打开管理控制台','Open management console',()=>config.admin()))
|
|
165
|
+
}
|
|
166
|
+
openSheet(issue?label('连接排查','Connection troubleshooting'):label('当前主机','Current host'),content);translate()
|
|
141
167
|
}
|
|
142
168
|
async function refreshCacheSummary(){
|
|
143
169
|
if(!cacheSummary||cacheReading)return
|
|
@@ -158,27 +184,33 @@
|
|
|
158
184
|
}
|
|
159
185
|
function setupMore() {
|
|
160
186
|
const home=$('settings-home');if(!home)return
|
|
161
|
-
const intro=element('
|
|
187
|
+
const intro=element('header',config.desktop?'workflow-page-head':'mobile-page-head');const heading=element('h1');rename(heading,'更多','More');intro.append(heading);home.prepend(intro)
|
|
162
188
|
const plugins=button('主机插件','Host plugins',()=>config.plugins(),'workflow-setting-link')
|
|
163
189
|
const receipts=button('审批与操作回执','Approvals and receipts',showOperations,'workflow-setting-link')
|
|
164
190
|
const main=home.querySelector('.settings-group,.ds-settings');main?.prepend(plugins);main?.append(receipts)
|
|
165
|
-
const names={servers:['主机与连接','Hosts and connections'],general:['外观与输入','Appearance and input'],model:['模型与提供方','Models and providers'],notify:['通知与后台','Notifications and background'],about:['关于与维护','About and maintenance']}
|
|
166
|
-
const descriptions={servers:['连接地址、访问令牌与公网中转','Addresses, access tokens and cloud relay'],general:['主题、语言、输入与常用提示词','Theme, language, input and reusable prompts'],model:['提供方、访问凭据与模型目录','Providers, credentials and model catalog'],notify:['消息提醒与后台接收','Event notifications and background delivery'],about:['版本、公告、反馈与本地数据','Version, announcements, feedback and local data']}
|
|
191
|
+
const names={servers:['主机与连接','Hosts and connections'],'cloud-relay':['云中转','Cloud relay'],general:['外观与输入','Appearance and input'],model:['模型与提供方','Models and providers'],notify:['通知与后台','Notifications and background'],about:['关于与维护','About and maintenance']}
|
|
192
|
+
const descriptions={servers:config.desktop?['连接地址、访问令牌与公网中转','Addresses, access tokens and cloud relay']:['扫码、地址与令牌','Pairing, addresses and access tokens'],'cloud-relay':['公网接入、登记与续费','Remote access, registration and renewal'],general:['主题、语言、输入与常用提示词','Theme, language, input and reusable prompts'],model:['提供方、访问凭据与模型目录','Providers, credentials and model catalog'],notify:['消息提醒与后台接收','Event notifications and background delivery'],about:['版本、公告、反馈与本地数据','Version, announcements, feedback and local data']}
|
|
167
193
|
for(const [key,nameset] of Object.entries(names)){
|
|
168
194
|
const row=home.querySelector(`[data-settings-group="${key}"]`)
|
|
169
195
|
rename(row?.querySelector('.setting-name,.ds-setting-name'),...nameset)
|
|
170
196
|
rename(row?.querySelector('.setting-desc,.ds-setting-desc'),...descriptions[key])
|
|
171
197
|
const page=$('settings-page-'+key)
|
|
172
198
|
rename(page?.querySelector('[data-settings-back] .setting-name,[data-settings-back] .ds-setting-name'),...nameset)
|
|
173
|
-
if(row){const mark=element('span','workflow-setting-icon');mark.append(icon(key==='servers'?'host':key));row.prepend(mark)}
|
|
199
|
+
if(row){const mark=element('span','workflow-setting-icon');mark.append(icon(key==='servers'?'host':key==='cloud-relay'?'relay':key));row.prepend(mark)}
|
|
174
200
|
}
|
|
175
|
-
|
|
201
|
+
const workLinks = [[plugins, 'plugins'], [receipts, 'receipts']]
|
|
202
|
+
const schedule = $('btn-host-schedule')
|
|
203
|
+
if (schedule) workLinks.push([schedule, 'schedule'])
|
|
204
|
+
for(const [target,name] of workLinks){const mark=element('span','workflow-setting-icon');mark.append(icon(name));target.prepend(mark)}
|
|
176
205
|
const work=element('section','workflow-more-group'),preferences=element('section','workflow-more-group')
|
|
177
206
|
const workTitle=element('h2'),preferenceTitle=element('h2');rename(workTitle,'连接与工作','Connections and work');rename(preferenceTitle,'偏好与维护','Preferences and maintenance')
|
|
178
207
|
const workList=element('div','workflow-settings-list'),preferenceList=element('div','workflow-settings-list')
|
|
179
208
|
preferenceList.id='workflow-more-preferences'
|
|
180
|
-
const
|
|
181
|
-
|
|
209
|
+
for (const name of ['servers', 'cloud-relay']) {
|
|
210
|
+
const row = home.querySelector(`[data-settings-group="${name}"]`)
|
|
211
|
+
if (row) workList.append(row)
|
|
212
|
+
}
|
|
213
|
+
workList.append(...workLinks.map(([target]) => target));work.append(workTitle,workList)
|
|
182
214
|
for(const name of ['general','model','notify','about']){const row=home.querySelector(`[data-settings-group="${name}"]`);if(row)preferenceList.append(row)}
|
|
183
215
|
preferences.append(preferenceTitle,preferenceList);home.append(work,preferences)
|
|
184
216
|
home.querySelector('[data-settings-group="tests"]')?.remove()
|
|
@@ -218,8 +250,13 @@
|
|
|
218
250
|
else if([...group.children].every(child=>child.hidden||child.classList.contains('hidden')))group.hidden=true
|
|
219
251
|
}
|
|
220
252
|
const wb=$(config.desktop?'workbench-box':'workbench-bar')
|
|
221
|
-
if(wb&&servers){
|
|
222
|
-
|
|
253
|
+
if (wb && servers) {
|
|
254
|
+
const folders = element(config.desktop ? 'details' : 'div', 'workflow-technical')
|
|
255
|
+
const heading = element(config.desktop ? 'summary' : 'h3')
|
|
256
|
+
rename(heading, '高级目录组织', 'Advanced folder organization')
|
|
257
|
+
folders.append(heading, wb, button('发现并登记子目录','Discover subfolders',()=>config.discover()))
|
|
258
|
+
servers.append(folders)
|
|
259
|
+
}
|
|
223
260
|
if(servers)servers.append(button('打开管理控制台','Open management console',()=>config.admin()))
|
|
224
261
|
const workspace=$('modal-workspace')?.querySelector('.modal-body,.ds-modal-body')
|
|
225
262
|
if(workspace&&config.register)workspace.append(button('使用当前目录,不新建文件夹','Use current folder',()=>config.register()))
|
|
@@ -255,9 +292,13 @@
|
|
|
255
292
|
}
|
|
256
293
|
}
|
|
257
294
|
function setupSecondaryPages() {
|
|
295
|
+
const serverGroups = config.desktop
|
|
296
|
+
? [['local','连接地址','Host addresses'],['access','访问令牌','Access token'],['relay','云服务器中转','Cloud relay'],['host','主机管理','Host management'],['advanced','高级选项','Advanced options']]
|
|
297
|
+
: [['current','当前连接','Current connection'],['pair','添加连接','Add a connection'],['local','已保存的地址与分组','Saved addresses and groups',true],['host','主机管理','Host management',true]]
|
|
258
298
|
const definitions={
|
|
259
299
|
general:{title:['外观与输入','Appearance and input'],intro:['按你的习惯调整显示、输入与常用提示词。','Adjust display, input and reusable prompts to suit your workflow.'],icon:'general',groups:[['input','对话与输入','Conversation and input'],['appearance','外观与语言','Appearance and language'],['presets','预设提示词','Reusable prompts']]},
|
|
260
|
-
servers:{title:['主机与连接','Hosts and connections'],intro:['管理连接地址、访问令牌与公网中转。','Manage host addresses, access tokens and relay connections.'],icon:'host',groups:
|
|
300
|
+
servers:{title:['主机与连接','Hosts and connections'],intro:config.desktop?['管理连接地址、访问令牌与公网中转。','Manage host addresses, access tokens and relay connections.']:null,icon:'host',groups:serverGroups},
|
|
301
|
+
'cloud-relay':{title:['云中转','Cloud relay'],icon:'relay',groups:[['main']]},
|
|
261
302
|
model:{title:['模型与提供方','Models and providers'],intro:['配置当前主机的模型提供方与访问凭据。','Configure model providers and credentials on the current host.'],icon:'model',groups:[['main','提供方配置','Provider configuration']]},
|
|
262
303
|
notify:{title:['通知与后台','Notifications and background'],intro:['选择需要提醒的事项,并管理后台接收方式。','Choose which events to hear about and how to receive them in the background.'],icon:'notify',groups:[['main','消息与提醒','Messages and reminders'],['advanced','后台与排障','Background and diagnostics']]},
|
|
263
304
|
about:{title:['关于与维护','About and maintenance'],intro:['查看版本与公告,获取帮助或管理本地数据。','Find version information, announcements, help and local data controls.'],icon:'about',groups:[['main','版本与项目','Version and project'],['announcements','公告','Announcements'],['support','反馈与支持','Feedback and support'],['data','本地数据','Local data']]},
|
|
@@ -277,17 +318,43 @@
|
|
|
277
318
|
}
|
|
278
319
|
const header=element('header','workflow-subpage-head'),back=element('button','workflow-back'),backLabel=element('span')
|
|
279
320
|
back.type='button';rename(backLabel,'返回更多','Back to More');back.dataset.settingsBack=''
|
|
280
|
-
|
|
321
|
+
const arrow = element('span', 'workflow-back-arrow', '‹')
|
|
322
|
+
arrow.setAttribute('aria-hidden', 'true')
|
|
323
|
+
if (!config.desktop) backLabel.classList.add('ext-sr-only')
|
|
324
|
+
back.append(arrow, backLabel)
|
|
281
325
|
const title=element('h1');rename(title,...definition.title);title.id='workflow-title-'+key
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
326
|
+
const identity=element('div','workflow-subpage-identity'),copy=element('div');copy.append(title)
|
|
327
|
+
if (config.desktop) {
|
|
328
|
+
const mark = element('span', 'workflow-setting-icon')
|
|
329
|
+
mark.append(icon(definition.icon))
|
|
330
|
+
identity.append(mark)
|
|
331
|
+
}
|
|
332
|
+
if (config.desktop && definition.intro) {
|
|
333
|
+
const intro = element('p', 'workflow-subpage-intro')
|
|
334
|
+
rename(intro, ...definition.intro)
|
|
335
|
+
copy.append(intro)
|
|
336
|
+
}
|
|
337
|
+
identity.append(copy)
|
|
285
338
|
header.append(back,identity)
|
|
286
339
|
const body=element('div','workflow-subpage-body'),cards=new Map()
|
|
287
|
-
for(const [id,zh,en] of definition.groups){
|
|
288
|
-
const section=element('
|
|
289
|
-
|
|
290
|
-
|
|
340
|
+
for (const [id, zh, en, collapsible] of definition.groups) {
|
|
341
|
+
const section = element(collapsible ? 'details' : 'section', 'workflow-settings-section')
|
|
342
|
+
if (collapsible) {
|
|
343
|
+
section.classList.add('workflow-settings-disclosure')
|
|
344
|
+
section.id = `workflow-settings-${key}-${id}`
|
|
345
|
+
}
|
|
346
|
+
if (zh) {
|
|
347
|
+
const heading = element(collapsible ? 'summary' : 'h2')
|
|
348
|
+
rename(heading, zh, en)
|
|
349
|
+
heading.id = 'workflow-group-' + key + '-' + id
|
|
350
|
+
section.setAttribute('aria-labelledby', heading.id)
|
|
351
|
+
section.append(heading)
|
|
352
|
+
}
|
|
353
|
+
const card = element('div', 'workflow-settings-card')
|
|
354
|
+
card.dataset.workflowSettingsSlot = id
|
|
355
|
+
section.append(card)
|
|
356
|
+
cards.set(id, { section, card })
|
|
357
|
+
body.append(section)
|
|
291
358
|
}
|
|
292
359
|
for(const node of parts){
|
|
293
360
|
let group=definition.groups[0][0]
|
|
@@ -295,10 +362,17 @@
|
|
|
295
362
|
if(includes(node,'#btn-theme,#btn-lang'))group='appearance'
|
|
296
363
|
else if(includes(node,'#btn-preset-add,#btn-manage-presets,#preset-list'))group='presets'
|
|
297
364
|
}else if(key==='servers'){
|
|
298
|
-
if(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
365
|
+
if (config.desktop) {
|
|
366
|
+
if (node.id === 'relay-settings') group = 'relay'
|
|
367
|
+
else if (includes(node, '#token-desc,#desktop-token-input')) group = 'access'
|
|
368
|
+
else if (node.matches('.workflow-technical')) group = 'advanced'
|
|
369
|
+
else if (includes(node, '#btn-host-describe,#btn-dsh-start') || node.matches('.workflow-button')) group = 'host'
|
|
370
|
+
} else {
|
|
371
|
+
if (includes(node, '#server-desc,#token-desc')) group = 'current'
|
|
372
|
+
else if (includes(node, '#btn-scan-camera,#server-input')) group = 'pair'
|
|
373
|
+
else if (includes(node, '#btn-host-describe,#btn-dsh-start') || node.matches('.workflow-technical,.workflow-button')) group = 'host'
|
|
374
|
+
else group = 'local'
|
|
375
|
+
}
|
|
302
376
|
}else if(key==='notify'&&node.matches('.workflow-technical'))group='advanced'
|
|
303
377
|
else if(key==='about'){
|
|
304
378
|
if(node.matches('.workflow-data-settings'))group='data'
|
|
@@ -316,17 +390,18 @@
|
|
|
316
390
|
}
|
|
317
391
|
function setupStart() {
|
|
318
392
|
const desktop=config.desktop,home=$(desktop?'view-sessions':'view-home');if(!home)return
|
|
319
|
-
const head=element('section','workflow-start')
|
|
320
|
-
const title=element('div','workflow-page-head'),heading=element('h1');rename(heading,desktop?'会话':'工作空间',desktop?'Conversations':'Workspace');title.append(heading)
|
|
393
|
+
const head = element(desktop ? 'section' : 'div', desktop ? 'workflow-start' : 'session-home-status')
|
|
321
394
|
connectionButton=button('检查连接…','Checking connection…',connectionDetails,'workflow-connection');connectionButton.id='workflow-connection'
|
|
322
395
|
connectionButton.removeAttribute('data-flow-zh');connectionButton.removeAttribute('data-flow-en')
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
396
|
+
if (desktop) {
|
|
397
|
+
const title = element('div', 'workflow-page-head'), heading = element('h1')
|
|
398
|
+
rename(heading, '会话', 'Conversations')
|
|
399
|
+
title.append(heading, connectionButton)
|
|
400
|
+
head.append(title)
|
|
401
|
+
} else {
|
|
402
|
+
head.append(connectionButton)
|
|
403
|
+
const doctor = $('home-doctor')
|
|
404
|
+
if (doctor) head.append(doctor)
|
|
330
405
|
}
|
|
331
406
|
attention=element('section','workflow-attention');attention.id='workflow-attention'
|
|
332
407
|
const attentionTitle=element('h2');rename(attentionTitle,'待处理','Needs attention');attention.append(attentionTitle)
|
|
@@ -334,7 +409,8 @@
|
|
|
334
409
|
head.append(attention)
|
|
335
410
|
const notice=element('div','workflow-notice');notice.id='workflow-unconfirmed';notice.hidden=true
|
|
336
411
|
notice.append(element('span','',label('有操作结果待确认','Some operation results are unconfirmed')),button('查看回执','Check receipts',showOperations));head.append(notice)
|
|
337
|
-
home.prepend(head)
|
|
412
|
+
if (desktop) home.prepend(head)
|
|
413
|
+
else $('workspace-nav').after(head)
|
|
338
414
|
const announcements=$('overview-announcement-board')
|
|
339
415
|
if(announcements)$('settings-page-about')?.append(announcements)
|
|
340
416
|
const stat=$('stat-strip');if(stat)stat.hidden=true
|
|
@@ -357,9 +433,17 @@
|
|
|
357
433
|
if(identity!==receiptIdentity){receiptIdentity=identity;void root.DshOperations.restore(context).then(()=>{if(identity===receiptIdentity)update()}).catch(()=>{})}
|
|
358
434
|
}
|
|
359
435
|
if(connectionButton){
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
436
|
+
const online = !snapshot.connectionIssue && !snapshot.offline && !!snapshot.gateway && !!snapshot.dsh
|
|
437
|
+
const status = snapshot.connectionIssue===426 ? label('需配对', 'Pair device') : snapshot.connectionIssue ? label('鉴权失败', 'Access denied')
|
|
438
|
+
: !snapshot.token ? label('连接主机', 'Connect host') : snapshot.offline ? label('设备离线', 'Device offline')
|
|
439
|
+
: online ? label('已连接', 'Connected') : label('正在恢复连接', 'Reconnecting')
|
|
440
|
+
connectionButton.textContent = config.desktop ? status + ' · ' + (snapshot.host || label('当前主机', 'Current host')) : status
|
|
441
|
+
connectionButton.classList.toggle('is-online', online)
|
|
442
|
+
if (!config.desktop) {
|
|
443
|
+
connectionButton.hidden = online && snapshot.token
|
|
444
|
+
const doctor = $('home-doctor')
|
|
445
|
+
if (doctor) doctor.hidden = online || !snapshot.token || snapshot.offline
|
|
446
|
+
}
|
|
363
447
|
}
|
|
364
448
|
if(attention)attention.hidden=!snapshot.pending
|
|
365
449
|
const alternate=$('workflow-steer');if(alternate){alternate.hidden=!snapshot.busy;alternate.disabled=!!snapshot.sending}
|
|
@@ -377,7 +461,23 @@
|
|
|
377
461
|
sheet.addEventListener('close',()=>{if(!sheet.open){restoreAttention();operationList=null}})
|
|
378
462
|
setupMore();setupStart();setupComposer();config.start?.()
|
|
379
463
|
const relaySettings=$('relay-settings')
|
|
380
|
-
if(relaySettings){
|
|
464
|
+
if(relaySettings){
|
|
465
|
+
const cloudPage=$('settings-page-cloud-relay')
|
|
466
|
+
if(cloudPage)root.DshSponsor?.setInAppEntry(()=>config.settings('cloud-relay'))
|
|
467
|
+
const relay = root.DshRelaySettings?.mount(relaySettings,{connection:config.relay||config.operations,service:!!cloudPage,syncActivation:config.syncRelayActivation})
|
|
468
|
+
if (cloudPage && relay && typeof root.NativeBackground?.takeCloudRelayActivation === 'function') {
|
|
469
|
+
const receiveActivation = () => {
|
|
470
|
+
if (config.cloudRelayReady?.() === false) return
|
|
471
|
+
const raw = root.NativeBackground.takeCloudRelayActivation()
|
|
472
|
+
if (!raw) return
|
|
473
|
+
config.settings('cloud-relay')
|
|
474
|
+
relay.receiveActivation(raw)
|
|
475
|
+
}
|
|
476
|
+
root.addEventListener('dsh-relay-activation', receiveActivation)
|
|
477
|
+
receiveActivation()
|
|
478
|
+
}
|
|
479
|
+
root.DshE2eeTransport?.mount(relaySettings,{connection:config.relay||config.operations,onConnect:config.e2eeConnect,onModeChange:config.e2eeModeChange,onAutoPaired:config.e2eeAutoPaired,onScan:config.e2eeScan})
|
|
480
|
+
}
|
|
381
481
|
setupSecondaryPages()
|
|
382
482
|
const overview=$('view-activity');if(overview)overview.dataset.workflowLegacy='overview'
|
|
383
483
|
if(!config.desktop){
|