dsh-mobile-ios 0.2.7 → 0.2.8
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 +31 -8
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -1038,9 +1038,12 @@ window.__ModuleLoader__.load({
|
|
|
1038
1038
|
/** 自举安装 cloudflared:先弹窗征得同意,确认后经网关从官方源下载到私有目录。
|
|
1039
1039
|
* 安装成功即重探状态(发现链已含组件目录),让本次点击继续走开启远程。 */
|
|
1040
1040
|
let installBusy = false;
|
|
1041
|
+
let installBanner = null; // 保存触发安装的 banner,供成功后自动继续出码(onClick 只传按钮,不传 banner)
|
|
1042
|
+
let autoContinueTimer = null; // 安装成功后延迟自动出码的定时器,允许手动「立即开启」取消
|
|
1041
1043
|
async function installCloudflaredAction(banner) {
|
|
1042
1044
|
if (installBusy) return;
|
|
1043
1045
|
installBusy = true;
|
|
1046
|
+
installBanner = banner || null;
|
|
1044
1047
|
try {
|
|
1045
1048
|
showUpdateModal({
|
|
1046
1049
|
title: '安装 cloudflared',
|
|
@@ -1051,8 +1054,8 @@ window.__ModuleLoader__.load({
|
|
|
1051
1054
|
],
|
|
1052
1055
|
note: '将从 Cloudflare 官方发布地址下载 cloudflared 到本机,仅用于远程通道。下载期间请保持网络畅通,是否继续?',
|
|
1053
1056
|
actions: [
|
|
1054
|
-
{ label: '取消', onClick: closeUpdateModal },
|
|
1055
|
-
{ label: '确认下载并安装', primary: true, onClick: runInstall },
|
|
1057
|
+
{ label: '取消', onClick: () => { installBanner = null; closeUpdateModal(); } },
|
|
1058
|
+
{ label: '确认下载并安装', primary: true, onClick: () => runInstall() },
|
|
1056
1059
|
],
|
|
1057
1060
|
});
|
|
1058
1061
|
} finally {
|
|
@@ -1060,11 +1063,20 @@ window.__ModuleLoader__.load({
|
|
|
1060
1063
|
}
|
|
1061
1064
|
}
|
|
1062
1065
|
|
|
1063
|
-
|
|
1066
|
+
// 安装成功后接着走「确保隧道起来 → 出码」。抽出来供安装链与手动链共用,
|
|
1067
|
+
// 避免「装完只弹提示、还得再点一次」的伪无反应。
|
|
1068
|
+
async function continueRemoteAfterInstall() {
|
|
1069
|
+
const banner = installBanner;
|
|
1070
|
+
installBanner = null;
|
|
1071
|
+
await remoteMainAction(banner);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
async function runInstall() {
|
|
1064
1075
|
if (installBusy) return;
|
|
1065
1076
|
installBusy = true;
|
|
1066
1077
|
const mainBtn = panelEl?.querySelector('#dsh-mios-remote-main');
|
|
1067
|
-
if (mainBtn) mainBtn.textContent = '安装中…';
|
|
1078
|
+
if (mainBtn) { mainBtn.textContent = '安装中…'; mainBtn.disabled = true; }
|
|
1079
|
+
// 先把确认框换成「正在安装」——用户点确认后立即有可见反馈,不进入静默等待。
|
|
1068
1080
|
showUpdateModal({
|
|
1069
1081
|
title: '正在安装',
|
|
1070
1082
|
banner: { text: '⏳ 正在下载 cloudflared,请稍候', tone: 'info' },
|
|
@@ -1072,18 +1084,20 @@ window.__ModuleLoader__.load({
|
|
|
1072
1084
|
note: '首次下载约几十 MB,取决于网速,请耐心等待,不要关闭窗口。',
|
|
1073
1085
|
actions: [],
|
|
1074
1086
|
});
|
|
1087
|
+
let succeeded = false;
|
|
1075
1088
|
try {
|
|
1076
1089
|
const res = await fetchJson('/mobile/v1/tunnel/install-cloudflared', { method: 'POST' }, 240000);
|
|
1077
1090
|
await probe();
|
|
1078
1091
|
renderSummary();
|
|
1079
1092
|
const nowFound = summary?.tunnel?.executable === 'found';
|
|
1080
1093
|
if (!nowFound) throw new Error('安装完成但网关尚未识别到 cloudflared,请重开面板重试');
|
|
1094
|
+
succeeded = true;
|
|
1081
1095
|
showUpdateModal({
|
|
1082
1096
|
title: '安装完成',
|
|
1083
|
-
banner: { text: '✅ cloudflared
|
|
1097
|
+
banner: { text: '✅ cloudflared 已就绪,正在开启远程…', tone: 'success' },
|
|
1084
1098
|
lines: [],
|
|
1085
|
-
note: res?.reused ? '本机已有 cloudflared
|
|
1086
|
-
actions: [{ label: '
|
|
1099
|
+
note: res?.reused ? '本机已有 cloudflared,无需重复下载。正在为你开启远程并出码。' : 'cloudflared 已安装。正在为你开启远程并出码。',
|
|
1100
|
+
actions: [{ label: '立即开启远程', primary: true, onClick: () => { if (autoContinueTimer) { clearTimeout(autoContinueTimer); autoContinueTimer = null; } closeUpdateModal(); continueRemoteAfterInstall(); } }],
|
|
1087
1101
|
});
|
|
1088
1102
|
} catch (err) {
|
|
1089
1103
|
showUpdateModal({
|
|
@@ -1093,12 +1107,21 @@ window.__ModuleLoader__.load({
|
|
|
1093
1107
|
note: `${err?.body?.error?.message || err?.message || String(err)}。可检查网络后重试,或按提示手动安装 cloudflared。`,
|
|
1094
1108
|
actions: [
|
|
1095
1109
|
{ label: '关闭', onClick: closeUpdateModal },
|
|
1096
|
-
{ label: '重试安装', primary: true, onClick: runInstall },
|
|
1110
|
+
{ label: '重试安装', primary: true, onClick: () => runInstall() },
|
|
1097
1111
|
],
|
|
1098
1112
|
});
|
|
1099
1113
|
} finally {
|
|
1100
1114
|
installBusy = false;
|
|
1101
1115
|
renderSummary();
|
|
1116
|
+
// 关键修复:安装成功后自动继续出码,无需用户再点一次主按钮。
|
|
1117
|
+
if (succeeded) {
|
|
1118
|
+
if (autoContinueTimer) clearTimeout(autoContinueTimer);
|
|
1119
|
+
autoContinueTimer = setTimeout(() => {
|
|
1120
|
+
autoContinueTimer = null;
|
|
1121
|
+
closeUpdateModal();
|
|
1122
|
+
continueRemoteAfterInstall();
|
|
1123
|
+
}, 900);
|
|
1124
|
+
}
|
|
1102
1125
|
}
|
|
1103
1126
|
}
|
|
1104
1127
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mobile-ios",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DSH iOS移动伴侣:iPhone/iPad 扫码连接 DSH 桌面端,局域网直连 + Cloudflare Tunnel 固定域名远程两种通道",
|
|
6
6
|
"main": "entries/plugin.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"start": "node entries/sidecar.mjs --host=mock --dev",
|
|
31
31
|
"start:lan": "node entries/sidecar.mjs --host=mock --dev --lan=true",
|
|
32
32
|
"probe": "node spike0/probe.mjs",
|
|
33
|
-
"test": "node test/selftest.mjs && node test/version.mjs && node test/update-dialog.mjs && node test/ops.mjs && node test/resilience.mjs && node test/borrowed.mjs && node test/mux-table.mjs && node test/live-frames.mjs && node test/artifacts.mjs && node test/attachments.mjs && node test/session-actions.mjs && node test/enhance.mjs && node test/tunnel-named.mjs && node test/cloudflared-install.mjs"
|
|
33
|
+
"test": "node test/selftest.mjs && node test/version.mjs && node test/update-dialog.mjs && node test/ops.mjs && node test/resilience.mjs && node test/borrowed.mjs && node test/mux-table.mjs && node test/live-frames.mjs && node test/artifacts.mjs && node test/attachments.mjs && node test/session-actions.mjs && node test/enhance.mjs && node test/tunnel-named.mjs && node test/cloudflared-install.mjs && node test/install-continue.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dsh": {
|
|
36
36
|
"bundle": {
|