@linxin666/dsh-remote-bridge 0.4.7 → 0.4.9
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.i18n.yaml +2 -2
- package/README.md +93 -26
- package/README.zh.md +91 -26
- package/icon.svg +3 -0
- package/lib/client.js +274 -253
- package/lib/client.js.map +1 -1
- package/lib/index.js +8891 -2433
- package/lib/types/client/PairEntry.d.ts +2 -2
- package/lib/types/client/PairPanel.d.ts +10 -2
- package/lib/types/client/icons.d.ts +5 -13
- package/lib/types/client/locales.d.ts +10 -14
- package/lib/types/client/semantic.d.ts +9 -5
- package/lib/types/core/approvals.d.ts +24 -0
- package/lib/types/core/commands.d.ts +59 -0
- package/lib/types/core/connection.d.ts +124 -5
- package/lib/types/core/delta.d.ts +101 -0
- package/lib/types/core/devices.d.ts +98 -2
- package/lib/types/core/dsh-frames.d.ts +155 -4
- package/lib/types/core/envelope.d.ts +34 -0
- package/lib/types/core/extension.d.ts +144 -0
- package/lib/types/core/hub.d.ts +96 -20
- package/lib/types/core/jobs.d.ts +204 -0
- package/lib/types/core/liveactivity.d.ts +324 -0
- package/lib/types/core/protocol.d.ts +491 -2
- package/lib/types/core/push.d.ts +178 -0
- package/lib/types/core/questions.d.ts +109 -9
- package/lib/types/core/session-meta.d.ts +55 -1
- package/lib/types/core/squads.d.ts +130 -0
- package/lib/types/core/usage-stats.d.ts +160 -0
- package/lib/types/core/usage.d.ts +294 -0
- package/lib/types/core/wire.d.ts +1 -1
- package/lib/types/core/ws-frames.d.ts +11 -0
- package/lib/types/host/apns.d.ts +151 -0
- package/lib/types/host/squads-ledger.d.ts +39 -0
- package/lib/types/host/squads.d.ts +77 -0
- package/lib/types/host/usage-stats.d.ts +75 -0
- package/lib/types/host/watchers.d.ts +88 -0
- package/lib/types/host/websocket.d.ts +8 -1
- package/lib/types/index.d.ts +34 -3
- package/lib/types/mount-once.d.ts +55 -0
- package/locale/en.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +20 -14
- package/src/client/PairEntry.tsx +58 -31
- package/src/client/PairPanel.tsx +181 -97
- package/src/client/icons.tsx +17 -60
- package/src/client/locales.ts +15 -23
- package/src/client/panel.module.css +239 -186
- package/src/client/semantic.ts +10 -6
- package/src/core/approvals.ts +32 -1
- package/src/core/commands.ts +95 -0
- package/src/core/connection.ts +1483 -31
- package/src/core/delta.ts +204 -0
- package/src/core/devices.ts +221 -3
- package/src/core/dsh-frames.ts +365 -8
- package/src/core/envelope.ts +46 -0
- package/src/core/extension.ts +197 -0
- package/src/core/hub.ts +441 -49
- package/src/core/jobs.ts +372 -0
- package/src/core/liveactivity.ts +833 -0
- package/src/core/protocol.ts +556 -2
- package/src/core/push.ts +354 -0
- package/src/core/questions.ts +264 -17
- package/src/core/session-meta.ts +73 -1
- package/src/core/squads.ts +345 -0
- package/src/core/usage-stats.ts +424 -0
- package/src/core/usage.ts +937 -0
- package/src/core/wire.ts +13 -1
- package/src/core/ws-frames.ts +14 -0
- package/src/host/apns.ts +320 -0
- package/src/host/squads-ledger.ts +105 -0
- package/src/host/squads.ts +206 -0
- package/src/host/usage-stats.ts +155 -0
- package/src/host/watchers.ts +272 -0
- package/src/host/websocket.ts +37 -3
- package/src/index.ts +310 -9
- package/src/mount-once.ts +142 -0
package/lib/client.js
CHANGED
|
@@ -29,7 +29,6 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
30
30
|
let react = require("react");
|
|
31
31
|
react = __toESM(react, 1);
|
|
32
|
-
let react_dom = require("react-dom");
|
|
33
32
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
33
|
//#region ../../node_modules/.pnpm/qrcode.react@4.2.0_react@18.3.1/node_modules/qrcode.react/lib/esm/index.js
|
|
35
34
|
var __defProp = Object.defineProperty;
|
|
@@ -1212,64 +1211,6 @@ window.__ModuleLoader__.load({
|
|
|
1212
1211
|
});
|
|
1213
1212
|
QRCodeSVG.displayName = "QRCodeSVG";
|
|
1214
1213
|
//#endregion
|
|
1215
|
-
//#region src/client/icons.tsx
|
|
1216
|
-
/** Shared svg attrs for the 16px stroke icon family. */
|
|
1217
|
-
function iconProps(props) {
|
|
1218
|
-
return {
|
|
1219
|
-
width: 16,
|
|
1220
|
-
height: 16,
|
|
1221
|
-
viewBox: "0 0 16 16",
|
|
1222
|
-
fill: "none",
|
|
1223
|
-
stroke: "currentColor",
|
|
1224
|
-
strokeWidth: 1.3,
|
|
1225
|
-
strokeLinecap: "round",
|
|
1226
|
-
strokeLinejoin: "round",
|
|
1227
|
-
"aria-hidden": true,
|
|
1228
|
-
...props
|
|
1229
|
-
};
|
|
1230
|
-
}
|
|
1231
|
-
/** A QR-symbol glyph: three finder squares plus a payload dot. */
|
|
1232
|
-
function QrIcon(props) {
|
|
1233
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1234
|
-
...iconProps(props),
|
|
1235
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.5 9.5h1.6v1.6H9.5zM12.4 9.5h1.1M9.5 12.4v1.1M12 13.5h1.5v-1.5h-1.5z" })]
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
/** Copy glyph. */
|
|
1239
|
-
function CopyIcon(props) {
|
|
1240
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1241
|
-
...iconProps(props),
|
|
1242
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
1243
|
-
x: "5.5",
|
|
1244
|
-
y: "5.5",
|
|
1245
|
-
width: "9",
|
|
1246
|
-
height: "9",
|
|
1247
|
-
rx: "1.5"
|
|
1248
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5" })]
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
/** Check glyph for the transient copied state. */
|
|
1252
|
-
function CheckIcon(props) {
|
|
1253
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1254
|
-
...iconProps(props),
|
|
1255
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 8.5 6.5 12l6.5-8" })
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
/** Close glyph for the panel header. */
|
|
1259
|
-
function CloseIcon(props) {
|
|
1260
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1261
|
-
...iconProps(props),
|
|
1262
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" })
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
/** Refresh glyph for the mint-again action. */
|
|
1266
|
-
function RefreshIcon(props) {
|
|
1267
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1268
|
-
...iconProps(props),
|
|
1269
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M13 8a5 5 0 1 1-1.8-3.85" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M13.2 2.4V5.6H10" })]
|
|
1270
|
-
});
|
|
1271
|
-
}
|
|
1272
|
-
//#endregion
|
|
1273
1214
|
//#region src/client/semantic.ts
|
|
1274
1215
|
/**
|
|
1275
1216
|
* Semantic attribute values for the protocol v1 pairing panel (contract:
|
|
@@ -1283,11 +1224,9 @@ window.__ModuleLoader__.load({
|
|
|
1283
1224
|
const PART_ENTRY = "entry";
|
|
1284
1225
|
/** The modal panel root. */
|
|
1285
1226
|
const PART_PANEL = "panel";
|
|
1286
|
-
/** A state notice: the origin warning, or a refusal the host raised. */
|
|
1287
|
-
const PART_NOTICE = "notice";
|
|
1288
1227
|
//#endregion
|
|
1289
1228
|
//#region \0dsh-css:packages/dsh-remote-bridge/src/client/panel.module.css.mjs
|
|
1290
|
-
const css = ".sd7VOG_trigger{width:
|
|
1229
|
+
const css = ".sd7VOG_panel,.sd7VOG_trigger,.sd7VOG_dialog{--pair-space-1:4px;--pair-space-2:8px;--pair-space-3:12px;--pair-space-4:24px;--pair-title-size:15px;--pair-title-line:24px;--pair-text-size:13px;--pair-text-line:20px;--pair-state-size:12px;--pair-state-line:18px;--pair-qr:184px;--pair-bar:4px;--pair-seat:36px;--pair-close:28px;--pair-hit:44px;--pair-width:460px;--pair-faded:.35;--pair-focus-offset:2px;--pair-status:calc(var(--pair-state-line) + var(--pair-space-1) + var(--pair-bar));--pair-address:calc(var(--pair-text-line) * 2)}.sd7VOG_trigger{width:var(--pair-seat);height:var(--pair-seat);color:var(--dsw-alias-label-secondary);cursor:pointer;transition:background-color var(--ds-transition-duration) ease, color var(--ds-transition-duration) ease;background:0 0;border:none;border-radius:50%;flex:none;order:-1;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.sd7VOG_trigger:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-seat)) / -2);border-radius:50%;position:absolute}.sd7VOG_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.sd7VOG_trigger:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}.sd7VOG_trigger:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:var(--pair-focus-offset)}[class*=footerActions]:has([data-dsh-plugin=remote-bridge][data-wide=rail]){align-items:center;gap:var(--pair-space-1,4px);flex-direction:column}.sd7VOG_dialog.sd7VOG_dialog{width:min(var(--pair-width), 100%);max-height:100%;padding:var(--pair-space-4);overflow:auto}.sd7VOG_panel{gap:var(--pair-space-3);box-sizing:border-box;width:100%;max-width:100%;color:var(--dsw-alias-label-primary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);transition:opacity var(--ds-transition-duration) var(--ds-ease-in-out);flex-direction:column;display:flex}.sd7VOG_panel[data-closing]{opacity:0;animation:var(--pair-exit-name,none) var(--ds-transition-duration) var(--ds-ease-in-out) reverse both}@media (prefers-reduced-motion:reduce){.sd7VOG_panel[data-closing]{animation:none}}.sd7VOG_header{align-items:flex-start;gap:var(--pair-space-3);display:flex}.sd7VOG_heading{flex:1;min-width:0}.sd7VOG_title{font-size:var(--pair-title-size);font-weight:600;line-height:var(--pair-title-line);margin:0}.sd7VOG_subtitle{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_close{width:var(--pair-close);color:var(--dsw-alias-label-secondary);flex:none;padding:0;position:relative}.sd7VOG_close:after{content:\"\";inset:calc((var(--pair-hit) - var(--pair-close)) / -2);border-radius:50%;position:absolute}.sd7VOG_body{gap:var(--pair-space-2);flex-direction:column;display:flex}.sd7VOG_qrCard{align-items:center;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);flex-direction:column;display:flex}.sd7VOG_qrSlot{width:var(--pair-qr);height:var(--pair-qr);justify-content:center;align-items:center;display:flex}.sd7VOG_qrSlot[data-expired]{opacity:var(--pair-faded)}.sd7VOG_skeleton{width:var(--pair-qr);height:var(--pair-qr);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);display:block}.sd7VOG_status{justify-content:center;align-items:center;gap:var(--pair-space-1);box-sizing:border-box;width:100%;height:var(--pair-status);flex-direction:column;display:flex}.sd7VOG_statusText{color:var(--dsw-alias-label-secondary);font-size:var(--pair-state-size);line-height:var(--pair-state-line);font-variant-numeric:tabular-nums;margin:0}.sd7VOG_bar{width:100%;height:var(--pair-bar);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-interactive-bg-hover);display:block;overflow:hidden}.sd7VOG_barFill{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-brand-primary);height:100%;transition:width var(--ds-transition-duration) linear;display:block}.sd7VOG_address{min-height:var(--pair-address);color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);align-items:center;margin:0;display:flex}.sd7VOG_address[data-tone=warning]{color:var(--dsw-alias-state-warn-primary)}.sd7VOG_hint{color:var(--dsw-alias-label-tertiary);font-size:var(--pair-text-size);line-height:var(--pair-text-line);margin:0}.sd7VOG_notice{align-items:flex-start;gap:var(--pair-space-2);padding:var(--pair-space-3);border:1px solid var(--dsw-alias-state-error-primary);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);display:flex}.sd7VOG_noticeIcon{color:var(--dsw-alias-state-error-primary);flex:none;display:inline-flex}.sd7VOG_noticeCopy{min-width:0}.sd7VOG_noticeTitle{font-size:var(--pair-text-size);font-weight:600;line-height:var(--pair-text-line);margin:0}.sd7VOG_noticeText{margin:var(--pair-space-1) 0 0;color:var(--dsw-alias-label-secondary);font-size:var(--pair-text-size);line-height:var(--pair-text-line)}.sd7VOG_actions{justify-content:flex-end;align-items:center;gap:var(--pair-space-2);display:flex}.sd7VOG_labels{display:grid}.sd7VOG_label{grid-area:1/1}.sd7VOG_label[data-visible=false]{visibility:hidden}.sd7VOG_announce{clip:rect(0, 0, 0, 0);clip-path:inset(0);width:0;height:0;margin:0;position:absolute;overflow:hidden}";
|
|
1291
1230
|
const tagId = "@linxin666/dsh-remote-bridge/packages/dsh-remote-bridge/src/client/panel.module.css";
|
|
1292
1231
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
1293
1232
|
const tag = document.createElement("style");
|
|
@@ -1298,44 +1237,49 @@ window.__ModuleLoader__.load({
|
|
|
1298
1237
|
}
|
|
1299
1238
|
var panel_module_css_default = {
|
|
1300
1239
|
"actions": "sd7VOG_actions",
|
|
1240
|
+
"address": "sd7VOG_address",
|
|
1241
|
+
"announce": "sd7VOG_announce",
|
|
1301
1242
|
"bar": "sd7VOG_bar",
|
|
1302
1243
|
"barFill": "sd7VOG_barFill",
|
|
1303
|
-
"
|
|
1304
|
-
"
|
|
1305
|
-
"
|
|
1306
|
-
"countdownText": "sd7VOG_countdownText",
|
|
1244
|
+
"body": "sd7VOG_body",
|
|
1245
|
+
"close": "sd7VOG_close",
|
|
1246
|
+
"dialog": "sd7VOG_dialog",
|
|
1307
1247
|
"header": "sd7VOG_header",
|
|
1308
1248
|
"heading": "sd7VOG_heading",
|
|
1309
1249
|
"hint": "sd7VOG_hint",
|
|
1310
|
-
"
|
|
1250
|
+
"label": "sd7VOG_label",
|
|
1251
|
+
"labels": "sd7VOG_labels",
|
|
1311
1252
|
"notice": "sd7VOG_notice",
|
|
1312
|
-
"
|
|
1253
|
+
"noticeCopy": "sd7VOG_noticeCopy",
|
|
1254
|
+
"noticeIcon": "sd7VOG_noticeIcon",
|
|
1255
|
+
"noticeText": "sd7VOG_noticeText",
|
|
1313
1256
|
"noticeTitle": "sd7VOG_noticeTitle",
|
|
1314
|
-
"overlay": "sd7VOG_overlay",
|
|
1315
1257
|
"panel": "sd7VOG_panel",
|
|
1316
|
-
"qr": "sd7VOG_qr",
|
|
1317
1258
|
"qrCard": "sd7VOG_qrCard",
|
|
1318
|
-
"
|
|
1319
|
-
"
|
|
1259
|
+
"qrSlot": "sd7VOG_qrSlot",
|
|
1260
|
+
"skeleton": "sd7VOG_skeleton",
|
|
1261
|
+
"status": "sd7VOG_status",
|
|
1262
|
+
"statusText": "sd7VOG_statusText",
|
|
1320
1263
|
"subtitle": "sd7VOG_subtitle",
|
|
1321
1264
|
"title": "sd7VOG_title",
|
|
1322
|
-
"token": "sd7VOG_token",
|
|
1323
|
-
"tokenLabel": "sd7VOG_tokenLabel",
|
|
1324
|
-
"tokenRow": "sd7VOG_tokenRow",
|
|
1325
1265
|
"trigger": "sd7VOG_trigger"
|
|
1326
1266
|
};
|
|
1327
1267
|
//#endregion
|
|
1328
1268
|
//#region src/client/PairPanel.tsx
|
|
1329
1269
|
/**
|
|
1330
|
-
* The protocol v1 pairing panel
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1333
|
-
* relay (never this machine's loopback address), and the code is one-shot.
|
|
1270
|
+
* The protocol v1 pairing panel: the QR symbol, the countdown with its expiry
|
|
1271
|
+
* state, the one address fact the reader must not miss, and the two actions that
|
|
1272
|
+
* keep a fresh code on screen.
|
|
1334
1273
|
*
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1274
|
+
* The shell is the official headless `Modal` and every action is the official
|
|
1275
|
+
* `Button`, so the overlay, the mask, the card, the focus trap, the Escape
|
|
1276
|
+
* command and the interaction states belong to the library. This file owns the
|
|
1277
|
+
* information order and the state presentation only: every state and action
|
|
1278
|
+
* arrives through props, and the clock is a prop, so the expiry flip is
|
|
1279
|
+
* deterministic instead of read from `Date.now()` here.
|
|
1338
1280
|
*/
|
|
1281
|
+
/** The custom property carrying the dialog's own enter keyframe name. */
|
|
1282
|
+
const EXIT_NAME_VAR = "--pair-exit-name";
|
|
1339
1283
|
/**
|
|
1340
1284
|
* The QR symbol, memoized on the secret: the countdown re-renders the panel
|
|
1341
1285
|
* every second, and qrcode.react rebuilds the whole module path on each render.
|
|
@@ -1353,50 +1297,59 @@ window.__ModuleLoader__.load({
|
|
|
1353
1297
|
"aria-label": label
|
|
1354
1298
|
});
|
|
1355
1299
|
});
|
|
1356
|
-
/**
|
|
1357
|
-
function
|
|
1358
|
-
return
|
|
1359
|
-
className: panel_module_css_default.notice,
|
|
1360
|
-
"data-dsh-part": PART_NOTICE,
|
|
1361
|
-
"data-tone": tone,
|
|
1362
|
-
role: tone === "plain" ? "status" : "alert",
|
|
1363
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1364
|
-
className: panel_module_css_default.noticeTitle,
|
|
1365
|
-
children: title
|
|
1366
|
-
}), body !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1367
|
-
className: panel_module_css_default.noticeBody,
|
|
1368
|
-
children: body
|
|
1369
|
-
})]
|
|
1370
|
-
});
|
|
1300
|
+
/** The one string the panel hands out: what the symbol encodes, what copy copies. */
|
|
1301
|
+
function payloadOf(state) {
|
|
1302
|
+
return state.kind === "ready" ? state.pairingUrl ?? state.token : "";
|
|
1371
1303
|
}
|
|
1372
1304
|
/**
|
|
1373
1305
|
* Render the pairing panel.
|
|
1374
1306
|
* @param props - locale seat, view state, clock, page host and actions.
|
|
1375
1307
|
* @returns the panel element tree.
|
|
1376
1308
|
*/
|
|
1377
|
-
function PairPanel({ t, state, now, host, copy, onClose, onRefresh, onCopy }) {
|
|
1378
|
-
const
|
|
1379
|
-
const
|
|
1309
|
+
function PairPanel({ t, state, now, host, copy, showing, closing, id, onClose, onExited, onRefresh, onCopy }) {
|
|
1310
|
+
const panel = (0, react.useRef)(null);
|
|
1311
|
+
const ready = state.kind === "ready";
|
|
1312
|
+
const remainingMs = ready ? Math.max(0, state.expiresAt - now) : 0;
|
|
1313
|
+
const expired = ready && remainingMs <= 0;
|
|
1380
1314
|
const seconds = Math.ceil(remainingMs / 1e3);
|
|
1381
|
-
const windowMs =
|
|
1315
|
+
const windowMs = ready ? Math.max(1, state.expiresAt - state.issuedAt) : 1;
|
|
1382
1316
|
const percent = Math.min(100, Math.max(0, Math.round(remainingMs / windowMs * 100)));
|
|
1383
|
-
const payload = state
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1317
|
+
const payload = payloadOf(state);
|
|
1318
|
+
const canCopy = !expired && payload !== "";
|
|
1319
|
+
const primaryLabel = state.kind === "failed" || state.kind === "unreachable" ? t("action.retry") : t("pair.refresh");
|
|
1320
|
+
const located = ready && state.pairingUrl !== null;
|
|
1321
|
+
(0, react.useLayoutEffect)(() => {
|
|
1322
|
+
const element = panel.current;
|
|
1323
|
+
if (element === null) return;
|
|
1324
|
+
if (!closing) {
|
|
1325
|
+
element.style.removeProperty(EXIT_NAME_VAR);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
const dialog = element.parentElement;
|
|
1329
|
+
const enter = dialog === null ? "" : window.getComputedStyle(dialog).animationName;
|
|
1330
|
+
if (enter !== "" && enter !== "none") element.style.setProperty(EXIT_NAME_VAR, enter);
|
|
1331
|
+
}, [closing]);
|
|
1332
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
1333
|
+
open: showing,
|
|
1334
|
+
onClose,
|
|
1335
|
+
title: t("title"),
|
|
1336
|
+
headless: true,
|
|
1337
|
+
className: panel_module_css_default.dialog,
|
|
1338
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1339
|
+
ref: panel,
|
|
1340
|
+
id,
|
|
1392
1341
|
className: panel_module_css_default.panel,
|
|
1393
|
-
role: "dialog",
|
|
1394
|
-
"aria-modal": "true",
|
|
1395
|
-
"aria-label": t("title"),
|
|
1396
1342
|
"data-dsh-plugin": PLUGIN_ATTR,
|
|
1397
1343
|
"data-dsh-part": PART_PANEL,
|
|
1344
|
+
"data-closing": closing || void 0,
|
|
1345
|
+
onAnimationEnd: (event) => {
|
|
1346
|
+
if (closing && event.target === event.currentTarget) onExited();
|
|
1347
|
+
},
|
|
1348
|
+
onTransitionEnd: (event) => {
|
|
1349
|
+
if (closing && event.target === event.currentTarget && event.propertyName === "opacity") onExited();
|
|
1350
|
+
},
|
|
1398
1351
|
children: [
|
|
1399
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
1352
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
1400
1353
|
className: panel_module_css_default.header,
|
|
1401
1354
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1402
1355
|
className: panel_module_css_default.heading,
|
|
@@ -1407,106 +1360,165 @@ window.__ModuleLoader__.load({
|
|
|
1407
1360
|
className: panel_module_css_default.subtitle,
|
|
1408
1361
|
children: t("subtitle")
|
|
1409
1362
|
})]
|
|
1410
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1411
|
-
|
|
1412
|
-
|
|
1363
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1364
|
+
className: panel_module_css_default.close,
|
|
1365
|
+
variant: "ghost",
|
|
1366
|
+
size: "sm",
|
|
1413
1367
|
"aria-label": t("action.close"),
|
|
1414
|
-
|
|
1415
|
-
|
|
1368
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, {}),
|
|
1369
|
+
onClick: onClose
|
|
1416
1370
|
})]
|
|
1417
1371
|
}),
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
body: t("forbidden.body")
|
|
1426
|
-
}),
|
|
1427
|
-
state.kind === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notice, {
|
|
1428
|
-
tone: "alert",
|
|
1429
|
-
title: t("failed.title"),
|
|
1430
|
-
body: t("failed.body", { status: String(state.status) })
|
|
1431
|
-
}),
|
|
1432
|
-
state.kind === "unreachable" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notice, {
|
|
1433
|
-
tone: "alert",
|
|
1434
|
-
title: t("unreachable.title"),
|
|
1435
|
-
body: t("unreachable.body")
|
|
1436
|
-
}),
|
|
1437
|
-
state.kind === "ready" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1438
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1439
|
-
className: panel_module_css_default.qrCard,
|
|
1440
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1441
|
-
className: panel_module_css_default.qrWrap,
|
|
1442
|
-
"data-dsh-part": "qr",
|
|
1443
|
-
["data-dsh-qr-value"]: payload,
|
|
1444
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairQrCode, {
|
|
1445
|
-
value: payload,
|
|
1446
|
-
label: t("pair.qrLabel")
|
|
1447
|
-
})
|
|
1448
|
-
}), expired ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notice, {
|
|
1449
|
-
tone: "alert",
|
|
1450
|
-
title: t("pair.expired"),
|
|
1451
|
-
body: t("pair.expiredHint")
|
|
1452
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1453
|
-
className: panel_module_css_default.countdown,
|
|
1454
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1455
|
-
className: panel_module_css_default.countdownText,
|
|
1456
|
-
children: t("pair.countdown", { s: String(seconds) })
|
|
1457
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1458
|
-
className: panel_module_css_default.bar,
|
|
1459
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1460
|
-
className: panel_module_css_default.barFill,
|
|
1461
|
-
style: { width: `${String(percent)}%` }
|
|
1462
|
-
})
|
|
1463
|
-
})]
|
|
1464
|
-
})]
|
|
1465
|
-
}),
|
|
1466
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1467
|
-
className: panel_module_css_default.tokenRow,
|
|
1468
|
-
"data-dsh-part": "token",
|
|
1372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1373
|
+
className: panel_module_css_default.body,
|
|
1374
|
+
children: [(state.kind === "forbidden" || state.kind === "failed" || state.kind === "unreachable") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1375
|
+
className: panel_module_css_default.notice,
|
|
1376
|
+
"data-dsh-part": "notice",
|
|
1377
|
+
"data-tone": "alert",
|
|
1378
|
+
role: "alert",
|
|
1469
1379
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1470
|
-
className: panel_module_css_default.
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1380
|
+
className: panel_module_css_default.noticeIcon,
|
|
1381
|
+
"aria-hidden": "true",
|
|
1382
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {})
|
|
1383
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1384
|
+
className: panel_module_css_default.noticeCopy,
|
|
1385
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1386
|
+
className: panel_module_css_default.noticeTitle,
|
|
1387
|
+
children: [
|
|
1388
|
+
state.kind === "forbidden" && t("forbidden.title"),
|
|
1389
|
+
state.kind === "failed" && t("failed.title"),
|
|
1390
|
+
state.kind === "unreachable" && t("unreachable.title")
|
|
1391
|
+
]
|
|
1392
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1393
|
+
className: panel_module_css_default.noticeText,
|
|
1394
|
+
children: [
|
|
1395
|
+
state.kind === "forbidden" && t("forbidden.body"),
|
|
1396
|
+
state.kind === "failed" && t("failed.body", { status: String(state.status) }),
|
|
1397
|
+
state.kind === "unreachable" && t("unreachable.body")
|
|
1398
|
+
]
|
|
1399
|
+
})]
|
|
1475
1400
|
})]
|
|
1476
|
-
}),
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1401
|
+
}), (state.kind === "reading" || ready) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1402
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1403
|
+
className: panel_module_css_default.qrCard,
|
|
1404
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1405
|
+
className: panel_module_css_default.qrSlot,
|
|
1406
|
+
"data-dsh-part": "qr",
|
|
1407
|
+
["data-dsh-qr-value"]: payload,
|
|
1408
|
+
["data-expired"]: expired || void 0,
|
|
1409
|
+
children: ready ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairQrCode, {
|
|
1410
|
+
value: payload,
|
|
1411
|
+
label: t("pair.qrLabel")
|
|
1412
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1413
|
+
className: panel_module_css_default.skeleton,
|
|
1414
|
+
"aria-hidden": "true"
|
|
1415
|
+
})
|
|
1416
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1417
|
+
className: panel_module_css_default.status,
|
|
1418
|
+
children: [
|
|
1419
|
+
!ready && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1420
|
+
className: panel_module_css_default.statusText,
|
|
1421
|
+
children: t("state.reading")
|
|
1422
|
+
}),
|
|
1423
|
+
ready && expired && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1424
|
+
className: panel_module_css_default.statusText,
|
|
1425
|
+
role: "status",
|
|
1426
|
+
children: t("pair.expired")
|
|
1427
|
+
}),
|
|
1428
|
+
ready && !expired && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1429
|
+
className: panel_module_css_default.statusText,
|
|
1430
|
+
children: t("pair.countdown", { s: String(seconds) })
|
|
1431
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1432
|
+
className: panel_module_css_default.bar,
|
|
1433
|
+
"aria-hidden": "true",
|
|
1434
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1435
|
+
className: panel_module_css_default.barFill,
|
|
1436
|
+
style: { width: `${String(percent)}%` }
|
|
1437
|
+
})
|
|
1438
|
+
})] })
|
|
1439
|
+
]
|
|
1440
|
+
})]
|
|
1441
|
+
}),
|
|
1442
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1443
|
+
className: panel_module_css_default.address,
|
|
1444
|
+
"data-tone": located ? "plain" : "warning",
|
|
1445
|
+
children: [ready && located && t("origin.located", { origin: state.origin ?? "" }), ready && !located && t("origin.missing", { host })]
|
|
1446
|
+
}),
|
|
1447
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1448
|
+
className: panel_module_css_default.hint,
|
|
1449
|
+
children: t("pair.usedHint")
|
|
1450
|
+
})
|
|
1451
|
+
] })]
|
|
1452
|
+
}),
|
|
1453
|
+
state.kind !== "forbidden" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
1454
|
+
className: panel_module_css_default.actions,
|
|
1455
|
+
children: [ready && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1456
|
+
variant: "outline",
|
|
1457
|
+
size: "sm",
|
|
1480
1458
|
"data-dsh-part": "copy",
|
|
1481
|
-
|
|
1482
|
-
|
|
1459
|
+
disabled: !canCopy,
|
|
1460
|
+
icon: copy === "copied" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCopyOutlineRegular, {}),
|
|
1483
1461
|
onClick: () => {
|
|
1484
1462
|
onCopy(payload);
|
|
1485
1463
|
},
|
|
1486
|
-
children:
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1464
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1465
|
+
className: panel_module_css_default.labels,
|
|
1466
|
+
children: [
|
|
1467
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1468
|
+
className: panel_module_css_default.label,
|
|
1469
|
+
"data-visible": copy === "idle",
|
|
1470
|
+
"aria-hidden": copy !== "idle",
|
|
1471
|
+
children: t("action.copy")
|
|
1472
|
+
}),
|
|
1473
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1474
|
+
className: panel_module_css_default.label,
|
|
1475
|
+
"data-visible": copy === "copied",
|
|
1476
|
+
"aria-hidden": copy !== "copied",
|
|
1477
|
+
children: t("action.copied")
|
|
1478
|
+
}),
|
|
1479
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1480
|
+
className: panel_module_css_default.label,
|
|
1481
|
+
"data-visible": copy === "failed",
|
|
1482
|
+
"aria-hidden": copy !== "failed",
|
|
1483
|
+
children: t("action.copyFailed")
|
|
1484
|
+
})
|
|
1485
|
+
]
|
|
1486
|
+
})
|
|
1487
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1488
|
+
variant: "primary",
|
|
1489
|
+
size: "sm",
|
|
1503
1490
|
"data-dsh-part": "refresh",
|
|
1491
|
+
disabled: state.kind === "reading",
|
|
1492
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
|
|
1504
1493
|
onClick: onRefresh,
|
|
1505
|
-
children:
|
|
1506
|
-
})
|
|
1494
|
+
children: primaryLabel
|
|
1495
|
+
})]
|
|
1496
|
+
}),
|
|
1497
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1498
|
+
className: panel_module_css_default.announce,
|
|
1499
|
+
role: "status",
|
|
1500
|
+
children: [copy === "copied" && t("action.copied"), copy === "failed" && t("action.copyFailed")]
|
|
1507
1501
|
})
|
|
1508
1502
|
]
|
|
1509
|
-
})
|
|
1503
|
+
})
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
//#endregion
|
|
1507
|
+
//#region src/client/icons.tsx
|
|
1508
|
+
/** A QR-symbol glyph: three finder squares plus a payload dot. */
|
|
1509
|
+
function QrIcon(props) {
|
|
1510
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1511
|
+
width: 16,
|
|
1512
|
+
height: 16,
|
|
1513
|
+
viewBox: "0 0 16 16",
|
|
1514
|
+
fill: "none",
|
|
1515
|
+
stroke: "currentColor",
|
|
1516
|
+
strokeWidth: 1.3,
|
|
1517
|
+
strokeLinecap: "round",
|
|
1518
|
+
strokeLinejoin: "round",
|
|
1519
|
+
"aria-hidden": "true",
|
|
1520
|
+
...props,
|
|
1521
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.5 9.5h1.6v1.6H9.5zM12.4 9.5h1.1M9.5 12.4v1.1M12 13.5h1.5v-1.5h-1.5z" })]
|
|
1510
1522
|
});
|
|
1511
1523
|
}
|
|
1512
1524
|
//#endregion
|
|
@@ -1518,16 +1530,23 @@ window.__ModuleLoader__.load({
|
|
|
1518
1530
|
* (declared by ui-sidebar — the same seat dsh-remote-web-ui and dsh-update
|
|
1519
1531
|
* share).
|
|
1520
1532
|
*
|
|
1521
|
-
* This component owns the panel's behavior: one read per open, one
|
|
1522
|
-
* while a live code is on screen, the mint-again action,
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1533
|
+
* This component owns the panel's presence and behavior: one read per open, one
|
|
1534
|
+
* clock tick while a live code is on screen, the mint-again action, the copy
|
|
1535
|
+
* action, and the leave leg that keeps the modal mounted until its exit reports
|
|
1536
|
+
* completion. The wire call and the clipboard are injected (see the plugin
|
|
1537
|
+
* entry), so the rendered tree carries no closure-factory bundle import and both
|
|
1538
|
+
* can be driven by a test without patching a module.
|
|
1526
1539
|
*/
|
|
1527
1540
|
/** How long the transient "copied" / "copy failed" label stays up. */
|
|
1528
1541
|
const COPY_FEEDBACK_MS = 1500;
|
|
1529
1542
|
/** The countdown's tick; one second is the resolution the panel shows. */
|
|
1530
1543
|
const TICK_MS = 1e3;
|
|
1544
|
+
/**
|
|
1545
|
+
* Upper bound on the leave leg. The card reports its own animation end, and the
|
|
1546
|
+
* reduced-motion fade reports a transition end; this only ends the presence of a
|
|
1547
|
+
* browser that reports neither, just past var(--ds-transition-duration).
|
|
1548
|
+
*/
|
|
1549
|
+
const EXIT_TIMEOUT_MS = 260;
|
|
1531
1550
|
/** Map a read outcome onto the panel's view state. */
|
|
1532
1551
|
function panelStateOf(outcome, issuedAt) {
|
|
1533
1552
|
switch (outcome.kind) {
|
|
@@ -1548,15 +1567,16 @@ window.__ModuleLoader__.load({
|
|
|
1548
1567
|
}
|
|
1549
1568
|
}
|
|
1550
1569
|
/**
|
|
1551
|
-
* Render the pairing seat trigger and,
|
|
1570
|
+
* Render the pairing seat trigger and, while it is open or leaving, the panel.
|
|
1552
1571
|
* @param props - the footer seat's column state, the injected actions and the locale seat.
|
|
1553
|
-
* @returns the trigger and the panel
|
|
1572
|
+
* @returns the trigger and, when present, the official Modal holding the panel.
|
|
1554
1573
|
*/
|
|
1555
1574
|
function PairEntry({ wide, read, copy, t }) {
|
|
1556
|
-
const [
|
|
1575
|
+
const [presence, setPresence] = (0, react.useState)("closed");
|
|
1557
1576
|
const [state, setState] = (0, react.useState)({ kind: "reading" });
|
|
1558
1577
|
const [copyState, setCopyState] = (0, react.useState)("idle");
|
|
1559
1578
|
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
1579
|
+
const panelId = (0, react.useId)();
|
|
1560
1580
|
const generation = (0, react.useRef)(0);
|
|
1561
1581
|
const mint = (0, react.useCallback)(() => {
|
|
1562
1582
|
const request = ++generation.current;
|
|
@@ -1569,16 +1589,30 @@ window.__ModuleLoader__.load({
|
|
|
1569
1589
|
});
|
|
1570
1590
|
}, [read]);
|
|
1571
1591
|
const openPanel = (0, react.useCallback)(() => {
|
|
1572
|
-
|
|
1592
|
+
setPresence("open");
|
|
1573
1593
|
setCopyState("idle");
|
|
1574
1594
|
mint();
|
|
1575
1595
|
}, [mint]);
|
|
1576
|
-
const
|
|
1596
|
+
const requestClose = (0, react.useCallback)(() => {
|
|
1577
1597
|
generation.current += 1;
|
|
1578
|
-
|
|
1598
|
+
setPresence((current) => current === "closed" ? "closed" : "closing");
|
|
1599
|
+
}, []);
|
|
1600
|
+
const finishClose = (0, react.useCallback)(() => {
|
|
1601
|
+
setPresence((current) => current === "closing" ? "closed" : current);
|
|
1579
1602
|
}, []);
|
|
1603
|
+
const closing = presence === "closing";
|
|
1604
|
+
const showing = presence !== "closed";
|
|
1605
|
+
(0, react.useEffect)(() => {
|
|
1606
|
+
if (!closing) return;
|
|
1607
|
+
const timer = window.setTimeout(() => {
|
|
1608
|
+
finishClose();
|
|
1609
|
+
}, EXIT_TIMEOUT_MS);
|
|
1610
|
+
return () => {
|
|
1611
|
+
window.clearTimeout(timer);
|
|
1612
|
+
};
|
|
1613
|
+
}, [closing, finishClose]);
|
|
1580
1614
|
(0, react.useEffect)(() => {
|
|
1581
|
-
if (
|
|
1615
|
+
if (presence !== "open" || state.kind !== "ready") return;
|
|
1582
1616
|
const deadline = state.expiresAt;
|
|
1583
1617
|
const timer = window.setInterval(() => {
|
|
1584
1618
|
const current = Date.now();
|
|
@@ -1588,19 +1622,9 @@ window.__ModuleLoader__.load({
|
|
|
1588
1622
|
return () => {
|
|
1589
1623
|
window.clearInterval(timer);
|
|
1590
1624
|
};
|
|
1591
|
-
}, [
|
|
1592
|
-
(0, react.
|
|
1593
|
-
|
|
1594
|
-
const onKey = (event) => {
|
|
1595
|
-
if (event.key === "Escape") closePanel();
|
|
1596
|
-
};
|
|
1597
|
-
window.addEventListener("keydown", onKey);
|
|
1598
|
-
return () => {
|
|
1599
|
-
window.removeEventListener("keydown", onKey);
|
|
1600
|
-
};
|
|
1601
|
-
}, [open, closePanel]);
|
|
1602
|
-
const handleCopy = (0, react.useCallback)((token) => {
|
|
1603
|
-
copy(token).then((ok) => {
|
|
1625
|
+
}, [presence, state]);
|
|
1626
|
+
const handleCopy = (0, react.useCallback)((payload) => {
|
|
1627
|
+
copy(payload).then((ok) => {
|
|
1604
1628
|
setCopyState(ok ? "copied" : "failed");
|
|
1605
1629
|
window.setTimeout(() => {
|
|
1606
1630
|
setCopyState("idle");
|
|
@@ -1614,20 +1638,25 @@ window.__ModuleLoader__.load({
|
|
|
1614
1638
|
"data-dsh-part": PART_ENTRY,
|
|
1615
1639
|
"data-wide": wide ? "wide" : "rail",
|
|
1616
1640
|
"aria-label": t("entry.label"),
|
|
1617
|
-
"aria-expanded":
|
|
1641
|
+
"aria-expanded": showing,
|
|
1642
|
+
"aria-controls": showing ? panelId : void 0,
|
|
1618
1643
|
title: t("entry.label"),
|
|
1619
1644
|
onClick: openPanel,
|
|
1620
1645
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QrIcon, {})
|
|
1621
|
-
}),
|
|
1646
|
+
}), showing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PairPanel, {
|
|
1647
|
+
id: panelId,
|
|
1622
1648
|
t,
|
|
1623
1649
|
state,
|
|
1624
1650
|
now,
|
|
1625
1651
|
host: window.location.host,
|
|
1626
1652
|
copy: copyState,
|
|
1627
|
-
|
|
1653
|
+
showing,
|
|
1654
|
+
closing,
|
|
1655
|
+
onClose: requestClose,
|
|
1656
|
+
onExited: finishClose,
|
|
1628
1657
|
onRefresh: mint,
|
|
1629
1658
|
onCopy: handleCopy
|
|
1630
|
-
})
|
|
1659
|
+
})] });
|
|
1631
1660
|
}
|
|
1632
1661
|
//#endregion
|
|
1633
1662
|
//#region src/client/pair-token.ts
|
|
@@ -1717,29 +1746,25 @@ window.__ModuleLoader__.load({
|
|
|
1717
1746
|
/**
|
|
1718
1747
|
* `remote-bridge` namespace dictionaries: the protocol v1 pairing panel copy.
|
|
1719
1748
|
*
|
|
1720
|
-
* The panel has one job —
|
|
1721
|
-
* QR symbol
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1724
|
-
*
|
|
1749
|
+
* The panel has one job — put the live one-shot code in front of the operator as
|
|
1750
|
+
* a QR symbol — so the copy carries exactly four things: what to do with the
|
|
1751
|
+
* symbol, how long it lives, which address the phone will actually dial, and why
|
|
1752
|
+
* the code is single-use. No key states how the host finds its public address:
|
|
1753
|
+
* that is an implementation fact the reader cannot act on.
|
|
1725
1754
|
*/
|
|
1726
1755
|
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
1727
1756
|
const zh = {
|
|
1728
1757
|
"entry.label": "配对手机(协议 v1)",
|
|
1729
1758
|
"title": "协议 v1 配对",
|
|
1730
|
-
"subtitle": "用手机 App
|
|
1759
|
+
"subtitle": "用手机 App 扫描二维码,即可让手机以协议 v1 连上这台宿主。配对码由本机签发,只在本机显示。",
|
|
1731
1760
|
"state.reading": "正在取配对码…",
|
|
1732
1761
|
"pair.qrLabel": "配对二维码",
|
|
1733
|
-
"pair.payloadLabel": "二维码内容(可复制后粘贴到手机)",
|
|
1734
1762
|
"pair.countdown": "剩余 {s} 秒",
|
|
1735
|
-
"pair.expired": "
|
|
1736
|
-
"pair.expiredHint": "过期的配对码不会被手机接受,请重新取码。",
|
|
1737
|
-
"pair.usedHint": "配对码一次性:手机调用 pair.begin 的瞬间即作废,重新取码也会作废上一张。",
|
|
1763
|
+
"pair.expired": "配对码已过期",
|
|
1738
1764
|
"pair.refresh": "重新取码",
|
|
1739
|
-
"
|
|
1740
|
-
"origin.
|
|
1741
|
-
"origin.
|
|
1742
|
-
"origin.located.body": "二维码里已经带上 {origin}:手机扫一次就同时设好连接地址与配对码,不需要手填任何东西。",
|
|
1765
|
+
"pair.usedHint": "配对码一次性有效:手机一开始配对即作废,重新取码也会作废上一张。",
|
|
1766
|
+
"origin.located": "手机将连到 {origin}",
|
|
1767
|
+
"origin.missing": "没有找到公网地址:请先在手机里把连接地址填成你的公网中继,再扫码。本页的 {host} 只有本机能连。",
|
|
1743
1768
|
"forbidden.title": "这个页面不是从本机打开的",
|
|
1744
1769
|
"forbidden.body": "配对码只能在本机 Web UI 上取。请在本机浏览器打开 http://127.0.0.1:<端口> 后重试。",
|
|
1745
1770
|
"failed.title": "取配对码失败",
|
|
@@ -1756,19 +1781,15 @@ window.__ModuleLoader__.load({
|
|
|
1756
1781
|
const en = {
|
|
1757
1782
|
"entry.label": "Pair a phone (protocol v1)",
|
|
1758
1783
|
"title": "Protocol v1 pairing",
|
|
1759
|
-
"subtitle": "Scan the QR code with the phone app to
|
|
1784
|
+
"subtitle": "Scan the QR code with the phone app to let the phone reach this host over protocol v1. The code is minted by this machine and shown only here.",
|
|
1760
1785
|
"state.reading": "Requesting a pairing code…",
|
|
1761
1786
|
"pair.qrLabel": "Pairing QR code",
|
|
1762
|
-
"pair.payloadLabel": "What the QR encodes (copy it to paste on the phone)",
|
|
1763
1787
|
"pair.countdown": "{s} s left",
|
|
1764
|
-
"pair.expired": "The pairing code expired
|
|
1765
|
-
"pair.expiredHint": "An expired code is never accepted; request a new one.",
|
|
1766
|
-
"pair.usedHint": "The code is single-use: the phone spends it the moment it calls pair.begin, and requesting a new one voids the previous code.",
|
|
1788
|
+
"pair.expired": "The pairing code expired",
|
|
1767
1789
|
"pair.refresh": "New code",
|
|
1768
|
-
"
|
|
1769
|
-
"origin.
|
|
1770
|
-
"origin.
|
|
1771
|
-
"origin.located.body": "The QR carries {origin}: one scan sets both the connection address and the pairing code, with nothing to type.",
|
|
1790
|
+
"pair.usedHint": "The code is single-use: pairing spends it, and a new code voids the previous one.",
|
|
1791
|
+
"origin.located": "The phone will dial {origin}",
|
|
1792
|
+
"origin.missing": "No public address found: set the phone app to your public relay first, then scan. {host} (this page) is reachable only from this machine.",
|
|
1772
1793
|
"forbidden.title": "This page is not open on this machine",
|
|
1773
1794
|
"forbidden.body": "Pairing codes can only be read from the machine itself. Open http://127.0.0.1:<port> in a browser on this machine and retry.",
|
|
1774
1795
|
"failed.title": "Could not read a pairing code",
|