dsh-mobile-plugin 0.5.64 → 0.5.66
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/lib/client.js +457 -86
- package/lib/frpc/provision.cjs +384 -0
- package/lib/frpc/runner.cjs +235 -0
- package/lib/impl.js +36 -0
- package/lib/mobile/host-bridge/session-model.js +7 -2
- package/lib/mobile/pairing.js +7 -0
- package/lib/mobile/relay-control.js +11 -0
- package/lib/panel/index.html +11 -11
- package/lib/relay/control.js +260 -0
- package/lib/relay/core.js +13 -1
- package/lib/relay/lan-network.cjs +26 -0
- package/lib/relay/pairing-payload.cjs +8 -0
- package/lib/relay/status.js +3 -0
- package/lib/routes/control-plane.js +60 -1
- package/lib/routes/mobile-api.js +11 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* 本机和局域网入口直接访问管理页,公网入口保留两小时窗口。
|
|
5
5
|
*
|
|
6
6
|
* 五件事:桌面侧边栏的展开态与「读过了」报给宿主;手机端的已读回执应用回桌面绿点;
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* 手机),手机上的折叠只存在 App
|
|
7
|
+
* 设置里那一项「移动端」(一张薄卡,一颗「打开配置页面」);在侧边栏最底下那一行挂两颗
|
|
8
|
+
* 图标——手机图标(点一下等于那张卡上的按钮,进控制台)与它右边的电脑图标(进远程电脑页);
|
|
9
|
+
* 聊天嵌入页里按目标打开会话、守住它不被网页端启动时那次「恢复上次会话」顶掉,换目标则在
|
|
10
|
+
* 页面里切过去、不重新加载。方向是单向的(桌面 → 宿主 → 手机),手机上的折叠只存在 App
|
|
11
|
+
* 本地,不写回。
|
|
11
12
|
*
|
|
12
13
|
* 本文件不经任何构建(package.json 直接收录 lib 下的 .js),所以不能写 JSX,统一用
|
|
13
14
|
* `React.createElement` 的别名 `h`;客户端插件按约定写成惰性工厂,定时器与页签在物化时才起。
|
|
@@ -41,6 +42,10 @@ window.__ModuleLoader__.load({
|
|
|
41
42
|
.dshm_footAction[aria-disabled="true"]{opacity:.45;cursor:default}
|
|
42
43
|
.dshm_footAction[aria-disabled="true"]:hover{background:transparent;color:var(--dsw-alias-label-secondary)}
|
|
43
44
|
.dshm_footActionRail{width:36px;height:36px;margin:2px 0;border-radius:var(--dsw-radius-md)}
|
|
45
|
+
/* 手机与电脑两颗图标合在同一只方框里:一个细边框圈成一组,两颗之间只留 2px 的缝。
|
|
46
|
+
进组后撤掉单颗各自的外边距,否则间距会翻倍、还会把边框撑松。 */
|
|
47
|
+
.dshm_footerGroup{flex:none;display:inline-flex;align-items:center;gap:2px;padding:1px 2px;border:1px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-md)}
|
|
48
|
+
.dshm_footerGroup .dshm_footAction{margin:0}
|
|
44
49
|
/* 宿主那一半没装载时:整颗转红,右上角那颗红点显出来(data-dshm-alert 是它的记号)。
|
|
45
50
|
悬停不换回普通颜色——告警态跟着鼠标变浅等于这一颗在说谎。 */
|
|
46
51
|
.dshm_footAction[data-dshm-alert],.dshm_footAction[data-dshm-alert]:hover{color:var(--dsw-alias-state-error-primary)}
|
|
@@ -49,10 +54,14 @@ window.__ModuleLoader__.load({
|
|
|
49
54
|
.dshm_footAction[data-dshm-warn],.dshm_footAction[data-dshm-warn]:hover{color:var(--dsw-alias-state-warning-primary)}
|
|
50
55
|
.dshm_alertDot{display:none}
|
|
51
56
|
.dshm_footAction[data-dshm-alert] .dshm_alertDot,.dshm_footAction[data-dshm-warn] .dshm_alertDot{display:inline}
|
|
52
|
-
.dshm_overlay{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:
|
|
53
|
-
.dshm_dialog{box-sizing:border-box;width:100%;max-width:560px;max-height:82vh;overflow:auto;display:flex;flex-direction:column;gap:10px;padding:18px 20px;border-radius:var(--dsw-radius-xl);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);color:var(--dsw-alias-label-primary);box-shadow:0 12px 40px rgba(0,0,0,.28)}
|
|
54
|
-
/*
|
|
55
|
-
|
|
57
|
+
.dshm_overlay{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:clamp(8px,3vh,20px);background:rgba(0,0,0,.42)}
|
|
58
|
+
.dshm_dialog{box-sizing:border-box;width:100%;max-width:min(560px,100%);max-height:min(82vh,calc(100vh - 16px));overflow:auto;display:flex;flex-direction:column;gap:10px;padding:18px 20px;border-radius:var(--dsw-radius-xl);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);color:var(--dsw-alias-label-primary);box-shadow:0 12px 40px rgba(0,0,0,.28)}
|
|
59
|
+
/* 内容窗(嵌一整页):宽高都自适应——最宽 1040、再宽跟着视口收;高取视口的 88%,
|
|
60
|
+
矮屏上让出遮罩留白。旧版写死 82vh + 1040px,小窗口和大屏都不合适。
|
|
61
|
+
顶部留白收到 6px:窗口按钮已经搬进页面顶栏,外壳这层只留一圈薄边。 */
|
|
62
|
+
.dshm_dialogWide{max-width:min(1040px,100%);height:min(88vh,900px);max-height:calc(100vh - 16px);overflow:hidden;padding:6px;gap:0}
|
|
63
|
+
/* 空的说明行不占位:只有在浏览器被拦这类真要说话时才撑开一行。 */
|
|
64
|
+
.dshm_dialogNote:empty{display:none}
|
|
56
65
|
.dshm_dialogWide .dshm_frameWrap{flex:1;min-height:0;display:flex;position:relative}
|
|
57
66
|
.dshm_frame{flex:1;min-height:0;width:100%;border:0;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1)}
|
|
58
67
|
/* 加载提示由内嵌页就绪回执撤掉,不能只凭 iframe load。 */
|
|
@@ -446,6 +455,7 @@ window.__ModuleLoader__.load({
|
|
|
446
455
|
loadFailed: '读取宿主状态失败',
|
|
447
456
|
openFailed: '打开配置页面失败',
|
|
448
457
|
footerOpen: '打开移动端插件配置网页',
|
|
458
|
+
footerRemoteOpen: '打开远程电脑',
|
|
449
459
|
footerPending: '网页地址还没就绪',
|
|
450
460
|
footerNoDevice: '还没配对过手机',
|
|
451
461
|
footerDeviceCount: '{count} 台设备',
|
|
@@ -459,12 +469,10 @@ window.__ModuleLoader__.load({
|
|
|
459
469
|
footerPublicConfirm: '这个地址位于公网。继续后会开放移动端插件的网页管理权限 2 小时;期间任何能访问该地址的人都可以操作面板。是否继续?',
|
|
460
470
|
footerLoadMissing: '插件宿主侧没有加载:把 DSH 完整退出再打开一次;还不行就在插件市场重装一遍插件。',
|
|
461
471
|
consoleTitle: '移动端插件控制台',
|
|
462
|
-
|
|
472
|
+
remoteConsoleTitle: '远程电脑',
|
|
463
473
|
consolePopupBlocked: '浏览器拦掉了新窗口,允许本站弹出窗口后再点一次。',
|
|
464
|
-
consoleOpenBrowser: '在浏览器里打开',
|
|
465
474
|
consoleLoading: '正在载入控制台…',
|
|
466
|
-
|
|
467
|
-
consoleFrameless: '控制台未能完成加载,请点「重新载入」重试,也可以在浏览器里打开。',
|
|
475
|
+
consoleFrameless: '控制台未能完成加载,请关闭后重新点图标,也可以在浏览器里打开。',
|
|
468
476
|
diagTitleLoad: '打不开移动端配置页',
|
|
469
477
|
diagTitleOpen: '开放网页管理失败',
|
|
470
478
|
diagChecking: '正在读取宿主状态…',
|
|
@@ -524,6 +532,7 @@ window.__ModuleLoader__.load({
|
|
|
524
532
|
loadFailed: 'Failed to read host status',
|
|
525
533
|
openFailed: 'Could not open the configuration page',
|
|
526
534
|
footerOpen: 'Open the mobile plugin configuration page',
|
|
535
|
+
footerRemoteOpen: 'Open remote computers',
|
|
527
536
|
footerPending: 'The page address is not ready yet',
|
|
528
537
|
footerNoDevice: 'No phone paired yet',
|
|
529
538
|
footerDeviceCount: '{count} devices',
|
|
@@ -537,12 +546,10 @@ window.__ModuleLoader__.load({
|
|
|
537
546
|
footerPublicConfirm: 'This address is public. Continuing opens mobile plugin web management for 2 hours; anyone who can reach this address can operate the panel during that time. Continue?',
|
|
538
547
|
footerLoadMissing: 'The plugin host half is not loaded: quit and reopen DSH; if that does not help, reinstall the plugin from the market.',
|
|
539
548
|
consoleTitle: 'Mobile plugin console',
|
|
540
|
-
|
|
549
|
+
remoteConsoleTitle: 'Remote computers',
|
|
541
550
|
consolePopupBlocked: 'The browser blocked the new window — allow pop-ups for this site and press again.',
|
|
542
|
-
consoleOpenBrowser: 'Open in a browser',
|
|
543
551
|
consoleLoading: 'Loading the console…',
|
|
544
|
-
|
|
545
|
-
consoleFrameless: 'The console could not finish loading. Choose Reload to try again, or open it in a browser.',
|
|
552
|
+
consoleFrameless: 'The console could not finish loading. Close this pane and press the icon again, or open it in a browser.',
|
|
546
553
|
diagTitleLoad: 'Cannot open the mobile configuration page',
|
|
547
554
|
diagTitleOpen: 'Could not open web management',
|
|
548
555
|
diagChecking: 'Reading host status…',
|
|
@@ -621,6 +628,8 @@ window.__ModuleLoader__.load({
|
|
|
621
628
|
*/
|
|
622
629
|
const PANEL_VISIBILITY = 'dsh-mobile-plugin:panel-visibility';
|
|
623
630
|
const PANEL_STATE = 'dsh-mobile-plugin:panel-state';
|
|
631
|
+
/** 内嵌页请外面那层窗做事:在浏览器里打开 / 关闭。按钮画在页面里,动作落在这里。 */
|
|
632
|
+
const PANEL_ACTION = 'dsh-mobile-plugin:panel-action';
|
|
624
633
|
const PANEL_LOAD_TIMEOUT_MS = 20000;
|
|
625
634
|
|
|
626
635
|
/** 通知嵌着的那一页:现在看得见 / 看不见。拿不到窗口就静默跳过。 */
|
|
@@ -729,7 +738,10 @@ window.__ModuleLoader__.load({
|
|
|
729
738
|
if (event && typeof event.stopPropagation === 'function') event.stopPropagation();
|
|
730
739
|
});
|
|
731
740
|
overlay.appendChild(card);
|
|
732
|
-
|
|
741
|
+
// 内容窗(嵌一整页):连标题也不画,留白收到最紧;窗口操作那两颗按钮在页面顶栏里,
|
|
742
|
+
// 通过 PANEL_ACTION 消息交回外壳执行。诊断窗保持原样。
|
|
743
|
+
const compact = Boolean(spec.compact && spec.frame && spec.frame.src);
|
|
744
|
+
if (!compact && spec.title) card.appendChild(make('h3', 'dshm_dialogTitle', spec.title));
|
|
733
745
|
if (spec.summary) card.appendChild(make('p', 'dshm_dialogLead', spec.summary));
|
|
734
746
|
// 自定义内容区(入口那两块就挂在这儿):节点由调用方造,这里只负责挂上。
|
|
735
747
|
if (spec.body) card.appendChild(spec.body);
|
|
@@ -767,8 +779,16 @@ window.__ModuleLoader__.load({
|
|
|
767
779
|
const onMessage = (event) => {
|
|
768
780
|
if (!frame.contentWindow || event.source !== frame.contentWindow) return;
|
|
769
781
|
const data = event.data;
|
|
770
|
-
if (!data
|
|
771
|
-
if (data.
|
|
782
|
+
if (!data) return;
|
|
783
|
+
if (data.type === PANEL_STATE) {
|
|
784
|
+
if (data.state === 'ready' || data.state === 'error') update(data.state, data.message);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
// 页面顶栏那两颗按钮只发动作、不碰窗本身;这里按同源 iframe 的来源校验后执行。
|
|
788
|
+
if (data.type === PANEL_ACTION && typeof spec.onAction === 'function'
|
|
789
|
+
&& (data.action === 'open-browser' || data.action === 'close')) {
|
|
790
|
+
spec.onAction(data.action);
|
|
791
|
+
}
|
|
772
792
|
};
|
|
773
793
|
host.addEventListener('message', onMessage);
|
|
774
794
|
frame.onload = () => {
|
|
@@ -811,20 +831,21 @@ window.__ModuleLoader__.load({
|
|
|
811
831
|
for (const step of spec.steps) steps.appendChild(make('li', null, step));
|
|
812
832
|
card.appendChild(steps);
|
|
813
833
|
}
|
|
814
|
-
//
|
|
815
|
-
// 重画整窗会把嵌进去的页面重新加载一遍。
|
|
834
|
+
// 说明行总挂上(`:empty` 时 CSS 不让它占位):弹窗被拦那句就地写进来,不重画整窗。
|
|
816
835
|
const note = make('p', 'dshm_dialogNote', spec.note || '');
|
|
817
836
|
card.appendChild(note);
|
|
818
|
-
const actions = make('div', 'dshm_dialogActions');
|
|
819
|
-
for (const action of spec.actions || []) {
|
|
820
|
-
const button = make('button', action.primary ? 'dshm_btn dshm_btnPrimary' : 'dshm_btn', action.label);
|
|
821
|
-
button.setAttribute('type', 'button');
|
|
822
|
-
if (action.disabled) button.disabled = true;
|
|
823
|
-
button.onclick = () => { void action.onClick(); };
|
|
824
|
-
actions.appendChild(button);
|
|
825
|
-
}
|
|
826
|
-
card.appendChild(actions);
|
|
827
837
|
noteEl = note;
|
|
838
|
+
if (!compact) {
|
|
839
|
+
const actions = make('div', 'dshm_dialogActions');
|
|
840
|
+
for (const action of spec.actions || []) {
|
|
841
|
+
const button = make('button', action.primary ? 'dshm_btn dshm_btnPrimary' : 'dshm_btn', action.label);
|
|
842
|
+
button.setAttribute('type', 'button');
|
|
843
|
+
if (action.disabled) button.disabled = true;
|
|
844
|
+
button.onclick = () => { void action.onClick(); };
|
|
845
|
+
actions.appendChild(button);
|
|
846
|
+
}
|
|
847
|
+
card.appendChild(actions);
|
|
848
|
+
}
|
|
828
849
|
return overlay;
|
|
829
850
|
};
|
|
830
851
|
/**
|
|
@@ -1118,6 +1139,22 @@ window.__ModuleLoader__.load({
|
|
|
1118
1139
|
const PHONE_GLYPH_WIDE = 20;
|
|
1119
1140
|
const PHONE_GLYPH_RAIL = 22;
|
|
1120
1141
|
|
|
1142
|
+
/**
|
|
1143
|
+
* 电脑图标(「显示器 + 底座」那一款):24 画布描边,与手机图标同一套笔画粗细。
|
|
1144
|
+
* 屏幕 3→21、4.4→16.6,底下一条底座加中柱。与面板里那颗 `DesktopIcon` 同形,
|
|
1145
|
+
* 只是这里的手写 DOM 不走构建。它是远程电脑页的入口,与手机图标并排。
|
|
1146
|
+
*/
|
|
1147
|
+
const COMPUTER_PATHS = [
|
|
1148
|
+
'M4.5 3.5h15A1.5 1.5 0 0 1 21 5v9.6A1.5 1.5 0 0 1 19.5 16.1h-15A1.5 1.5 0 0 1 3 14.6V5a1.5 1.5 0 0 1 1.5-1.5Z',
|
|
1149
|
+
'M9 20h6',
|
|
1150
|
+
'M12 16.5V20',
|
|
1151
|
+
];
|
|
1152
|
+
/** 第二颗图标自己的记号:同一页面里出现第二份实现时,靠它摘掉上一颗(与手机那颗分开)。 */
|
|
1153
|
+
const REMOTE_MARK = 'data-dshm-remote-web';
|
|
1154
|
+
/** 两颗图标那只方框的记号与类名:谁先落位谁造盒子,另一颗认记号挂进来。 */
|
|
1155
|
+
const GROUP_MARK = 'data-dshm-footer-group';
|
|
1156
|
+
const GROUP_CLASS = 'dshm_footerGroup';
|
|
1157
|
+
|
|
1121
1158
|
/** 造一颗手机图标(含那颗常驻的告警红点,显不显示看 `data-dshm-alert`)。文档没有 SVG 能力时返回 null,按钮照样成立(只剩无障碍名字)。 */
|
|
1122
1159
|
function phoneIcon(doc, size) {
|
|
1123
1160
|
if (!doc || typeof doc.createElementNS !== 'function') return null;
|
|
@@ -1146,7 +1183,29 @@ window.__ModuleLoader__.load({
|
|
|
1146
1183
|
return svg;
|
|
1147
1184
|
}
|
|
1148
1185
|
|
|
1149
|
-
/**
|
|
1186
|
+
/** 造电脑图标:与手机图标同一套画布、描边与底色。 */
|
|
1187
|
+
function computerIcon(doc, size) {
|
|
1188
|
+
if (!doc || typeof doc.createElementNS !== 'function') return null;
|
|
1189
|
+
const svg = doc.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1190
|
+
svg.setAttribute('viewBox', '0 0 24 24');
|
|
1191
|
+
svg.setAttribute('width', String(size));
|
|
1192
|
+
svg.setAttribute('height', String(size));
|
|
1193
|
+
svg.setAttribute('fill', 'none');
|
|
1194
|
+
svg.setAttribute('stroke', 'currentColor');
|
|
1195
|
+
svg.setAttribute('stroke-width', '1.7');
|
|
1196
|
+
svg.setAttribute('stroke-linecap', 'round');
|
|
1197
|
+
svg.setAttribute('stroke-linejoin', 'round');
|
|
1198
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
1199
|
+
svg.setAttribute('focusable', 'false');
|
|
1200
|
+
for (const d of COMPUTER_PATHS) {
|
|
1201
|
+
const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1202
|
+
path.setAttribute('d', d);
|
|
1203
|
+
svg.appendChild(path);
|
|
1204
|
+
}
|
|
1205
|
+
return svg;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** 造那一颗手机按钮:28 点,与同一行里那几颗图标按钮同尺寸。 */
|
|
1150
1209
|
function createFooterIcon(doc) {
|
|
1151
1210
|
const anchor = doc.createElement('a');
|
|
1152
1211
|
anchor.className = 'dshm_footAction';
|
|
@@ -1158,6 +1217,18 @@ window.__ModuleLoader__.load({
|
|
|
1158
1217
|
return anchor;
|
|
1159
1218
|
}
|
|
1160
1219
|
|
|
1220
|
+
/** 造那一颗电脑按钮:与手机按钮同尺寸,紧跟在它右边。 */
|
|
1221
|
+
function createRemoteFooterIcon(doc) {
|
|
1222
|
+
const anchor = doc.createElement('a');
|
|
1223
|
+
anchor.className = 'dshm_footAction';
|
|
1224
|
+
anchor.setAttribute(REMOTE_MARK, '');
|
|
1225
|
+
anchor.setAttribute('target', '_blank');
|
|
1226
|
+
anchor.setAttribute('rel', 'noreferrer');
|
|
1227
|
+
const icon = computerIcon(doc, PHONE_GLYPH_WIDE);
|
|
1228
|
+
if (icon) anchor.appendChild(icon);
|
|
1229
|
+
return anchor;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1161
1232
|
/**
|
|
1162
1233
|
* 把「打开哪一页 / 现在是什么状态」同步到元素上。
|
|
1163
1234
|
*
|
|
@@ -1185,19 +1256,70 @@ window.__ModuleLoader__.load({
|
|
|
1185
1256
|
node.onclick = onClick;
|
|
1186
1257
|
}
|
|
1187
1258
|
|
|
1188
|
-
/**
|
|
1189
|
-
|
|
1259
|
+
/**
|
|
1260
|
+
* 在设置那一行找(或造)那只包住两颗图标的方框,紧跟头像出口。
|
|
1261
|
+
*
|
|
1262
|
+
* 两颗图标是两个组件分别物化的,谁先谁后不定:先到的造盒子并插到出口后,后到的认记号
|
|
1263
|
+
* 挂进同一个盒子。认不出那一行(座位不在)就返回 null,两颗各自退回自己一行。
|
|
1264
|
+
*/
|
|
1265
|
+
function ensureFooterGroup(doc) {
|
|
1190
1266
|
const outlet = typeof doc.querySelector === 'function' ? doc.querySelector(FOOTER_ANCHOR) : null;
|
|
1191
1267
|
const row = outlet && outlet.parentElement;
|
|
1192
|
-
if (!row || typeof row.insertBefore !== 'function') return
|
|
1268
|
+
if (!row || typeof row.insertBefore !== 'function') return null;
|
|
1193
1269
|
// 只认「侧栏底部那个座位里的 launcher」:头像那块万一被外壳渲染到别处(设置面板里、
|
|
1194
|
-
//
|
|
1195
|
-
if (typeof outlet.closest === 'function' && outlet.closest(FOOTER_SEAT) === null) return
|
|
1196
|
-
|
|
1197
|
-
|
|
1270
|
+
// 以后的新位置),按出口插进去就插错地方了。
|
|
1271
|
+
if (typeof outlet.closest === 'function' && outlet.closest(FOOTER_SEAT) === null) return null;
|
|
1272
|
+
let group = typeof doc.querySelector === 'function' ? doc.querySelector(`[${GROUP_MARK}]`) : null;
|
|
1273
|
+
// 认出的盒子得真在这一行里:别处遗留的同名盒子(认错座位)不能拿来用。
|
|
1274
|
+
if (group && group.parentElement !== row) group = null;
|
|
1275
|
+
if (!group) {
|
|
1276
|
+
group = doc.createElement('span');
|
|
1277
|
+
group.className = GROUP_CLASS;
|
|
1278
|
+
group.setAttribute(GROUP_MARK, '');
|
|
1279
|
+
row.insertBefore(group, outlet.nextSibling);
|
|
1280
|
+
}
|
|
1281
|
+
return group;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/** 把手机图标放回方框里的第一位。返回是否真在设置那一行里。 */
|
|
1285
|
+
function ensureFooterIcon(doc, node) {
|
|
1286
|
+
const group = ensureFooterGroup(doc);
|
|
1287
|
+
if (!group) return false;
|
|
1288
|
+
const first = group.children.length ? group.children[0] : null;
|
|
1289
|
+
// 手机永远是第一颗:盒子先被电脑图标占住时也要插到它前面,两颗的先后与渲染顺序无关。
|
|
1290
|
+
if (node.parentElement === group && first === node) return true;
|
|
1291
|
+
group.insertBefore(node, first);
|
|
1198
1292
|
return true;
|
|
1199
1293
|
}
|
|
1200
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* 把电脑图标放进方框、紧跟手机图标右边(第二颗)。
|
|
1297
|
+
*
|
|
1298
|
+
* 盒子由 `ensureFooterGroup` 统一找或造;手机永远是第一颗,所以这里 append 到末尾即可。
|
|
1299
|
+
* 两颗各由一个组件物化、先后不定:电脑先到时它是盒里唯一一颗,手机后到会插到它前面。
|
|
1300
|
+
*/
|
|
1301
|
+
function ensureRemoteFooterIcon(doc, node) {
|
|
1302
|
+
const group = ensureFooterGroup(doc);
|
|
1303
|
+
if (!group) return false;
|
|
1304
|
+
if (node.parentElement === group && node === group.children[group.children.length - 1]) return true;
|
|
1305
|
+
group.insertBefore(node, null);
|
|
1306
|
+
return true;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/** 摘掉上一次物化留下的电脑图标(插件重装、同一页面里出现第二份实现)。 */
|
|
1310
|
+
function dropStaleRemoteIcons(doc) {
|
|
1311
|
+
if (!doc || typeof doc.querySelectorAll !== 'function') return;
|
|
1312
|
+
let stale = null;
|
|
1313
|
+
try {
|
|
1314
|
+
stale = doc.querySelectorAll(`[${REMOTE_MARK}]`);
|
|
1315
|
+
} catch {
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
for (const node of stale || []) {
|
|
1319
|
+
if (node && typeof node.remove === 'function') node.remove();
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1201
1323
|
/** 摘掉上一次物化留下的那一颗(插件重装、同一页面里出现第二份实现)。 */
|
|
1202
1324
|
function dropStaleFooterIcons(doc) {
|
|
1203
1325
|
if (!doc || typeof doc.querySelectorAll !== 'function') return;
|
|
@@ -1424,7 +1546,6 @@ window.__ModuleLoader__.load({
|
|
|
1424
1546
|
const outcome = await openConfigurationPage({ view, loadStatus, t, target: null, confirmed: true, navigate: false });
|
|
1425
1547
|
if (!outcome.ok) return outcome;
|
|
1426
1548
|
const consolePage = panelPageUrlOf('console');
|
|
1427
|
-
const debugPage = panelPageUrlOf('debug');
|
|
1428
1549
|
if (!consolePage) return { ok: false, missing: false, status: 0, message: t('panelMissing') };
|
|
1429
1550
|
const dialog = diagnosisDialog();
|
|
1430
1551
|
|
|
@@ -1434,16 +1555,16 @@ window.__ModuleLoader__.load({
|
|
|
1434
1555
|
* 网页(`http(s)`)里用**同源推算**的地址(`panelPageUrlOf`):公网 / 域名 / 反代
|
|
1435
1556
|
* 子路径都能对上,宿主报的 `panelUrl` 反而常是 `127.0.0.1`,从公网打开的人点过去
|
|
1436
1557
|
* 必然打不开。桌面壳里那条同源地址是 `dsh-app://`,系统浏览器不认,只能换用宿主
|
|
1437
|
-
* 报的绝对 http(s) 地址(`outcome.url
|
|
1558
|
+
* 报的绝对 http(s) 地址(`outcome.url`)。
|
|
1438
1559
|
*/
|
|
1439
|
-
const browserPageUrl = (
|
|
1440
|
-
if (isWebPage(window)) return
|
|
1560
|
+
const browserPageUrl = () => {
|
|
1561
|
+
if (isWebPage(window)) return consolePage;
|
|
1441
1562
|
const root = String(outcome.url || '').replace(/\/console\/?$/, '').replace(/\/+$/, '');
|
|
1442
1563
|
if (!/^https?:\/\//i.test(root)) return '';
|
|
1443
|
-
return
|
|
1564
|
+
return root;
|
|
1444
1565
|
};
|
|
1445
|
-
const openBrowser = (
|
|
1446
|
-
const url = browserPageUrl(
|
|
1566
|
+
const openBrowser = () => {
|
|
1567
|
+
const url = browserPageUrl();
|
|
1447
1568
|
if (!url) {
|
|
1448
1569
|
dialog.note(t('consolePopupBlocked'));
|
|
1449
1570
|
return;
|
|
@@ -1464,13 +1585,13 @@ window.__ModuleLoader__.load({
|
|
|
1464
1585
|
|
|
1465
1586
|
/**
|
|
1466
1587
|
* 点一下手机图标,**直接就是这一屏控制台**:不再有「进入控制台 / 报错调试」那一层
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
* 不该跟日常那一屏抢第一眼。
|
|
1588
|
+
* 中间入口。调试页没删,退到页面自己顶栏里那颗按钮;这一窗的外壳只留「在浏览器打开」
|
|
1589
|
+
* 与「关闭」两颗图标,剩下的操作都在页面里,不占嵌页的地方。
|
|
1470
1590
|
*/
|
|
1471
1591
|
dialog.open({
|
|
1472
1592
|
title: t('consoleTitle'),
|
|
1473
1593
|
wide: true,
|
|
1594
|
+
compact: true,
|
|
1474
1595
|
// 收起时不销毁(见 `hide`):再点一次图标就是热的,省掉一次整页重载。
|
|
1475
1596
|
keep: true,
|
|
1476
1597
|
frame: {
|
|
@@ -1479,48 +1600,15 @@ window.__ModuleLoader__.load({
|
|
|
1479
1600
|
loading: t('consoleLoading'),
|
|
1480
1601
|
hint: t('consoleFrameless'),
|
|
1481
1602
|
},
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
{ label: t('diagClose'), onClick: () => dialog.hide() },
|
|
1488
|
-
],
|
|
1603
|
+
// 窗口操作由页面顶栏那两颗按钮发消息过来;外壳这边只认消息、执行,不画按钮。
|
|
1604
|
+
onAction: (action) => {
|
|
1605
|
+
if (action === 'open-browser') openBrowser();
|
|
1606
|
+
else if (action === 'close') dialog.hide();
|
|
1607
|
+
},
|
|
1489
1608
|
});
|
|
1490
1609
|
return { ok: true, webAccess: outcome.webAccess };
|
|
1491
1610
|
}
|
|
1492
1611
|
|
|
1493
|
-
/** 把「复制诊断信息」那一套复用在控制台上:读的是嵌入页同样的几份,不另开一套。 */
|
|
1494
|
-
async function copyConsole() {
|
|
1495
|
-
const dialog = diagnosisDialog();
|
|
1496
|
-
const lines = ['dsh-mobile-plugin console'];
|
|
1497
|
-
lines.push(`panel_url=${url || ''}`);
|
|
1498
|
-
lines.push(`panel_scope=${panelScope || ''}`);
|
|
1499
|
-
try {
|
|
1500
|
-
const view = await call('/status');
|
|
1501
|
-
const next = view && typeof view === 'object' ? view : {};
|
|
1502
|
-
lines.push(`plugin_version=${next.appVersion || ''}`);
|
|
1503
|
-
lines.push(`tunnel=${next.tunnel && next.tunnel.state ? next.tunnel.state : ''}`);
|
|
1504
|
-
lines.push(`lan=${next.lan && next.lan.state ? next.lan.state : ''}`);
|
|
1505
|
-
lines.push(`sidecar=${next.sidecar && next.sidecar.state ? next.sidecar.state : ''}`);
|
|
1506
|
-
lines.push(`last_mobile_at=${next.lastMobileAt || 0}`);
|
|
1507
|
-
} catch (error) {
|
|
1508
|
-
lines.push(`status_error=${String((error && error.message) || error)}`);
|
|
1509
|
-
}
|
|
1510
|
-
try {
|
|
1511
|
-
const picture = await call(HOST_HALF_ENDPOINT);
|
|
1512
|
-
const half = picture && picture.half && typeof picture.half === 'object' ? picture.half : {};
|
|
1513
|
-
lines.push(`plugin_source=${half.source || ''}`);
|
|
1514
|
-
lines.push(`host_last_error=${half.lastError || ''}`);
|
|
1515
|
-
} catch {
|
|
1516
|
-
lines.push('host_half=unavailable');
|
|
1517
|
-
}
|
|
1518
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent) lines.push(`user_agent=${navigator.userAgent}`);
|
|
1519
|
-
const ok = await copyDiagnosisText(document, lines.join('\n'));
|
|
1520
|
-
// 复制结果就地提示一下即可,不必重画整窗(重画会把嵌着的页面重新加载一遍)。
|
|
1521
|
-
dialog.note(ok ? t('diagCopied') : t('diagCopyFailed'));
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
1612
|
/**
|
|
1525
1613
|
* 把这一轮的现场摆成一屏**能自己动手**的自查。
|
|
1526
1614
|
*
|
|
@@ -1839,6 +1927,279 @@ window.__ModuleLoader__.load({
|
|
|
1839
1927
|
return null;
|
|
1840
1928
|
}
|
|
1841
1929
|
|
|
1930
|
+
/**
|
|
1931
|
+
* 侧边栏底部那颗电脑图标(远程电脑独立页的入口)。
|
|
1932
|
+
*
|
|
1933
|
+
* 与手机图标并排,共用同一套状态读数与两小时窗口逻辑:地址、网络类别、窗口状态都从
|
|
1934
|
+
* 同一条 `/status` 来。它只是打开另一条面板页(`/api/relay/panel/remote`),所以没有
|
|
1935
|
+
* 手机图标那一套链路告警着色——这一颗是纯入口,状态色交给旁边那颗去说。
|
|
1936
|
+
*
|
|
1937
|
+
* 点下去和手机图标一样弹一扇内嵌窗(不是跳走):公网地址先按 `panelScope` 开好两小时
|
|
1938
|
+
* 窗口,本机与局域网直接进。打不开时落到诊断窗,不许「点了没反应」。
|
|
1939
|
+
*/
|
|
1940
|
+
function RemoteWebEntry({ wide, t }) {
|
|
1941
|
+
const [url, setUrl] = useState(null);
|
|
1942
|
+
const [webAccess, setWebAccess] = useState(null);
|
|
1943
|
+
const [panelScope, setPanelScope] = useState('');
|
|
1944
|
+
const [problem, setProblem] = useState(null);
|
|
1945
|
+
const [anchored, setAnchored] = useState(true);
|
|
1946
|
+
const nodeRef = useRef(null);
|
|
1947
|
+
const dialogRef = useRef(null);
|
|
1948
|
+
useEffect(() => () => {
|
|
1949
|
+
if (dialogRef.current) dialogRef.current.dispose();
|
|
1950
|
+
dialogRef.current = null;
|
|
1951
|
+
}, []);
|
|
1952
|
+
|
|
1953
|
+
const openLabel = t('footerRemoteOpen');
|
|
1954
|
+
const pendingLabel = t('footerPending');
|
|
1955
|
+
|
|
1956
|
+
/** 拉一次状态;电脑图标只要地址与窗口类别,不碰设备数与链路告警。 */
|
|
1957
|
+
async function refreshStatus() {
|
|
1958
|
+
try {
|
|
1959
|
+
const next = await call('/status');
|
|
1960
|
+
const view = readStatusView(next);
|
|
1961
|
+
setUrl(view.panelUrl);
|
|
1962
|
+
setWebAccess(view.webAccess);
|
|
1963
|
+
setPanelScope(view.panelScope);
|
|
1964
|
+
setProblem(null);
|
|
1965
|
+
return { ok: true, status: next };
|
|
1966
|
+
} catch (error) {
|
|
1967
|
+
const failed = {
|
|
1968
|
+
status: Number(error && error.status) || 0,
|
|
1969
|
+
message: String((error && error.message) || error),
|
|
1970
|
+
};
|
|
1971
|
+
setProblem(failed);
|
|
1972
|
+
return { ok: false, problem: failed };
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
/** 诊断窗单例:与手机图标那扇分开,两扇互不顶掉。 */
|
|
1977
|
+
function diagnosisDialog() {
|
|
1978
|
+
if (!dialogRef.current) {
|
|
1979
|
+
dialogRef.current = createDiagnosisDialog(typeof document !== 'undefined' ? document : null);
|
|
1980
|
+
}
|
|
1981
|
+
return dialogRef.current;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
/** 打不开时落到诊断窗:宿主与外壳各说了什么、能一键试的重试与复制读数。 */
|
|
1985
|
+
async function openDiagnosis(failure) {
|
|
1986
|
+
if (typeof document === 'undefined') return;
|
|
1987
|
+
const view = diagnosisDialog();
|
|
1988
|
+
let current = failure || problem || null;
|
|
1989
|
+
let half = null;
|
|
1990
|
+
const snapshot = {
|
|
1991
|
+
url: typeof url === 'string' ? url : '',
|
|
1992
|
+
scope: panelScope || 'unknown',
|
|
1993
|
+
access: webAccess,
|
|
1994
|
+
};
|
|
1995
|
+
const closeAction = { label: t('diagClose'), onClick: () => view.hide() };
|
|
1996
|
+
const readHalf = async () => {
|
|
1997
|
+
try {
|
|
1998
|
+
const picture = await call(HOST_HALF_ENDPOINT);
|
|
1999
|
+
half = picture && picture.half && typeof picture.half === 'object' ? picture.half : { unavailable: true };
|
|
2000
|
+
} catch {
|
|
2001
|
+
half = { unavailable: true };
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
const facts = () => {
|
|
2005
|
+
const rows = [];
|
|
2006
|
+
if (current) {
|
|
2007
|
+
rows.push({ key: 'host_returned', label: t('diagFactReturned'), value: current.message });
|
|
2008
|
+
rows.push({ key: 'http_status', label: t('diagFactStatus'), value: current.status ? String(current.status) : '—' });
|
|
2009
|
+
}
|
|
2010
|
+
rows.push({ key: 'panel_url', label: t('diagFactPanelUrl'), value: snapshot.url || '—' });
|
|
2011
|
+
rows.push({ key: 'panel_scope', label: t('diagFactScope'), value: snapshot.scope });
|
|
2012
|
+
if (half && half.lastError) rows.push({ key: 'host_last_error', label: t('diagFactReason'), value: half.lastError });
|
|
2013
|
+
return rows;
|
|
2014
|
+
};
|
|
2015
|
+
const render = (note) => {
|
|
2016
|
+
view.open({
|
|
2017
|
+
title: t('diagTitleOpen'),
|
|
2018
|
+
summary: current ? t('diagSummaryOpenFailed') : t('diagChecking'),
|
|
2019
|
+
factsHeading: t('diagHeadingFacts'),
|
|
2020
|
+
facts: facts(),
|
|
2021
|
+
actions: [closeAction],
|
|
2022
|
+
note,
|
|
2023
|
+
});
|
|
2024
|
+
};
|
|
2025
|
+
view.open({ title: t('diagTitleOpen'), actions: [closeAction] });
|
|
2026
|
+
await readHalf();
|
|
2027
|
+
render(null);
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
/**
|
|
2031
|
+
* 点电脑图标:公网先确认并开两小时窗口,然后弹一扇内嵌远程电脑页的窗。
|
|
2032
|
+
*
|
|
2033
|
+
* 与手机图标走的是同一条 `openConfigurationPage` 拨号(地址、窗口、公网确认全在那儿),
|
|
2034
|
+
* 区别只在内嵌的是 `/remote` 那一页。新窗口不在这里开:`navigate:false` 只确认访问,
|
|
2035
|
+
* 页面本身嵌进诊断窗的 iframe。
|
|
2036
|
+
*/
|
|
2037
|
+
function openRemote(event) {
|
|
2038
|
+
if (event && typeof event.preventDefault === 'function') event.preventDefault();
|
|
2039
|
+
const willOpenWindow = panelScope !== 'loopback' && panelScope !== 'private' && !(webAccess && webAccess.enabled);
|
|
2040
|
+
if (panelScope === 'public' && url && willOpenWindow
|
|
2041
|
+
&& typeof window !== 'undefined' && typeof window.confirm === 'function'
|
|
2042
|
+
&& !window.confirm(t('footerPublicConfirm'))) return;
|
|
2043
|
+
void (async () => {
|
|
2044
|
+
const outcome = await openConfigurationPage({
|
|
2045
|
+
view: { panelUrl: url || '', panelScope, webAccess },
|
|
2046
|
+
loadStatus: problem ? problem.status : 0,
|
|
2047
|
+
t,
|
|
2048
|
+
target: null,
|
|
2049
|
+
confirmed: true,
|
|
2050
|
+
navigate: false,
|
|
2051
|
+
});
|
|
2052
|
+
if (!outcome.ok) {
|
|
2053
|
+
if (outcome.missing) void openDiagnosis({ status: outcome.status || 404, message: '' });
|
|
2054
|
+
else void openDiagnosis({ status: outcome.status || 0, message: outcome.message });
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
if (outcome.webAccess) setWebAccess(outcome.webAccess);
|
|
2058
|
+
const remotePage = panelPageUrlOf('remote');
|
|
2059
|
+
if (!remotePage) {
|
|
2060
|
+
void openDiagnosis({ status: 0, message: t('panelMissing') });
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
const dialog = diagnosisDialog();
|
|
2064
|
+
const browserOpen = () => {
|
|
2065
|
+
if (typeof window === 'undefined' || typeof window.open !== 'function') return;
|
|
2066
|
+
const opened = window.open(remotePage, '_blank', 'noreferrer');
|
|
2067
|
+
if (opened) dialog.dispose();
|
|
2068
|
+
else dialog.note(t('consolePopupBlocked'));
|
|
2069
|
+
};
|
|
2070
|
+
dialog.open({
|
|
2071
|
+
title: t('remoteConsoleTitle'),
|
|
2072
|
+
wide: true,
|
|
2073
|
+
compact: true,
|
|
2074
|
+
keep: true,
|
|
2075
|
+
frame: { src: remotePage, title: t('remoteConsoleTitle'), loading: t('consoleLoading') },
|
|
2076
|
+
onAction: (action) => {
|
|
2077
|
+
if (action === 'open-browser') browserOpen();
|
|
2078
|
+
else if (action === 'close') dialog.hide();
|
|
2079
|
+
},
|
|
2080
|
+
});
|
|
2081
|
+
})();
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
// 页面一打开就问一次地址:点下去要么进窗、要么先开窗再读。取到就停,没取到后台重试。
|
|
2085
|
+
useEffect(() => {
|
|
2086
|
+
let alive = true;
|
|
2087
|
+
let timer = null;
|
|
2088
|
+
const load = async () => {
|
|
2089
|
+
const outcome = await refreshStatus();
|
|
2090
|
+
if (!alive || !outcome.ok) return;
|
|
2091
|
+
const next = outcome.status || {};
|
|
2092
|
+
if (typeof next.panelUrl === 'string' && next.panelUrl && timer !== null) {
|
|
2093
|
+
clearInterval(timer);
|
|
2094
|
+
timer = null;
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
void load();
|
|
2098
|
+
if (timer === null) {
|
|
2099
|
+
timer = setInterval(() => {
|
|
2100
|
+
if (typeof document !== 'undefined' && document.hidden) return;
|
|
2101
|
+
void load();
|
|
2102
|
+
}, FOOTER_URL_RETRY_MS);
|
|
2103
|
+
}
|
|
2104
|
+
return () => {
|
|
2105
|
+
alive = false;
|
|
2106
|
+
if (timer !== null) clearInterval(timer);
|
|
2107
|
+
};
|
|
2108
|
+
}, []);
|
|
2109
|
+
|
|
2110
|
+
// 展开态:纯 DOM 插进设置那一行,紧跟手机图标;认不出位置就退回自己一行。
|
|
2111
|
+
useEffect(() => {
|
|
2112
|
+
if (typeof document === 'undefined') return undefined;
|
|
2113
|
+
const doc = document;
|
|
2114
|
+
if (!wide) {
|
|
2115
|
+
setAnchored(false);
|
|
2116
|
+
return undefined;
|
|
2117
|
+
}
|
|
2118
|
+
let node = nodeRef.current;
|
|
2119
|
+
if (!node) {
|
|
2120
|
+
try {
|
|
2121
|
+
dropStaleRemoteIcons(doc);
|
|
2122
|
+
node = createRemoteFooterIcon(doc);
|
|
2123
|
+
} catch {
|
|
2124
|
+
node = null;
|
|
2125
|
+
}
|
|
2126
|
+
nodeRef.current = node;
|
|
2127
|
+
}
|
|
2128
|
+
if (!node) {
|
|
2129
|
+
setAnchored(false);
|
|
2130
|
+
return undefined;
|
|
2131
|
+
}
|
|
2132
|
+
const sync = () => {
|
|
2133
|
+
node.setAttribute('aria-label', openLabel);
|
|
2134
|
+
node.setAttribute('title', openLabel);
|
|
2135
|
+
node.setAttribute('aria-disabled', 'false');
|
|
2136
|
+
if (url) node.setAttribute('href', url);
|
|
2137
|
+
else node.removeAttribute('href');
|
|
2138
|
+
node.onclick = openRemote;
|
|
2139
|
+
};
|
|
2140
|
+
let attached = false;
|
|
2141
|
+
try {
|
|
2142
|
+
attached = ensureRemoteFooterIcon(doc, node);
|
|
2143
|
+
sync();
|
|
2144
|
+
} catch {
|
|
2145
|
+
attached = false;
|
|
2146
|
+
}
|
|
2147
|
+
setAnchored(attached);
|
|
2148
|
+
const Observer = typeof window !== 'undefined' ? window.MutationObserver : undefined;
|
|
2149
|
+
let observer = null;
|
|
2150
|
+
let frame = 0;
|
|
2151
|
+
if (typeof Observer === 'function' && doc.body) {
|
|
2152
|
+
observer = new Observer(() => {
|
|
2153
|
+
if (frame !== 0) return;
|
|
2154
|
+
const raf = typeof requestAnimationFrame === 'function'
|
|
2155
|
+
? requestAnimationFrame
|
|
2156
|
+
: (fn) => setTimeout(fn, 16);
|
|
2157
|
+
frame = raf(() => {
|
|
2158
|
+
frame = 0;
|
|
2159
|
+
try {
|
|
2160
|
+
sync();
|
|
2161
|
+
setAnchored(ensureRemoteFooterIcon(doc, node));
|
|
2162
|
+
} catch {
|
|
2163
|
+
setAnchored(false);
|
|
2164
|
+
}
|
|
2165
|
+
});
|
|
2166
|
+
});
|
|
2167
|
+
observer.observe(doc.body, { childList: true, subtree: true });
|
|
2168
|
+
}
|
|
2169
|
+
return () => {
|
|
2170
|
+
if (observer !== null) observer.disconnect();
|
|
2171
|
+
if (frame !== 0 && typeof cancelAnimationFrame === 'function') cancelAnimationFrame(frame);
|
|
2172
|
+
if (typeof node.remove === 'function' && node.parentElement) node.remove();
|
|
2173
|
+
};
|
|
2174
|
+
}, [wide, url, openLabel, problem, panelScope, webAccess]);
|
|
2175
|
+
|
|
2176
|
+
// 窄条,或认不出那一行:自己占一行,入口不能因为认不出位置就消失。
|
|
2177
|
+
if (!wide || !anchored) {
|
|
2178
|
+
return h('a', {
|
|
2179
|
+
className: 'dshm_footAction dshm_footActionRail',
|
|
2180
|
+
href: url || undefined,
|
|
2181
|
+
target: '_blank',
|
|
2182
|
+
rel: 'noreferrer',
|
|
2183
|
+
'aria-label': openLabel,
|
|
2184
|
+
title: openLabel,
|
|
2185
|
+
'aria-disabled': 'false',
|
|
2186
|
+
onClick: openRemote,
|
|
2187
|
+
}, h('svg', {
|
|
2188
|
+
viewBox: '0 0 24 24',
|
|
2189
|
+
width: PHONE_GLYPH_RAIL,
|
|
2190
|
+
height: PHONE_GLYPH_RAIL,
|
|
2191
|
+
fill: 'none',
|
|
2192
|
+
stroke: 'currentColor',
|
|
2193
|
+
strokeWidth: 1.7,
|
|
2194
|
+
strokeLinecap: 'round',
|
|
2195
|
+
strokeLinejoin: 'round',
|
|
2196
|
+
'aria-hidden': 'true',
|
|
2197
|
+
focusable: 'false',
|
|
2198
|
+
}, COMPUTER_PATHS.map((d) => h('path', { key: d, d }))));
|
|
2199
|
+
}
|
|
2200
|
+
return null;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
1842
2203
|
/**
|
|
1843
2204
|
* 客户端半边的自检上报:每 10s 把「这一半到底看见了什么」报给宿主。
|
|
1844
2205
|
*
|
|
@@ -2371,6 +2732,16 @@ window.__ModuleLoader__.load({
|
|
|
2371
2732
|
locale: NS,
|
|
2372
2733
|
inject: () => ({ t }),
|
|
2373
2734
|
}, MobileWebEntry));
|
|
2735
|
+
// 手机图标右边那颗电脑图标:远程电脑独立页的入口。展开态由组件自己插到手机图标
|
|
2736
|
+
// 后面(两个组件分别物化、谁先谁后不定,认手机图标的记号定位),窄条态各占一行。
|
|
2737
|
+
ctx.slots.inject(FOOTER_SLOT, () => ctx.slots.register({
|
|
2738
|
+
name: FOOTER_SLOT,
|
|
2739
|
+
id: 'remote-web',
|
|
2740
|
+
order: 11,
|
|
2741
|
+
label: () => t('footerRemoteOpen'),
|
|
2742
|
+
locale: NS,
|
|
2743
|
+
inject: () => ({ t }),
|
|
2744
|
+
}, RemoteWebEntry));
|
|
2374
2745
|
},
|
|
2375
2746
|
};
|
|
2376
2747
|
},
|