dsh-remote-plugin 0.8.7 → 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 +659 -130
- package/index.mjs +33 -1
- package/package.json +8 -3
- package/public/activity.js +196 -52
- package/public/admin.html +34 -32
- package/public/admin.js +11 -2
- package/public/app.js +1341 -223
- 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 +104 -76
- package/public/desktop/desktop.js +668 -101
- package/public/diagnostics.js +30 -4
- package/public/e2ee-transport.js +154 -7
- package/public/file-inbox.js +77 -18
- package/public/genui.css +10 -0
- package/public/genui.js +22 -4
- package/public/history.js +15 -2
- 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 +347 -140
- package/public/md.js +21 -1
- package/public/network.js +33 -1
- package/public/onboarding.js +3 -3
- package/public/operations.js +26 -12
- package/public/plan-review.css +297 -0
- package/public/plan-review.js +621 -0
- package/public/plugin.html +29 -27
- 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/penguin-logistics/cargo.svg +4 -0
- package/public/skins/penguin-logistics/console.svg +4 -0
- package/public/skins/penguin-logistics/mark.svg +4 -0
- package/public/skins/penguin-logistics/radio.svg +4 -0
- package/public/skins/penguin-logistics/skin.css +292 -0
- package/public/skins/penguin-logistics/standing.png +0 -0
- package/public/skins/ryo/preview.html +6 -6
- package/public/slash-suggestions.css +43 -0
- package/public/slash-suggestions.js +196 -0
- package/public/sponsor-entry.js +11 -3
- package/public/styles.css +141 -21
- package/public/subagents.css +7 -0
- package/public/subagents.js +83 -10
- package/public/theme-vars.css +102 -3
- package/public/theme.js +7 -4
- package/public/turn-diff.css +323 -0
- package/public/turn-diff.js +778 -0
- package/public/update.json +12 -12
- package/public/version.json +1 -1
- package/public/workflow.css +322 -43
- package/public/workflow.js +148 -44
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')
|
|
@@ -76,7 +77,9 @@
|
|
|
76
77
|
item.append(element('strong','',row.method),element('code','',row.id),
|
|
77
78
|
element('span','workflow-muted',remote
|
|
78
79
|
? label('结果待确认(来自其他连接,切回后可查询)','Unconfirmed (from another connection; switch back to check)')
|
|
79
|
-
:
|
|
80
|
+
: row.receiptMissing
|
|
81
|
+
? label('网关找不到回执。请核对会话后结束跟踪。','The gateway has no receipt. Check the conversation before ending tracking.')
|
|
82
|
+
: label('结果待确认,不会自动重复提交','Unconfirmed; never automatically submitted again')))
|
|
80
83
|
if(remote&&row.origin)item.append(element('p','workflow-muted',row.origin))
|
|
81
84
|
if(!remote){
|
|
82
85
|
const check=button('查询结果','Check result',async()=>{
|
|
@@ -84,7 +87,10 @@
|
|
|
84
87
|
try {
|
|
85
88
|
const value=await root.DshOperations.check(row.id)
|
|
86
89
|
if(!sheet.open||target!==operationList)return
|
|
87
|
-
|
|
90
|
+
const status = value?.receiptMissing
|
|
91
|
+
? label('网关找不到回执,请核对会话。','The gateway has no receipt. Check the conversation.')
|
|
92
|
+
: value ? label('当前状态:','Status: ')+value.phase : label('暂时无法确认,请核对会话。','Unable to confirm. Check the conversation.')
|
|
93
|
+
item.append(element('p','',status))
|
|
88
94
|
if(value?.phase==='complete'){config.refresh();config.recover?.(row,value);check.remove()}
|
|
89
95
|
}catch{item.append(element('p','',label('网络不可达,可稍后查询。','Network unavailable. Check later.')))}
|
|
90
96
|
finally{check.disabled=false}
|
|
@@ -120,7 +126,24 @@
|
|
|
120
126
|
function connectionDetails() {
|
|
121
127
|
const content=element('div','workflow-connection-content'),snapshot=config.snapshot()
|
|
122
128
|
content.append(element('p','',snapshot.host||label('当前页面主机','Current host')))
|
|
123
|
-
|
|
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
|
+
}
|
|
124
147
|
const links=$(config.desktop?'view-overview':'view-activity')
|
|
125
148
|
if(links){
|
|
126
149
|
const details=element('details','workflow-technical'),summary=element('summary','',label('连接与运行详情','Connection details'))
|
|
@@ -130,9 +153,17 @@
|
|
|
130
153
|
}
|
|
131
154
|
details.append(clone);content.append(details)
|
|
132
155
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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()
|
|
136
167
|
}
|
|
137
168
|
async function refreshCacheSummary(){
|
|
138
169
|
if(!cacheSummary||cacheReading)return
|
|
@@ -153,27 +184,33 @@
|
|
|
153
184
|
}
|
|
154
185
|
function setupMore() {
|
|
155
186
|
const home=$('settings-home');if(!home)return
|
|
156
|
-
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)
|
|
157
188
|
const plugins=button('主机插件','Host plugins',()=>config.plugins(),'workflow-setting-link')
|
|
158
189
|
const receipts=button('审批与操作回执','Approvals and receipts',showOperations,'workflow-setting-link')
|
|
159
190
|
const main=home.querySelector('.settings-group,.ds-settings');main?.prepend(plugins);main?.append(receipts)
|
|
160
|
-
const names={servers:['主机与连接','Hosts and connections'],general:['外观与输入','Appearance and input'],model:['模型与提供方','Models and providers'],notify:['通知与后台','Notifications and background'],about:['关于与维护','About and maintenance']}
|
|
161
|
-
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']}
|
|
162
193
|
for(const [key,nameset] of Object.entries(names)){
|
|
163
194
|
const row=home.querySelector(`[data-settings-group="${key}"]`)
|
|
164
195
|
rename(row?.querySelector('.setting-name,.ds-setting-name'),...nameset)
|
|
165
196
|
rename(row?.querySelector('.setting-desc,.ds-setting-desc'),...descriptions[key])
|
|
166
197
|
const page=$('settings-page-'+key)
|
|
167
198
|
rename(page?.querySelector('[data-settings-back] .setting-name,[data-settings-back] .ds-setting-name'),...nameset)
|
|
168
|
-
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)}
|
|
169
200
|
}
|
|
170
|
-
|
|
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)}
|
|
171
205
|
const work=element('section','workflow-more-group'),preferences=element('section','workflow-more-group')
|
|
172
206
|
const workTitle=element('h2'),preferenceTitle=element('h2');rename(workTitle,'连接与工作','Connections and work');rename(preferenceTitle,'偏好与维护','Preferences and maintenance')
|
|
173
207
|
const workList=element('div','workflow-settings-list'),preferenceList=element('div','workflow-settings-list')
|
|
174
208
|
preferenceList.id='workflow-more-preferences'
|
|
175
|
-
const
|
|
176
|
-
|
|
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)
|
|
177
214
|
for(const name of ['general','model','notify','about']){const row=home.querySelector(`[data-settings-group="${name}"]`);if(row)preferenceList.append(row)}
|
|
178
215
|
preferences.append(preferenceTitle,preferenceList);home.append(work,preferences)
|
|
179
216
|
home.querySelector('[data-settings-group="tests"]')?.remove()
|
|
@@ -213,8 +250,13 @@
|
|
|
213
250
|
else if([...group.children].every(child=>child.hidden||child.classList.contains('hidden')))group.hidden=true
|
|
214
251
|
}
|
|
215
252
|
const wb=$(config.desktop?'workbench-box':'workbench-bar')
|
|
216
|
-
if(wb&&servers){
|
|
217
|
-
|
|
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
|
+
}
|
|
218
260
|
if(servers)servers.append(button('打开管理控制台','Open management console',()=>config.admin()))
|
|
219
261
|
const workspace=$('modal-workspace')?.querySelector('.modal-body,.ds-modal-body')
|
|
220
262
|
if(workspace&&config.register)workspace.append(button('使用当前目录,不新建文件夹','Use current folder',()=>config.register()))
|
|
@@ -248,12 +290,15 @@
|
|
|
248
290
|
button('导出会话','Export conversation',()=>{actions.close();void config.command('/export')}),
|
|
249
291
|
button('压缩上下文','Compact context',()=>{actions.close();void config.command('/compact')}))
|
|
250
292
|
}
|
|
251
|
-
for(const el of document.querySelectorAll('[data-cmd="/compact"],[data-cmd="/export"],[data-ds-cmd="/compact"],[data-ds-cmd="/export"]'))el.remove()
|
|
252
293
|
}
|
|
253
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]]
|
|
254
298
|
const definitions={
|
|
255
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']]},
|
|
256
|
-
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']]},
|
|
257
302
|
model:{title:['模型与提供方','Models and providers'],intro:['配置当前主机的模型提供方与访问凭据。','Configure model providers and credentials on the current host.'],icon:'model',groups:[['main','提供方配置','Provider configuration']]},
|
|
258
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']]},
|
|
259
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']]},
|
|
@@ -273,17 +318,43 @@
|
|
|
273
318
|
}
|
|
274
319
|
const header=element('header','workflow-subpage-head'),back=element('button','workflow-back'),backLabel=element('span')
|
|
275
320
|
back.type='button';rename(backLabel,'返回更多','Back to More');back.dataset.settingsBack=''
|
|
276
|
-
|
|
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)
|
|
277
325
|
const title=element('h1');rename(title,...definition.title);title.id='workflow-title-'+key
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
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)
|
|
281
338
|
header.append(back,identity)
|
|
282
339
|
const body=element('div','workflow-subpage-body'),cards=new Map()
|
|
283
|
-
for(const [id,zh,en] of definition.groups){
|
|
284
|
-
const section=element('
|
|
285
|
-
|
|
286
|
-
|
|
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)
|
|
287
358
|
}
|
|
288
359
|
for(const node of parts){
|
|
289
360
|
let group=definition.groups[0][0]
|
|
@@ -291,10 +362,17 @@
|
|
|
291
362
|
if(includes(node,'#btn-theme,#btn-lang'))group='appearance'
|
|
292
363
|
else if(includes(node,'#btn-preset-add,#btn-manage-presets,#preset-list'))group='presets'
|
|
293
364
|
}else if(key==='servers'){
|
|
294
|
-
if(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
}
|
|
298
376
|
}else if(key==='notify'&&node.matches('.workflow-technical'))group='advanced'
|
|
299
377
|
else if(key==='about'){
|
|
300
378
|
if(node.matches('.workflow-data-settings'))group='data'
|
|
@@ -312,17 +390,18 @@
|
|
|
312
390
|
}
|
|
313
391
|
function setupStart() {
|
|
314
392
|
const desktop=config.desktop,home=$(desktop?'view-sessions':'view-home');if(!home)return
|
|
315
|
-
const head=element('section','workflow-start')
|
|
316
|
-
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')
|
|
317
394
|
connectionButton=button('检查连接…','Checking connection…',connectionDetails,'workflow-connection');connectionButton.id='workflow-connection'
|
|
318
395
|
connectionButton.removeAttribute('data-flow-zh');connectionButton.removeAttribute('data-flow-en')
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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)
|
|
326
405
|
}
|
|
327
406
|
attention=element('section','workflow-attention');attention.id='workflow-attention'
|
|
328
407
|
const attentionTitle=element('h2');rename(attentionTitle,'待处理','Needs attention');attention.append(attentionTitle)
|
|
@@ -330,7 +409,8 @@
|
|
|
330
409
|
head.append(attention)
|
|
331
410
|
const notice=element('div','workflow-notice');notice.id='workflow-unconfirmed';notice.hidden=true
|
|
332
411
|
notice.append(element('span','',label('有操作结果待确认','Some operation results are unconfirmed')),button('查看回执','Check receipts',showOperations));head.append(notice)
|
|
333
|
-
home.prepend(head)
|
|
412
|
+
if (desktop) home.prepend(head)
|
|
413
|
+
else $('workspace-nav').after(head)
|
|
334
414
|
const announcements=$('overview-announcement-board')
|
|
335
415
|
if(announcements)$('settings-page-about')?.append(announcements)
|
|
336
416
|
const stat=$('stat-strip');if(stat)stat.hidden=true
|
|
@@ -353,9 +433,17 @@
|
|
|
353
433
|
if(identity!==receiptIdentity){receiptIdentity=identity;void root.DshOperations.restore(context).then(()=>{if(identity===receiptIdentity)update()}).catch(()=>{})}
|
|
354
434
|
}
|
|
355
435
|
if(connectionButton){
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
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
|
+
}
|
|
359
447
|
}
|
|
360
448
|
if(attention)attention.hidden=!snapshot.pending
|
|
361
449
|
const alternate=$('workflow-steer');if(alternate){alternate.hidden=!snapshot.busy;alternate.disabled=!!snapshot.sending}
|
|
@@ -373,7 +461,23 @@
|
|
|
373
461
|
sheet.addEventListener('close',()=>{if(!sheet.open){restoreAttention();operationList=null}})
|
|
374
462
|
setupMore();setupStart();setupComposer();config.start?.()
|
|
375
463
|
const relaySettings=$('relay-settings')
|
|
376
|
-
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
|
+
}
|
|
377
481
|
setupSecondaryPages()
|
|
378
482
|
const overview=$('view-activity');if(overview)overview.dataset.workflowLegacy='overview'
|
|
379
483
|
if(!config.desktop){
|