@dsh-mobile/mobile-remote 3.3.1 → 3.4.1-beta.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.
Files changed (58) hide show
  1. package/README.md +9 -5
  2. package/docs/PRIVACY-POLICY.en.md +10 -3
  3. package/docs/PRIVACY-POLICY.md +10 -3
  4. package/docs/USER-GUIDE.zh-CN.md +1 -0
  5. package/lib/account-usage-query.js +60 -60
  6. package/lib/account-usage.js +10 -10
  7. package/lib/api-helpers.js +109 -109
  8. package/lib/assistant-prefs.js +82 -59
  9. package/lib/auto-config.js +65 -65
  10. package/lib/backup.js +117 -117
  11. package/lib/break-reminder.js +45 -45
  12. package/lib/client.js +93 -93
  13. package/lib/config.js +234 -218
  14. package/lib/git-read-bundled-provider.js +12 -12
  15. package/lib/git-read-service.js +5 -5
  16. package/lib/host-compat.js +84 -84
  17. package/lib/http-util.js +17 -17
  18. package/lib/index.js +1534 -1534
  19. package/lib/memory/context.js +44 -44
  20. package/lib/memory/decay.js +93 -93
  21. package/lib/memory/extract.js +77 -77
  22. package/lib/memory/routes.js +33 -33
  23. package/lib/memory/store.js +196 -196
  24. package/lib/notify-copy.js +93 -93
  25. package/lib/permission-guide.js +86 -86
  26. package/lib/persona-cards.js +73 -65
  27. package/lib/phone-action-args.js +175 -0
  28. package/lib/phone-actions.js +227 -0
  29. package/lib/phone-announce.js +58 -0
  30. package/lib/proactive-material.js +42 -42
  31. package/lib/proactive.js +121 -121
  32. package/lib/protected-paths.js +79 -79
  33. package/lib/protocol.js +61 -26
  34. package/lib/push.js +29 -29
  35. package/lib/rate-limit.js +16 -16
  36. package/lib/relay/connector.js +246 -102
  37. package/lib/relay/crypto.js +15 -15
  38. package/lib/relay/devices.js +36 -36
  39. package/lib/relay/fingerprint.js +34 -34
  40. package/lib/relay/identity.js +26 -26
  41. package/lib/relay/mux.js +60 -46
  42. package/lib/relay/noise.js +40 -40
  43. package/lib/relay/on-demand.js +33 -33
  44. package/lib/relay/p2p.js +239 -0
  45. package/lib/relay/pairing.js +24 -24
  46. package/lib/relay/phone.js +62 -40
  47. package/lib/relay/serve.js +21 -21
  48. package/lib/relay/signal.js +69 -0
  49. package/lib/relay/ws-server.js +32 -32
  50. package/lib/reminders.js +15 -15
  51. package/lib/rpc-adapter.js +43 -43
  52. package/lib/session-list.js +31 -31
  53. package/lib/session-rotation.js +95 -95
  54. package/lib/session-title-cache.js +35 -35
  55. package/lib/session-title-refresh.js +51 -51
  56. package/lib/timeline.js +140 -140
  57. package/lib/turn-outline.js +104 -104
  58. package/package.json +3 -13
@@ -1,30 +1,30 @@
1
- /**
2
- * Break reminder (T-15; plan §5.7, decision D10). Work framing only: it says how long you
3
- * have been working and nothing else. No streaks, no guilt, nothing caused by absence.
4
- *
5
- * What counts as activity is decided by the caller and fed in through `activity()`: in the
6
- * plugin that is activity *from a person* (a message the user typed in any DSH client, see
7
- * `isUserActivityEvent`, and a write request from the phone), not the agent's own output or
8
- * injected messages, so an unattended run does not count.
9
- *
10
- * Rules:
11
- * - a gap of `idleResetMs` (10 min) or more between activities starts the count again;
12
- * - after `afterMs` (2 h) of continuous activity, `check()` reminds once and the count
13
- * starts again, so the next reminder needs another full stretch;
14
- * - at most one reminder per `minIntervalMs` (2 h), whatever happens to the count;
15
- * - never while `isQuiet(date)` says quiet hours; never while `isEnabled()` is false.
16
- *
17
- * Pure state plus an injected clock, so every rule can be tested with a fake one. Nothing is
18
- * written to disk: after a restart the count starts again, which can only delay a reminder.
19
- */
20
-
21
- /**
22
- * Whether a session event is a person typing (T-15 review follow-up). Only `user/message`
23
- * events whose source is `"user"` count (the kernel marks system injections with `plugin`,
24
- * `tool`, `model`, `agent-instructions` and so on, in `data.source` or `data.message.source`),
25
- * and never in a subagent session. Otherwise an unattended tool loop that injects messages
26
- * would keep the count going and the user would be told they worked 2 h while away.
27
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
28
  export function isUserActivityEvent(session, event) {
29
29
  if (event?.type !== "user/message") return false;
30
30
  if (session?.header?.origin === "subagent") return false;
@@ -35,19 +35,19 @@ export function isUserActivityEvent(session, event) {
35
35
  export const BREAK_AFTER_MS = 2 * 60 * 60_000;
36
36
  export const BREAK_IDLE_RESET_MS = 10 * 60_000;
37
37
  export const BREAK_MIN_INTERVAL_MS = 2 * 60 * 60_000;
38
- /** How often the plugin calls `check()`. Minute precision is plenty for a 2-hour rule. */
38
+
39
39
  export const BREAK_CHECK_MS = 60_000;
40
40
 
41
- /**
42
- * @param {object} [e]
43
- * @param {() => number} [e.now] clock in ms (tests inject a fake one)
44
- * @param {() => boolean} [e.isEnabled] the off switches (config and the app's setting)
45
- * @param {(at: Date) => boolean} [e.isQuiet] quiet hours, in local time
46
- * @param {(r: {at: number, workedMs: number}) => void} [e.remind] deliver one reminder
47
- * @param {number} [e.afterMs]
48
- * @param {number} [e.idleResetMs]
49
- * @param {number} [e.minIntervalMs]
50
- */
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
51
  export function createBreakReminder({
52
52
  now = () => Date.now(),
53
53
  isEnabled = () => true,
@@ -57,7 +57,7 @@ export function createBreakReminder({
57
57
  idleResetMs = BREAK_IDLE_RESET_MS,
58
58
  minIntervalMs = BREAK_MIN_INTERVAL_MS,
59
59
  } = {}) {
60
- /** Start of the current continuous stretch, or null when there is none. */
60
+
61
61
  let streakStart = null;
62
62
  let lastActivityAt = null;
63
63
  let lastRemindedAt = null;
@@ -69,14 +69,14 @@ export function createBreakReminder({
69
69
  lastActivityAt = null;
70
70
  };
71
71
 
72
- /** Record one piece of client activity. */
72
+
73
73
  function activity(at = now()) {
74
- // A long gap, or the clock moving backwards, starts a new stretch.
74
+
75
75
  if (lastActivityAt === null || at < lastActivityAt || at - lastActivityAt >= idleResetMs) streakStart = at;
76
76
  lastActivityAt = at;
77
77
  }
78
78
 
79
- /** Decide whether to remind now. Returns `{ fired, reason, workedMs? }`. */
79
+
80
80
  function check(at = now()) {
81
81
  const result = (() => {
82
82
  if (streakStart === null) return { fired: false, reason: "no-activity" };
@@ -88,7 +88,7 @@ export function createBreakReminder({
88
88
  reset();
89
89
  return { fired: false, reason: "idle-reset" };
90
90
  }
91
- // Switched off: keep counting, so switching it back on behaves as if it had been on.
91
+
92
92
  if (!isEnabled()) return { fired: false, reason: "disabled" };
93
93
  const workedMs = at - streakStart;
94
94
  if (workedMs < afterMs) return { fired: false, reason: "not-yet" };
@@ -111,7 +111,7 @@ export function createBreakReminder({
111
111
  try {
112
112
  check();
113
113
  } catch {
114
- // A failing delivery must not stop the timer; the next check tries again later.
114
+
115
115
  }
116
116
  }, intervalMs);
117
117
  timer.unref?.();
@@ -127,7 +127,7 @@ export function createBreakReminder({
127
127
  check,
128
128
  start,
129
129
  stop,
130
- /** Read-only state for diagnostics and tests. */
130
+
131
131
  snapshot: () => ({ streakStart, lastActivityAt, lastRemindedAt, lastReason, running: timer !== null }),
132
132
  };
133
133
  }
package/lib/client.js CHANGED
@@ -1,14 +1,14 @@
1
- // DSH Mobile Remote — 桌面 GUI 客户端模块
2
- // 在 dsh 设置页注册"连接移动端设备"页:显示供手机 App 扫码连接的二维码。
3
- //
4
- // 打包形态:window.__ModuleLoader__.load({ id, factory })(dsh-client-modules 约定)。
5
- // 手写 React.createElement(无 JSX/构建链),依赖由 dsh 客户端运行时提供。
6
- // 数据来源:POST /m/api/relay/pairing {mode:"lan"}(默认二维码:局域网加密配对,T-71)与
7
- // GET /m/api/qr-config(旧版 App 用的不加密二维码:地址+口令)。两者都仅限电脑本机桌面访问。
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
8
 
9
9
  window.__ModuleLoader__.load({
10
- // 必须与 package.json 的 name 逐字相同:宿主按包名等待这个 id 注册,对不上就报
11
- // "loaded without registering …"、设置页整块不显示(test/package-manifest.test.mjs 守着这条)。
10
+
11
+
12
12
  id: "@dsh-mobile/mobile-remote",
13
13
  factory: (require) => {
14
14
  var module = { exports: {} };
@@ -20,7 +20,7 @@ window.__ModuleLoader__.load({
20
20
  var useState = react.useState;
21
21
  var useEffect = react.useEffect;
22
22
 
23
- /** 所需服务:slots(设置页 slot 注册)。 */
23
+
24
24
  exports.inject = ["slots"];
25
25
 
26
26
  var QR_CONFIG = "/m/api/qr-config";
@@ -67,7 +67,7 @@ window.__ModuleLoader__.load({
67
67
  }
68
68
 
69
69
  function fallbackCopy(text) {
70
- // 非安全上下文(http 局域网 IP)下 Clipboard API 不可用,用 textarea + execCommand 降级
70
+
71
71
  var ta = document.createElement("textarea");
72
72
  ta.value = text;
73
73
  ta.style.position = "fixed";
@@ -77,7 +77,7 @@ window.__ModuleLoader__.load({
77
77
  try {
78
78
  document.execCommand("copy");
79
79
  } catch (_) {
80
- /* 忽略 */
80
+
81
81
  }
82
82
  ta.remove();
83
83
  }
@@ -100,7 +100,7 @@ window.__ModuleLoader__.load({
100
100
  }
101
101
  }
102
102
 
103
- /** 复制访问口令:60 秒后自动清空剪贴板(口令是唯一凭据,防其他应用读取;尽力而为)。 */
103
+
104
104
  function copyToken(token) {
105
105
  copyText(token);
106
106
  setTimeout(function () {
@@ -111,23 +111,23 @@ window.__ModuleLoader__.load({
111
111
  });
112
112
  }
113
113
  } catch (_) {
114
- /* 非安全上下文等场景尽力而为 */
114
+
115
115
  }
116
116
  }, 60000);
117
117
  }
118
118
 
119
- /**
120
- * 构造二维码载荷:`DSHREMOTE|<电脑地址(含挂载路径)>|<访问口令>`。
121
- *
122
- * 纯函数(不触碰 DOM/React),导出供回归测试直接调用。
123
- *
124
- * 为什么需要 withMount 判断(PR #32 / 蔡严庆,2026-10-04):
125
- * qr-config 响应的 urls **已自带挂载路径**——服务端 lib/index.js 的两条分支都拼了
126
- * `${basePath}`(LAN 桥 `http://ip:3082/m`、回环 `http://ip:3080/m`)。旧实现在此处
127
- * 再拼一次 mount,二维码里就成了 `/m/m`;App 端 `_pathOf()` 把整段路径原样当作请求
128
- * 前缀,于是扫码连接一律 404(两种模式都中招,不只 LAN 桥)。
129
- * 故:仅当目标 url 自身不含路径时才补 mount。
130
- */
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
131
  function buildQrPayload(data) {
132
132
  var urls = Array.isArray(data && data.urls) ? data.urls : [];
133
133
  var mount = String((data && data.basePath) || "/m").replace(/\/+$/, "");
@@ -147,41 +147,41 @@ window.__ModuleLoader__.load({
147
147
  }
148
148
  exports.buildQrPayload = buildQrPayload;
149
149
 
150
- // ── 远程访问(端到端加密中继)──────────────────────────────────────────────
151
- // 数据来自 /m/api/relay/*(与 qr-config 一样仅限电脑本机桌面访问)。下面这几个是不碰 DOM 的纯函数,
152
- // 导出供测试直接调用。
150
+
151
+
152
+
153
153
 
154
154
  var RELAY_API = "/m/api/relay";
155
155
  var LINK_LABELS = { online: "已连接", connecting: "连接中…", offline: "离线,自动重试中", idle: "待命(配对手机后才连接)" };
156
156
 
157
- /**
158
- * 把 16 位十六进制指纹拆成 4 组 4 位,方便用户逐段和手机屏幕比对。
159
- *
160
- * 这里是一份内联实现——`lib/client.js` 被宿主当独立模块打包,不能 import
161
- * 仓库里的其它文件。权威定义在 `lib/relay/fingerprint.js`,手机端对应
162
- * `dsh-mobile-app/lib/relay/fingerprint.dart`;三处的分组方式必须逐字一致,
163
- * 否则用户会看到两个不同的字符串而不敢连接。
164
- * `test/pairing-fingerprint.test.mjs` 会对着共用模块校验这里的输出。
165
- */
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
166
  function formatPairingFingerprint(hex) {
167
167
  var clean = String(hex || "").toLowerCase().replace(/[^0-9a-f]/g, "");
168
168
  if (clean.length !== 16) return String(hex || "");
169
169
  return [clean.slice(0, 4), clean.slice(4, 8), clean.slice(8, 12), clean.slice(12, 16)].join(" ");
170
170
  }
171
171
 
172
- /** 中继连接状态的中文说明。 */
172
+
173
173
  function relayLinkLabel(link) {
174
174
  var base = LINK_LABELS[link && link.state] || "未知";
175
175
  return link && link.state === "offline" && link.lastError ? base + "(" + link.lastError + ")" : base;
176
176
  }
177
- /** 配对码剩余时间 → "4:59";已过期返回 null。 */
177
+
178
178
  function formatCountdown(ms) {
179
179
  if (!(ms > 0)) return null;
180
180
  var total = Math.ceil(ms / 1000);
181
181
  var sec = total % 60;
182
182
  return Math.floor(total / 60) + ":" + (sec < 10 ? "0" : "") + sec;
183
183
  }
184
- /** 「N 分钟前」。 */
184
+
185
185
  function relativeTime(ts, now) {
186
186
  if (!ts) return "从未连接";
187
187
  var s = Math.max(0, Math.round((now - ts) / 1000));
@@ -190,7 +190,7 @@ window.__ModuleLoader__.load({
190
190
  if (s < 86400) return Math.floor(s / 3600) + " 小时前";
191
191
  return Math.floor(s / 86400) + " 天前";
192
192
  }
193
- /** 未启用时给用户的配置片段。 */
193
+
194
194
  var RELAY_SNIPPET = [
195
195
  "- insert:",
196
196
  " - id: mobile-remote",
@@ -201,12 +201,12 @@ window.__ModuleLoader__.load({
201
201
  " urls:",
202
202
  " - wss://<你部署的中继域名>",
203
203
  ].join("\n");
204
- /**
205
- * 中继 3.2.6 起默认允许使用(随包补丁与 schema 默认值都指向 wss://dsh.claud.ing),面板正常出现;
206
- * 电脑只在配对过手机之后才真的去连(没配对时连接状态显示「待命」)。
207
- * 如果用户显式关闭中继(relay.enabled: false),默认不展示(advertiseWhenOff=false);
208
- * 要恢复「未启用 → 怎么启用」的引导,把它改成 true。做成对象是为了测试可以切换;生产代码只读。
209
- */
204
+
205
+
206
+
207
+
208
+
209
+
210
210
  var relayUi = { advertiseWhenOff: false };
211
211
  exports.relayLinkLabel = relayLinkLabel;
212
212
  exports.formatCountdown = formatCountdown;
@@ -215,7 +215,7 @@ window.__ModuleLoader__.load({
215
215
  exports.RELAY_SNIPPET = RELAY_SNIPPET;
216
216
  exports.relayUi = relayUi;
217
217
 
218
- /** 调用中继管理端点;失败时抛出带 .code 的 Error(detail 优先作为文案)。 */
218
+
219
219
  function relayCall(path, method, body) {
220
220
  return fetch(RELAY_API + path, {
221
221
  method: method,
@@ -241,10 +241,10 @@ window.__ModuleLoader__.load({
241
241
 
242
242
  var mutedStyle = { fontSize: "12px", color: "var(--dsw-alias-label-tertiary, #aaa)", lineHeight: "1.6" };
243
243
 
244
- /**
245
- * 「远程访问」面板:手机不在同一 Wi-Fi 时的连接方式。
246
- * 未启用 → 说明怎么启用;已启用 → 中继连接状态、生成一次性配对二维码、已配对手机列表(可撤销)。
247
- */
244
+
245
+
246
+
247
+
248
248
  function RelayPanel(props) {
249
249
  var onCredentialsChanged = props && typeof props.onCredentialsChanged === "function" ? props.onCredentialsChanged : function () {};
250
250
  var stateHook = useState({ status: "loading" });
@@ -260,7 +260,7 @@ window.__ModuleLoader__.load({
260
260
  var busy = busyHook[0];
261
261
  var setBusy = busyHook[1];
262
262
 
263
- /** 读状态并刷新界面;成功返回状态对象,失败返回 null。 */
263
+
264
264
  function load() {
265
265
  return relayCall("/status", "GET").then(
266
266
  function (data) {
@@ -277,7 +277,7 @@ window.__ModuleLoader__.load({
277
277
  var h = null;
278
278
  function tick() {
279
279
  return load().then(function (data) {
280
- // 电脑上没启用中继:要改配置并重启 DSH 才会变,没必要再每 4 秒问一次
280
+
281
281
  if (data && data.enabled === false && h !== null) {
282
282
  clearInterval(h);
283
283
  h = null;
@@ -290,7 +290,7 @@ window.__ModuleLoader__.load({
290
290
  if (h !== null) clearInterval(h);
291
291
  };
292
292
  }, []);
293
- // 配对二维码显示期间每秒刷新倒计时;到期自动收起。
293
+
294
294
  useEffect(
295
295
  function () {
296
296
  if (!pairing) return undefined;
@@ -303,7 +303,7 @@ window.__ModuleLoader__.load({
303
303
  },
304
304
  [pairing]
305
305
  );
306
- // 手机扫码成功 = 名单里多了一台设备 → 收起二维码(一次性码此时已作废)。
306
+
307
307
  useEffect(
308
308
  function () {
309
309
  if (!pairing || st.status !== "ready") return;
@@ -336,7 +336,7 @@ window.__ModuleLoader__.load({
336
336
  );
337
337
  }
338
338
  function revoke(device) {
339
- // T-62:撤销会同时更换中继密钥和(自动生成的)访问口令,确认前把后果说清楚。
339
+
340
340
  var devices = (st.data && Array.isArray(st.data.devices)) ? st.data.devices : [];
341
341
  var others = Math.max(0, devices.length - 1);
342
342
  var ok = window.confirm(
@@ -354,7 +354,7 @@ window.__ModuleLoader__.load({
354
354
  if (res && res.relayKeyRotated === false) parts.push("中继密钥更换失败,请查看日志");
355
355
  toast(parts.join(";"));
356
356
  load();
357
- onCredentialsChanged(); // 口令与二维码已变:重新读取,免得继续显示扫了会 401 的旧码
357
+ onCredentialsChanged();
358
358
  },
359
359
  function (err) {
360
360
  toast("撤销失败:" + String((err && err.message) || err));
@@ -363,18 +363,18 @@ window.__ModuleLoader__.load({
363
363
  }
364
364
 
365
365
  function deviceRow(d) {
366
- // 注意:这里刻意不显示「设备指纹」。
367
- // 手机配对时核对的是**电脑**的公钥(配对链接里的 pk),
368
- // 而 d.id 是**手机**公钥的指纹——两者不是同一个东西,
369
- // 摆在一起会让人以为能互相对照,比不显示更糟。
370
- // 电脑侧要展示的是自己的公钥指纹,见下面「本机指纹」那一行。
366
+
367
+
368
+
369
+
370
+
371
371
  return jsxRuntime.jsx(
372
372
  "div",
373
373
  {
374
374
  style: rowStyle,
375
375
  children: [
376
376
  jsxRuntime.jsx("span", { children: d.name }),
377
- // T-71: phones paired with the default QR only use the LAN (the relay is never on for them)
377
+
378
378
  d.via === "lan" ? jsxRuntime.jsx("span", { style: mutedStyle, children: "仅局域网" }, "via") : null,
379
379
  jsxRuntime.jsx("span", { style: mutedStyle, children: "最近 " + relativeTime(d.lastSeen, now) }),
380
380
  jsxRuntime.jsx("button", { style: btnStyle, onClick: function () { revoke(d); }, children: "撤销" }),
@@ -389,15 +389,15 @@ window.__ModuleLoader__.load({
389
389
  return jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [title].concat(children) });
390
390
  };
391
391
 
392
- // 还不知道中继有没有启用之前(加载中 / 读不到状态)也不露出面板,免得没启用的人先闪一下「远程访问」
392
+
393
393
  if (st.status === "loading") return relayUi.advertiseWhenOff ? wrap([jsxRuntime.jsx("div", { style: mutedStyle, children: "加载中…" }, "l")]) : null;
394
394
  if (st.status === "error") {
395
395
  if (!relayUi.advertiseWhenOff) return null;
396
396
  return wrap([jsxRuntime.jsx("div", { style: mutedStyle, children: "无法读取远程访问状态:" + st.message + "(只能在这台电脑的 DSH 桌面端管理)" }, "e")]);
397
397
  }
398
398
  var data = st.data;
399
- // T-71: the relay is off but phones are paired for the encrypted LAN path. They still
400
- // need a list and a way to revoke them; nothing about remote access is shown.
399
+
400
+
401
401
  if (!data.enabled && data.lanNoise && (data.devices || []).length > 0 && !relayUi.advertiseWhenOff) {
402
402
  var lanRows = [jsxRuntime.jsx("div", { style: { fontSize: "13px", fontWeight: 600, margin: "18px 0 2px" }, children: "已配对的手机(" + data.devices.length + ")" }, "dh")];
403
403
  data.devices.forEach(function (d) {
@@ -456,8 +456,8 @@ window.__ModuleLoader__.load({
456
456
  ? [
457
457
  jsxRuntime.jsx("img", { src: pairing.qr, alt: "配对二维码", style: { width: 216, height: 216, borderRadius: "12px", background: "#fff", padding: 8 } }, "img"),
458
458
  jsxRuntime.jsx("div", { style: mutedStyle, children: "手机 App → 连接页「粘贴配对链接」粘贴,或直接扫这个码。一次性," + countdown + " 后失效。" }, "t"),
459
- // 本机公钥指纹:手机配对时会显示同一串数字,用户在这里逐段核对。
460
- // 没有这一行,手机上那个「去电脑上核对」的提示就无处可核。
459
+
460
+
461
461
  jsxRuntime.jsx("div", { style: { ...mutedStyle, textAlign: "center" }, children: [
462
462
  jsxRuntime.jsx("div", { children: "本机指纹(手机上会显示同一串)" }, "l"),
463
463
  jsxRuntime.jsx("div", { style: { fontFamily: "monospace", fontSize: "14px", letterSpacing: "1px", color: "#111", userSelect: "all" }, children: formatPairingFingerprint(pairing.fingerprint) }, "f"),
@@ -485,15 +485,15 @@ window.__ModuleLoader__.load({
485
485
  }
486
486
  exports.RelayPanel = RelayPanel;
487
487
 
488
- /**
489
- * 默认二维码(T-71,D-01 / C-15):局域网加密配对。
490
- *
491
- * 以前这一页的第一个二维码是 `DSHREMOTE|地址|口令`:手机之后的每个请求都在局域网上明文带着访问口令,
492
- * 同一个 Wi-Fi 里谁都能截获。现在第一个二维码是 `dsh://pair?…&lan=…`(不带中继地址):手机在 LAN 桥上
493
- * 走 Noise 加密握手配对,口令从头到尾不出现在网络上;不需要中继、不需要账号、不收费(D5)。
494
- * 配对码一次性、5 分钟有效:页面开着时到期自动换新,配对成功也换新(下一台手机用新码)。
495
- * LAN 桥没开(web 版)或插件太旧时拿不到 → onAvailability(false),页面退回旧二维码并说明它不加密。
496
- */
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
497
  function LanPairing(props) {
498
498
  var onAvailability = props && typeof props.onAvailability === "function" ? props.onAvailability : function () {};
499
499
  var stHook = useState({ status: "loading" });
@@ -509,7 +509,7 @@ window.__ModuleLoader__.load({
509
509
  useEffect(
510
510
  function () {
511
511
  var alive = true;
512
- // 先记下已经在名单里的手机:之后多出来的那台 = 刚用这个码配对的
512
+
513
513
  relayCall("/status", "GET")
514
514
  .then(
515
515
  function (s) {
@@ -602,21 +602,21 @@ window.__ModuleLoader__.load({
602
602
  }
603
603
  exports.LanPairing = LanPairing;
604
604
 
605
- /**
606
- * 设置页 section:连接移动端设备。
607
- * 第一个二维码是局域网加密配对(LanPairing)。旧版 App(1.1 及更早)读不了它:它们用的
608
- * `DSHREMOTE|地址|口令` 二维码收在「旧版 App」后面,并写明不加密。插件拿不到加密配对时(LAN 桥没开),
609
- * 旧二维码直接显示,同样写明不加密。
610
- */
605
+
606
+
607
+
608
+
609
+
610
+
611
611
  function MobileDeviceSection() {
612
612
  var state = useState({ status: "loading", urls: [], token: "" });
613
613
  var data = state[0];
614
614
  var setData = state[1];
615
- // T-62:撤销设备会更换口令;递增它就重新读取 qr-config(新口令、新二维码)。
615
+
616
616
  var reloadHook = useState(0);
617
617
  var reloadKey = reloadHook[0];
618
618
  var setReloadKey = reloadHook[1];
619
- // null = 还不知道;true = 有局域网加密配对;false = 没有(只能用旧二维码)
619
+
620
620
  var lanHook = useState(null);
621
621
  var lan = lanHook[0];
622
622
  var setLan = lanHook[1];
@@ -634,7 +634,7 @@ window.__ModuleLoader__.load({
634
634
  .then(function (body) {
635
635
  if (!alive) return;
636
636
  var urls = Array.isArray(body.urls) ? body.urls : [];
637
- // v3.0.0 review:path 从 qr-config 读取(不再硬编码 /m——插件挂载路径可配置)
637
+
638
638
  setData({ status: "ready", urls: urls, token: String(body.token ?? ""), basePath: String(body.path || "/m") });
639
639
  })
640
640
  .catch(function (err) {
@@ -651,7 +651,7 @@ window.__ModuleLoader__.load({
651
651
  };
652
652
  }, [reloadKey]);
653
653
 
654
- /** 旧二维码(不加密)+ 连接信息。 */
654
+
655
655
  function legacyBlock() {
656
656
  if (data.status === "loading") {
657
657
  return [jsxRuntime.jsx("div", { style: { padding: "20px 0", color: "var(--dsw-alias-label-secondary, #888)" }, children: "加载中…" }, "lg-l")];
@@ -668,8 +668,8 @@ window.__ModuleLoader__.load({
668
668
  ),
669
669
  ];
670
670
  }
671
- // v3.0.0 review:二维码 URL 携带挂载路径(App 端解析后使用,不再写死 /m)
672
- // PR #32:路径拼接的坑与取舍见上方 buildQrPayload 注释
671
+
672
+
673
673
  var mount = String(data.basePath || "/m").replace(/\/+$/, "");
674
674
  var qrPayload = buildQrPayload(data);
675
675
  var qrSrc = mount + "/qr.png?text=" + encodeURIComponent(qrPayload);
@@ -808,7 +808,7 @@ window.__ModuleLoader__.load({
808
808
  });
809
809
  }
810
810
 
811
- /** 注册设置页 section(id: mobile-device)。 */
811
+
812
812
  function apply(ctx) {
813
813
  ctx.slots.inject("settings.section", function () {
814
814
  return ctx.slots.register(