ds-harness-remote 0.3.35 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -24
- package/dist/client-runtime.d.ts +9 -4
- package/dist/client-runtime.d.ts.map +1 -1
- package/dist/client-runtime.js +137 -35
- package/dist/client-runtime.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.github.js +79 -32
- package/dist/client.js +79 -32
- package/dist/client.js.map +1 -1
- package/dist/harness-api-bridge.d.ts +2 -9
- package/dist/harness-api-bridge.d.ts.map +1 -1
- package/dist/harness-api-bridge.js.map +1 -1
- package/dist/harness-remote-bridge.d.ts +46 -0
- package/dist/harness-remote-bridge.d.ts.map +1 -0
- package/dist/harness-remote-bridge.js +321 -0
- package/dist/harness-remote-bridge.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +870 -81
- package/dist/index.js.map +4 -4
- package/dist/remote-file-content-provider.d.ts +3 -1
- package/dist/remote-file-content-provider.d.ts.map +1 -1
- package/dist/remote-file-content-provider.js +10 -1
- package/dist/remote-file-content-provider.js.map +1 -1
- package/dist/remote-typert-gateway.d.ts +13 -0
- package/dist/remote-typert-gateway.d.ts.map +1 -0
- package/dist/remote-typert-gateway.js +242 -0
- package/dist/remote-typert-gateway.js.map +1 -0
- package/dist/rpc-router.d.ts +7 -2
- package/dist/rpc-router.d.ts.map +1 -1
- package/dist/rpc-router.js +61 -12
- package/dist/rpc-router.js.map +1 -1
- package/dist/server-api.d.ts +1 -1
- package/dist/server-api.d.ts.map +1 -1
- package/dist/server-api.js +14 -3
- package/dist/server-api.js.map +1 -1
- package/dist/service.d.ts +5 -3
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +26 -8
- package/dist/service.js.map +1 -1
- package/dist/typert-gateway-contract.d.ts +48 -0
- package/dist/typert-gateway-contract.d.ts.map +1 -0
- package/dist/typert-gateway-contract.js +2 -0
- package/dist/typert-gateway-contract.js.map +1 -0
- package/dist/typert-gateway-switch.d.ts +28 -7
- package/dist/typert-gateway-switch.d.ts.map +1 -1
- package/dist/typert-gateway-switch.js +114 -23
- package/dist/typert-gateway-switch.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +13 -8
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAWA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,gBAAgB,EAAE;YAChB,IAAI,CAAC,KAAK,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,KAAK,OAAO,CAAA;aAAE,GAAG,IAAI,CAAA;SAC1F,CAAA;QACD,mCAAmC,CAAC,EAAE,OAAO,CAAA;KAC9C;CACF"}
|
package/dist/client.github.js
CHANGED
|
@@ -1626,10 +1626,13 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1626
1626
|
function shouldUseRemoteFileViewer(status) {
|
|
1627
1627
|
return status.mode === "remote" && status.remoteFeatures?.fileViewer === !0;
|
|
1628
1628
|
}
|
|
1629
|
-
var REMOTE_FILE_SAVE_AS_MAX_BYTES = 100 * 1024 * 1024;
|
|
1629
|
+
var REMOTE_FILE_SAVE_AS_MAX_BYTES = 100 * 1024 * 1024, REMOTE_FILE_FAST_SAVE_AS_MAX_BYTES = 1024 * 1024 * 1024;
|
|
1630
1630
|
function shouldAllowRemoteFileSaveAs(status) {
|
|
1631
1631
|
return shouldUseRemoteFileViewer(status) && (status.transport === "LAN" || status.transport === "P2P" || status.transport === "TURN");
|
|
1632
1632
|
}
|
|
1633
|
+
function remoteFileSaveAsMaxBytes(status) {
|
|
1634
|
+
return status.transport === "LAN" || status.transport === "P2P" ? REMOTE_FILE_FAST_SAVE_AS_MAX_BYTES : REMOTE_FILE_SAVE_AS_MAX_BYTES;
|
|
1635
|
+
}
|
|
1633
1636
|
function createRemoteFileContentProvider(call, options = {}) {
|
|
1634
1637
|
return {
|
|
1635
1638
|
id: "dsh-remote-files",
|
|
@@ -1637,7 +1640,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1637
1640
|
supports: () => !0,
|
|
1638
1641
|
saveAsAllowed: () => ({
|
|
1639
1642
|
allowed: currentSaveAsAllowed(options.saveAsAllowed),
|
|
1640
|
-
maxBytes: options.saveAsMaxBytes
|
|
1643
|
+
maxBytes: currentSaveAsMaxBytes(options.saveAsMaxBytes)
|
|
1641
1644
|
}),
|
|
1642
1645
|
async stat(locator, signal) {
|
|
1643
1646
|
let value = await call("fileviewer.stat", { path: locator }, signal);
|
|
@@ -1681,6 +1684,9 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1681
1684
|
function currentSaveAsAllowed(value) {
|
|
1682
1685
|
return typeof value == "function" ? value() : value === !0;
|
|
1683
1686
|
}
|
|
1687
|
+
function currentSaveAsMaxBytes(value) {
|
|
1688
|
+
return typeof value == "function" ? value() : value ?? REMOTE_FILE_SAVE_AS_MAX_BYTES;
|
|
1689
|
+
}
|
|
1684
1690
|
function decodeBase64(value) {
|
|
1685
1691
|
let binary = atob(value), bytes = new Uint8Array(binary.length);
|
|
1686
1692
|
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
@@ -1737,6 +1743,8 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1737
1743
|
switchTarget: "Switch Local / Remote Harness target",
|
|
1738
1744
|
harnessTarget: "Harness target",
|
|
1739
1745
|
close: "Close",
|
|
1746
|
+
refreshRemote: "Refresh remote hosts",
|
|
1747
|
+
refreshRemoteShort: "Refresh",
|
|
1740
1748
|
local: "Local",
|
|
1741
1749
|
remoteTarget: "Remote \xB7 {name}",
|
|
1742
1750
|
thisMachineLocal: "This machine (Local)",
|
|
@@ -1932,6 +1940,8 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1932
1940
|
switchTarget: "\u5207\u6362\u672C\u5730\u6216\u8FDC\u7A0B Harness",
|
|
1933
1941
|
harnessTarget: "Harness \u76EE\u6807",
|
|
1934
1942
|
close: "\u5173\u95ED",
|
|
1943
|
+
refreshRemote: "\u5237\u65B0\u8FDC\u7A0B\u4E3B\u673A",
|
|
1944
|
+
refreshRemoteShort: "\u5237\u65B0",
|
|
1935
1945
|
local: "\u672C\u5730",
|
|
1936
1946
|
remoteTarget: "\u8FDC\u7A0B \xB7 {name}",
|
|
1937
1947
|
thisMachineLocal: "\u6B64\u8BBE\u5907\uFF08\u672C\u5730\uFF09",
|
|
@@ -2070,7 +2080,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2070
2080
|
signInClientDescription: "\u4E00\u6B21\u8FDE\u63A5\uFF0C\u968F\u65F6\u53EF\u7528\u3002",
|
|
2071
2081
|
startSignIn: "\u5F00\u59CB\u767B\u5F55",
|
|
2072
2082
|
allowControlCurrentDevice: "\u5141\u8BB8\u63A7\u5236\u5F53\u524D\u8BBE\u5907",
|
|
2073
|
-
exitRemoteAccount: "\u9000\u51FA",
|
|
2083
|
+
exitRemoteAccount: "\u9000\u51FA\u8D26\u53F7",
|
|
2074
2084
|
githubLogin: "GitHub \u626B\u7801",
|
|
2075
2085
|
zhihuLogin: "\u77E5\u4E4E\u626B\u7801",
|
|
2076
2086
|
scanWithGitHub: "\u4F7F\u7528 GitHub \u626B\u7801\u767B\u5F55",
|
|
@@ -2454,7 +2464,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2454
2464
|
);
|
|
2455
2465
|
}
|
|
2456
2466
|
function RemoteWorkspaceAction(props) {
|
|
2457
|
-
let { t } = props, [open, setOpen] = React.useState(!1), [status, setStatus] = React.useState(void 0), [devices, setDevices] = React.useState([]), [selectedHost, setSelectedHost] = React.useState(void 0), [workspaces, setWorkspaces] = React.useState([]), [directory, setDirectory] = React.useState(void 0), [path, setPath] = React.useState(""), [addingWorkspace, setAddingWorkspace] = React.useState(!1), [busy, setBusy] = React.useState(!1), [needsAuthorization, setNeedsAuthorization] = React.useState(!1), [email, setEmail] = React.useState(""), [password, setPassword] = React.useState(""), [loginMethod, setLoginMethod] = React.useState(props.preferredQrProvider), [loginMethodManuallySelected, setLoginMethodManuallySelected] = React.useState(!1), [qrSession, setQrSession] = React.useState(void 0), [qrImage, setQrImage] = React.useState(void 0), [qrExpired, setQrExpired] = React.useState(!1), [progress, setProgress] = React.useState(void 0), progressRun = React.useRef(0), [notice, setNotice] = React.useState(void 0), [error, setError] = React.useState(void 0);
|
|
2467
|
+
let { t } = props, [open, setOpen] = React.useState(!1), [status, setStatus] = React.useState(void 0), [devices, setDevices] = React.useState([]), [selectedHost, setSelectedHost] = React.useState(void 0), [workspaces, setWorkspaces] = React.useState([]), [directory, setDirectory] = React.useState(void 0), [path, setPath] = React.useState(""), [addingWorkspace, setAddingWorkspace] = React.useState(!1), [busy, setBusy] = React.useState(!1), [needsAuthorization, setNeedsAuthorization] = React.useState(!1), [email, setEmail] = React.useState(""), [password, setPassword] = React.useState(""), [loginMethod, setLoginMethod] = React.useState(props.preferredQrProvider), [loginMethodManuallySelected, setLoginMethodManuallySelected] = React.useState(!1), [qrSession, setQrSession] = React.useState(void 0), [qrImage, setQrImage] = React.useState(void 0), [qrExpired, setQrExpired] = React.useState(!1), [progress, setProgress] = React.useState(void 0), progressRun = React.useRef(0), qrFlowRun = React.useRef(0), [notice, setNotice] = React.useState(void 0), [error, setError] = React.useState(void 0);
|
|
2458
2468
|
React.useEffect(() => {
|
|
2459
2469
|
if (!open) return;
|
|
2460
2470
|
let closeOnEscape = (event) => {
|
|
@@ -2471,6 +2481,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2471
2481
|
};
|
|
2472
2482
|
}, [status?.mode]);
|
|
2473
2483
|
let startQrLogin = async (provider) => {
|
|
2484
|
+
let run = ++qrFlowRun.current;
|
|
2474
2485
|
setBusy(!0), setError(void 0), setQrExpired(!1);
|
|
2475
2486
|
try {
|
|
2476
2487
|
let session = await props.control("client.account.qr.start", { provider }), image = await import_qrcode.default.toDataURL(session.scanUrl, {
|
|
@@ -2478,34 +2489,49 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2478
2489
|
margin: 1,
|
|
2479
2490
|
errorCorrectionLevel: "L"
|
|
2480
2491
|
});
|
|
2492
|
+
if (run !== qrFlowRun.current) return;
|
|
2481
2493
|
setQrSession(session), setQrImage(image);
|
|
2482
2494
|
} catch (reason) {
|
|
2483
|
-
setError(messageOf(reason));
|
|
2495
|
+
run === qrFlowRun.current && setError(messageOf(reason));
|
|
2484
2496
|
} finally {
|
|
2485
|
-
setBusy(!1);
|
|
2497
|
+
run === qrFlowRun.current && setBusy(!1);
|
|
2486
2498
|
}
|
|
2487
2499
|
};
|
|
2488
2500
|
React.useEffect(() => {
|
|
2489
2501
|
!open || !needsAuthorization || loginMethod === "password" || qrSession !== void 0 || qrExpired || startQrLogin(loginMethod);
|
|
2490
2502
|
}, [open, needsAuthorization, loginMethod, qrSession, qrExpired]), React.useEffect(() => {
|
|
2491
2503
|
if (!open || loginMethod === "password" || qrSession === void 0) return;
|
|
2492
|
-
let active = !0, poll = () => {
|
|
2493
|
-
props.control("client.account.qr.poll", { qrId: qrSession.qrId }).then(async (result) => {
|
|
2494
|
-
|
|
2504
|
+
let active = !0, polling = !1, settled = !1, run = qrFlowRun.current, timer, poll = () => {
|
|
2505
|
+
polling || settled || (polling = !0, props.control("client.account.qr.poll", { qrId: qrSession.qrId }).then(async (result) => {
|
|
2506
|
+
if (!(!active || settled || run !== qrFlowRun.current))
|
|
2507
|
+
if (result.status === "complete") {
|
|
2508
|
+
settled = !0, timer !== void 0 && window.clearInterval(timer), setBusy(!0), setError(void 0), setQrExpired(!1), setNeedsAuthorization(!1);
|
|
2509
|
+
try {
|
|
2510
|
+
let [nextDevices, nextStatus] = await Promise.all([
|
|
2511
|
+
props.control("devices"),
|
|
2512
|
+
props.control("status")
|
|
2513
|
+
]);
|
|
2514
|
+
active && run === qrFlowRun.current && (setDevices(nextDevices), setStatus(nextStatus));
|
|
2515
|
+
} catch (reason) {
|
|
2516
|
+
active && run === qrFlowRun.current && setError(messageOf(reason));
|
|
2517
|
+
} finally {
|
|
2518
|
+
run === qrFlowRun.current && (setQrSession(void 0), setQrImage(void 0), setBusy(!1));
|
|
2519
|
+
}
|
|
2520
|
+
} else result.status === "expired" && (settled = !0, timer !== void 0 && window.clearInterval(timer), setQrExpired(!0), setQrSession(void 0), setQrImage(void 0));
|
|
2495
2521
|
}).catch((reason) => {
|
|
2496
|
-
active && setError(messageOf(reason));
|
|
2497
|
-
})
|
|
2522
|
+
active && !settled && run === qrFlowRun.current && setError(messageOf(reason));
|
|
2523
|
+
}).finally(() => {
|
|
2524
|
+
polling = !1;
|
|
2525
|
+
}));
|
|
2498
2526
|
};
|
|
2499
|
-
poll()
|
|
2500
|
-
|
|
2501
|
-
return () => {
|
|
2502
|
-
active = !1, window.clearInterval(timer);
|
|
2527
|
+
return poll(), timer = window.setInterval(poll, 1500), () => {
|
|
2528
|
+
active = !1, timer !== void 0 && window.clearInterval(timer);
|
|
2503
2529
|
};
|
|
2504
2530
|
}, [open, loginMethod, qrSession]), React.useEffect(() => {
|
|
2505
|
-
loginMethodManuallySelected || loginMethod === props.preferredQrProvider || (setLoginMethod(props.preferredQrProvider), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2531
|
+
loginMethodManuallySelected || loginMethod === props.preferredQrProvider || (qrFlowRun.current += 1, setLoginMethod(props.preferredQrProvider), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2506
2532
|
}, [props.preferredQrProvider, loginMethodManuallySelected]);
|
|
2507
2533
|
let selectLoginMethod = (method) => {
|
|
2508
|
-
setLoginMethodManuallySelected(!0), method !== loginMethod && (setLoginMethod(method), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2534
|
+
setLoginMethodManuallySelected(!0), method !== loginMethod && (qrFlowRun.current += 1, setLoginMethod(method), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2509
2535
|
}, orderedQrProviders = props.preferredQrProvider === "zhihu" ? ["zhihu", "github"] : ["github", "zhihu"], qrLoginTab = (provider) => React.createElement("button", {
|
|
2510
2536
|
key: provider,
|
|
2511
2537
|
type: "button",
|
|
@@ -2551,21 +2577,30 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2551
2577
|
setBusy(!1);
|
|
2552
2578
|
}
|
|
2553
2579
|
}
|
|
2554
|
-
},
|
|
2555
|
-
|
|
2580
|
+
}, refreshRemote = async () => {
|
|
2581
|
+
setBusy(!0), setNotice(void 0), setError(void 0);
|
|
2556
2582
|
try {
|
|
2557
2583
|
let nextStatus = await props.control("status");
|
|
2558
|
-
if (setStatus(nextStatus), nextStatus.available)
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2584
|
+
if (setStatus(nextStatus), !nextStatus.available) {
|
|
2585
|
+
setDevices([]), setNeedsAuthorization(!1), setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0);
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
try {
|
|
2589
|
+
let nextDevices = await props.control("devices");
|
|
2590
|
+
if (setDevices(nextDevices), setNeedsAuthorization(!1), selectedHost !== void 0) {
|
|
2591
|
+
let nextSelectedHost = nextDevices.find((device) => device.deviceId === selectedHost.deviceId);
|
|
2592
|
+
nextSelectedHost === void 0 ? (setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0)) : setSelectedHost(nextSelectedHost);
|
|
2563
2593
|
}
|
|
2594
|
+
} catch {
|
|
2595
|
+
setDevices([]), setNeedsAuthorization(!0), setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0);
|
|
2596
|
+
}
|
|
2564
2597
|
} catch (reason) {
|
|
2565
2598
|
setError(messageOf(reason));
|
|
2566
2599
|
} finally {
|
|
2567
2600
|
setBusy(!1);
|
|
2568
2601
|
}
|
|
2602
|
+
}, show = async () => {
|
|
2603
|
+
setOpen(!0), await refreshRemote();
|
|
2569
2604
|
}, signInClient = async () => {
|
|
2570
2605
|
if (!(email.trim() === "" || password === "")) {
|
|
2571
2606
|
setBusy(!0), setError(void 0);
|
|
@@ -2673,7 +2708,19 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2673
2708
|
React.createElement("strong", null, t("remoteTitle")),
|
|
2674
2709
|
React.createElement("p", null, t("remoteDescription"))
|
|
2675
2710
|
),
|
|
2676
|
-
React.createElement(
|
|
2711
|
+
React.createElement(
|
|
2712
|
+
"div",
|
|
2713
|
+
{ className: "dshRemotePageActions" },
|
|
2714
|
+
React.createElement("button", {
|
|
2715
|
+
type: "button",
|
|
2716
|
+
className: "dshRemotePageRefresh",
|
|
2717
|
+
disabled: busy,
|
|
2718
|
+
title: t("refreshRemote"),
|
|
2719
|
+
"aria-label": t("refreshRemote"),
|
|
2720
|
+
onClick: () => void refreshRemote()
|
|
2721
|
+
}, t("refreshRemoteShort")),
|
|
2722
|
+
React.createElement("button", { type: "button", onClick: () => setOpen(!1), "aria-label": t("close") }, "\xD7")
|
|
2723
|
+
)
|
|
2677
2724
|
),
|
|
2678
2725
|
React.createElement(
|
|
2679
2726
|
"main",
|
|
@@ -3273,7 +3320,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3273
3320
|
".dshRemoteSessionHeader{left:auto;right:148px;transform:none;max-width:calc(100vw - 420px)}@media(max-width:760px){.dshRemoteSessionHeader{left:auto;right:104px;transform:none;max-width:calc(100vw - 124px)}}",
|
|
3274
3321
|
".dshRemoteModeButton:focus-visible,.dshRemotePage button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}",
|
|
3275
3322
|
".dshRemotePage{width:min(720px,100%);max-height:min(760px,calc(100vh - 40px));display:flex;flex-direction:column;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:14px;overflow:hidden;animation:dshRemotePageIn .18s cubic-bezier(.25,1,.5,1)}",
|
|
3276
|
-
".dshRemotePageHeader{min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:24px;padding:14px 24px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemotePageIntro{min-width:0;flex:1}.dshRemotePageHeader strong{display:block;font-size:18px;line-height:1.4}.dshRemotePageHeader p{min-width:0;max-width:70ch;margin:3px 0 0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}.
|
|
3323
|
+
".dshRemotePageHeader{min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:24px;padding:14px 24px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemotePageIntro{min-width:0;flex:1}.dshRemotePageHeader strong{display:block;font-size:18px;line-height:1.4}.dshRemotePageHeader p{min-width:0;max-width:70ch;margin:3px 0 0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}.dshRemotePageActions{flex:0 0 auto;display:flex;align-items:center;gap:4px}.dshRemotePageActions>button{height:40px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;border:0;border-radius:8px;background:transparent;color:inherit;line-height:1;cursor:pointer}.dshRemotePageActions>button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.dshRemotePageActions>button:disabled{opacity:.45;cursor:default}.dshRemotePageRefresh{min-width:48px;padding:0 10px;font:inherit;font-size:13px}.dshRemotePageActions>button:not(.dshRemotePageRefresh){width:40px;padding:0;font-size:24px}",
|
|
3277
3324
|
".dshRemotePageBody{padding:24px;overflow:auto;display:flex;flex-direction:column;gap:24px}.dshRemotePageBody button{font:inherit;color:inherit}",
|
|
3278
3325
|
".dshRemoteSectionHeading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:10px}.dshRemoteSectionTitle{min-width:0;display:flex;align-items:center;gap:10px}.dshRemoteSectionTitle>strong{font-size:14px}.dshRemoteSectionActions{display:flex;align-items:center;gap:14px}.dshRemoteSectionActions>button{border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;padding:5px 0;font-size:12px}.dshRemoteSectionActions>button:hover:not(:disabled){color:var(--dsw-alias-label-primary);text-decoration:underline}",
|
|
3279
3326
|
".dshRemoteSectionHeading>.dshRemoteAddWorkspace{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:50%;font-size:20px;line-height:1}.dshRemoteSectionHeading>.dshRemoteAddWorkspace:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",
|
|
@@ -3285,11 +3332,11 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3285
3332
|
".dshRemoteFolderBrowser{margin-top:14px}.dshRemoteFolderBrowser>p,.dshRemoteFolderList>p{margin:12px 0;color:var(--dsw-alias-label-secondary);font-size:13px}.dshRemoteFolderList{max-height:260px;overflow:auto;border-block:1px solid var(--dsw-alias-border-l2)}.dshRemoteFolderList>button{width:100%;min-height:42px;display:flex;align-items:center;gap:9px;border:0;border-bottom:1px solid var(--dsw-alias-border-l2);background:transparent;padding:7px 6px;text-align:left;cursor:pointer}.dshRemoteFolderList>button:hover{background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteFolderBrowser>small{display:block;margin-top:8px;color:var(--dsw-alias-state-warn-label)}",
|
|
3286
3333
|
".dshRemotePathField{display:flex;flex-direction:column;gap:6px;margin-top:20px}.dshRemotePathField>span{font-size:13px;font-weight:600}.dshRemotePathField>input{min-height:40px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:inherit;padding:0 12px;font:inherit}.dshRemotePathField>small{color:var(--dsw-alias-label-secondary)}",
|
|
3287
3334
|
".dshRemoteOpenBar{position:sticky;bottom:-96px;display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:20px;padding:14px 0;background:var(--dsw-alias-bg-layer-1);border-top:1px solid var(--dsw-alias-border-l2)}.dshRemoteOpenBar>div{min-width:0;display:flex;flex-direction:column;gap:3px}.dshRemoteOpenBar span{color:var(--dsw-alias-label-secondary);font-size:12px}.dshRemoteOpenBar strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.dshRemoteOpenBar>button,.dshRemoteEnable>button{min-height:40px;flex:0 0 auto;border:0;border-radius:8px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-1);padding:8px 16px;cursor:pointer}.dshRemoteOpenBar>button:disabled,.dshRemoteEnable>button:disabled{opacity:.5;cursor:default}",
|
|
3288
|
-
".dshRemoteEnable{max-width:
|
|
3335
|
+
".dshRemoteEnable{box-sizing:border-box;width:min(440px,100%);max-width:100%;min-height:388px;margin:0 auto;display:flex;flex-direction:column;align-items:stretch;gap:10px}.dshRemoteEnable p{margin:0;color:var(--dsw-alias-label-secondary);line-height:1.5}",
|
|
3289
3336
|
'.dshRemoteLoginTabs{width:min(440px,100%);display:flex;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemoteLoginTabs>button{position:relative;min-height:38px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:6px 14px;font:inherit;font-size:13px;cursor:pointer}.dshRemoteLoginTabs>button:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshRemoteLoginTabs>button.isActive{color:var(--dsw-alias-label-primary);font-weight:600}.dshRemoteLoginTabs>button.isActive::after{content:"";position:absolute;right:12px;bottom:-1px;left:12px;height:2px;border-radius:2px 2px 0 0;background:var(--dsw-alias-brand-primary)}.dshRemoteLoginTabs>button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px;border-radius:6px}',
|
|
3290
3337
|
".dshRemoteClientLogin{width:min(440px,100%);display:flex;flex-direction:column;gap:8px}.dshRemoteClientLogin input{min-height:40px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:inherit;padding:0 12px;font:inherit}.dshRemoteClientLogin button{align-self:flex-start;min-height:40px;border:0;border-radius:8px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-1);padding:8px 16px;cursor:pointer}",
|
|
3291
3338
|
".dshRemoteQrLogin{width:min(440px,100%);display:flex;flex-direction:column;align-items:center;gap:8px;padding:6px 0 2px;text-align:center}.dshRemoteQrLogin img,.dshRemoteQrPlaceholder{box-sizing:border-box;width:200px;height:200px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:#fff;padding:8px}.dshRemoteQrOpen{display:flex;flex-direction:column;align-items:center;gap:5px;color:var(--dsw-alias-label-secondary);font-size:12px;text-decoration:none}.dshRemoteQrOpen:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteQrOpen:hover img{border-color:var(--dsw-alias-label-dimmed)}.dshRemoteQrOpen:focus-visible{border-radius:12px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.dshRemoteQrPlaceholder{display:flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-secondary)}.dshRemoteQrLogin>strong{font-size:14px}.dshRemoteQrLogin>p{max-width:48ch;margin:0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5}.dshRemoteQrLogin>.dshRemoteServiceAddress{margin-top:2px;color:var(--dsw-alias-label-tertiary)}.dshRemoteServiceAddress>a{color:var(--dsw-alias-label-secondary);text-decoration:none}.dshRemoteServiceAddress>a:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteQrLogin>button,.dshRemoteClientLogin>.dshRemoteLoginSwitch{min-height:32px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:4px 8px;font:inherit;font-size:12px;cursor:pointer}.dshRemoteQrLogin>button:hover,.dshRemoteClientLogin>.dshRemoteLoginSwitch:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteClientLogin>.dshRemoteLoginSwitch{align-self:flex-start;background:transparent;color:var(--dsw-alias-label-secondary);padding-left:0}",
|
|
3292
|
-
".
|
|
3339
|
+
".dshRemoteLoginHeading{box-sizing:border-box;width:100%;display:flex;align-items:baseline;gap:10px;overflow:hidden;white-space:nowrap}.dshRemoteLoginTitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dshRemoteLoginHeading>span{flex:0 0 auto;color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:400}.dshRemoteLoginTabs{box-sizing:border-box;width:100%}.dshRemoteLoginTabs>button{min-width:0;flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.dshRemoteLoginTabs>button.isActive::after{right:0;left:0;border-radius:0}.dshRemoteClientLogin,.dshRemoteQrLogin{box-sizing:border-box;width:100%;height:300px;min-height:300px}.dshRemoteClientLogin{align-items:stretch;padding-top:16px}.dshRemoteClientLogin>button{align-self:stretch;width:100%}.dshRemoteQrLogin{padding-top:12px}",
|
|
3293
3340
|
'.dshRemoteHostControlToggle{display:flex;align-items:center;gap:7px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;white-space:nowrap;cursor:default}.dshRemoteHostControlToggle>input{appearance:none;box-sizing:border-box;position:relative;width:32px;height:18px;flex:0 0 auto;margin:0;border:1px solid var(--dsw-alias-label-secondary);border-radius:999px;background:var(--dsw-alias-bg-layer-3);cursor:pointer;box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2);transition:background .16s ease-out,border-color .16s ease-out,box-shadow .16s ease-out}.dshRemoteHostControlToggle>input::after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-label-secondary);transition:transform .16s ease-out,background .16s ease-out}.dshRemoteHostControlToggle>input:checked{border-color:var(--dsw-alias-state-success-primary);background:var(--dsw-alias-state-success-primary);box-shadow:none}.dshRemoteHostControlToggle>input:checked::after{transform:translateX(14px);background:var(--dsw-alias-bg-layer-1)}.dshRemoteHostControlToggle>input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.dshRemoteHostControlToggle>input:disabled{opacity:.5;cursor:default}@media(prefers-reduced-motion:reduce){.dshRemoteHostControlToggle>input,.dshRemoteHostControlToggle>input::after{transition:none}}',
|
|
3294
3341
|
".dshRemoteAccountExit{flex:0 0 auto;border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;padding:5px 0;font-size:12px;line-height:1.5;white-space:nowrap}.dshRemoteAccountExit:hover:not(:disabled){color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteAccountExit:disabled{opacity:.5;cursor:default;text-decoration:none}",
|
|
3295
3342
|
".dshRemoteLocalLink{align-self:flex-start;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:4px 0;cursor:pointer}.dshRemoteLocalLink:hover{color:var(--dsw-alias-label-primary)}",
|
|
@@ -3354,15 +3401,15 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3354
3401
|
}, "ds-harness-remote: resume selected workspace"), ctx.inject(["fileViewer"], (fileViewerContext) => {
|
|
3355
3402
|
let viewer = fileViewerContext.get("fileViewer");
|
|
3356
3403
|
viewer !== void 0 && fileViewerContext.effect(() => {
|
|
3357
|
-
let active = !0, unregister, latestSaveAsAllowed = !1, sync = async () => {
|
|
3404
|
+
let active = !0, unregister, latestSaveAsAllowed = !1, latestSaveAsMaxBytes = REMOTE_FILE_SAVE_AS_MAX_BYTES, sync = async () => {
|
|
3358
3405
|
try {
|
|
3359
3406
|
let status = await control("status");
|
|
3360
3407
|
if (!active) return;
|
|
3361
3408
|
let supported = shouldUseRemoteFileViewer(status);
|
|
3362
|
-
latestSaveAsAllowed = shouldAllowRemoteFileSaveAs(status), supported && unregister === void 0 ? unregister = viewer.registerContentProvider(createRemoteFileContentProvider(
|
|
3409
|
+
latestSaveAsAllowed = shouldAllowRemoteFileSaveAs(status), latestSaveAsMaxBytes = remoteFileSaveAsMaxBytes(status), supported && unregister === void 0 ? unregister = viewer.registerContentProvider(createRemoteFileContentProvider(
|
|
3363
3410
|
(endpoint, payload) => control(endpoint, payload),
|
|
3364
|
-
{ saveAsAllowed: () => latestSaveAsAllowed, saveAsMaxBytes:
|
|
3365
|
-
)) : !supported && unregister !== void 0 && (unregister(), unregister = void 0, latestSaveAsAllowed = !1);
|
|
3411
|
+
{ saveAsAllowed: () => latestSaveAsAllowed, saveAsMaxBytes: () => latestSaveAsMaxBytes }
|
|
3412
|
+
)) : !supported && unregister !== void 0 && (unregister(), unregister = void 0, latestSaveAsAllowed = !1, latestSaveAsMaxBytes = REMOTE_FILE_SAVE_AS_MAX_BYTES);
|
|
3366
3413
|
} catch {
|
|
3367
3414
|
}
|
|
3368
3415
|
};
|
package/dist/client.js
CHANGED
|
@@ -1626,10 +1626,13 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1626
1626
|
function shouldUseRemoteFileViewer(status) {
|
|
1627
1627
|
return status.mode === "remote" && status.remoteFeatures?.fileViewer === !0;
|
|
1628
1628
|
}
|
|
1629
|
-
var REMOTE_FILE_SAVE_AS_MAX_BYTES = 100 * 1024 * 1024;
|
|
1629
|
+
var REMOTE_FILE_SAVE_AS_MAX_BYTES = 100 * 1024 * 1024, REMOTE_FILE_FAST_SAVE_AS_MAX_BYTES = 1024 * 1024 * 1024;
|
|
1630
1630
|
function shouldAllowRemoteFileSaveAs(status) {
|
|
1631
1631
|
return shouldUseRemoteFileViewer(status) && (status.transport === "LAN" || status.transport === "P2P" || status.transport === "TURN");
|
|
1632
1632
|
}
|
|
1633
|
+
function remoteFileSaveAsMaxBytes(status) {
|
|
1634
|
+
return status.transport === "LAN" || status.transport === "P2P" ? REMOTE_FILE_FAST_SAVE_AS_MAX_BYTES : REMOTE_FILE_SAVE_AS_MAX_BYTES;
|
|
1635
|
+
}
|
|
1633
1636
|
function createRemoteFileContentProvider(call, options = {}) {
|
|
1634
1637
|
return {
|
|
1635
1638
|
id: "dsh-remote-files",
|
|
@@ -1637,7 +1640,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1637
1640
|
supports: () => !0,
|
|
1638
1641
|
saveAsAllowed: () => ({
|
|
1639
1642
|
allowed: currentSaveAsAllowed(options.saveAsAllowed),
|
|
1640
|
-
maxBytes: options.saveAsMaxBytes
|
|
1643
|
+
maxBytes: currentSaveAsMaxBytes(options.saveAsMaxBytes)
|
|
1641
1644
|
}),
|
|
1642
1645
|
async stat(locator, signal) {
|
|
1643
1646
|
let value = await call("fileviewer.stat", { path: locator }, signal);
|
|
@@ -1681,6 +1684,9 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1681
1684
|
function currentSaveAsAllowed(value) {
|
|
1682
1685
|
return typeof value == "function" ? value() : value === !0;
|
|
1683
1686
|
}
|
|
1687
|
+
function currentSaveAsMaxBytes(value) {
|
|
1688
|
+
return typeof value == "function" ? value() : value ?? REMOTE_FILE_SAVE_AS_MAX_BYTES;
|
|
1689
|
+
}
|
|
1684
1690
|
function decodeBase64(value) {
|
|
1685
1691
|
let binary = atob(value), bytes = new Uint8Array(binary.length);
|
|
1686
1692
|
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
@@ -1737,6 +1743,8 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1737
1743
|
switchTarget: "Switch Local / Remote Harness target",
|
|
1738
1744
|
harnessTarget: "Harness target",
|
|
1739
1745
|
close: "Close",
|
|
1746
|
+
refreshRemote: "Refresh remote hosts",
|
|
1747
|
+
refreshRemoteShort: "Refresh",
|
|
1740
1748
|
local: "Local",
|
|
1741
1749
|
remoteTarget: "Remote \xB7 {name}",
|
|
1742
1750
|
thisMachineLocal: "This machine (Local)",
|
|
@@ -1932,6 +1940,8 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1932
1940
|
switchTarget: "\u5207\u6362\u672C\u5730\u6216\u8FDC\u7A0B Harness",
|
|
1933
1941
|
harnessTarget: "Harness \u76EE\u6807",
|
|
1934
1942
|
close: "\u5173\u95ED",
|
|
1943
|
+
refreshRemote: "\u5237\u65B0\u8FDC\u7A0B\u4E3B\u673A",
|
|
1944
|
+
refreshRemoteShort: "\u5237\u65B0",
|
|
1935
1945
|
local: "\u672C\u5730",
|
|
1936
1946
|
remoteTarget: "\u8FDC\u7A0B \xB7 {name}",
|
|
1937
1947
|
thisMachineLocal: "\u6B64\u8BBE\u5907\uFF08\u672C\u5730\uFF09",
|
|
@@ -2070,7 +2080,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2070
2080
|
signInClientDescription: "\u4E00\u6B21\u8FDE\u63A5\uFF0C\u968F\u65F6\u53EF\u7528\u3002",
|
|
2071
2081
|
startSignIn: "\u5F00\u59CB\u767B\u5F55",
|
|
2072
2082
|
allowControlCurrentDevice: "\u5141\u8BB8\u63A7\u5236\u5F53\u524D\u8BBE\u5907",
|
|
2073
|
-
exitRemoteAccount: "\u9000\u51FA",
|
|
2083
|
+
exitRemoteAccount: "\u9000\u51FA\u8D26\u53F7",
|
|
2074
2084
|
githubLogin: "GitHub \u626B\u7801",
|
|
2075
2085
|
zhihuLogin: "\u77E5\u4E4E\u626B\u7801",
|
|
2076
2086
|
scanWithGitHub: "\u4F7F\u7528 GitHub \u626B\u7801\u767B\u5F55",
|
|
@@ -2454,7 +2464,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2454
2464
|
);
|
|
2455
2465
|
}
|
|
2456
2466
|
function RemoteWorkspaceAction(props) {
|
|
2457
|
-
let { t } = props, [open, setOpen] = React.useState(!1), [status, setStatus] = React.useState(void 0), [devices, setDevices] = React.useState([]), [selectedHost, setSelectedHost] = React.useState(void 0), [workspaces, setWorkspaces] = React.useState([]), [directory, setDirectory] = React.useState(void 0), [path, setPath] = React.useState(""), [addingWorkspace, setAddingWorkspace] = React.useState(!1), [busy, setBusy] = React.useState(!1), [needsAuthorization, setNeedsAuthorization] = React.useState(!1), [email, setEmail] = React.useState(""), [password, setPassword] = React.useState(""), [loginMethod, setLoginMethod] = React.useState(props.preferredQrProvider), [loginMethodManuallySelected, setLoginMethodManuallySelected] = React.useState(!1), [qrSession, setQrSession] = React.useState(void 0), [qrImage, setQrImage] = React.useState(void 0), [qrExpired, setQrExpired] = React.useState(!1), [progress, setProgress] = React.useState(void 0), progressRun = React.useRef(0), [notice, setNotice] = React.useState(void 0), [error, setError] = React.useState(void 0);
|
|
2467
|
+
let { t } = props, [open, setOpen] = React.useState(!1), [status, setStatus] = React.useState(void 0), [devices, setDevices] = React.useState([]), [selectedHost, setSelectedHost] = React.useState(void 0), [workspaces, setWorkspaces] = React.useState([]), [directory, setDirectory] = React.useState(void 0), [path, setPath] = React.useState(""), [addingWorkspace, setAddingWorkspace] = React.useState(!1), [busy, setBusy] = React.useState(!1), [needsAuthorization, setNeedsAuthorization] = React.useState(!1), [email, setEmail] = React.useState(""), [password, setPassword] = React.useState(""), [loginMethod, setLoginMethod] = React.useState(props.preferredQrProvider), [loginMethodManuallySelected, setLoginMethodManuallySelected] = React.useState(!1), [qrSession, setQrSession] = React.useState(void 0), [qrImage, setQrImage] = React.useState(void 0), [qrExpired, setQrExpired] = React.useState(!1), [progress, setProgress] = React.useState(void 0), progressRun = React.useRef(0), qrFlowRun = React.useRef(0), [notice, setNotice] = React.useState(void 0), [error, setError] = React.useState(void 0);
|
|
2458
2468
|
React.useEffect(() => {
|
|
2459
2469
|
if (!open) return;
|
|
2460
2470
|
let closeOnEscape = (event) => {
|
|
@@ -2471,6 +2481,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2471
2481
|
};
|
|
2472
2482
|
}, [status?.mode]);
|
|
2473
2483
|
let startQrLogin = async (provider) => {
|
|
2484
|
+
let run = ++qrFlowRun.current;
|
|
2474
2485
|
setBusy(!0), setError(void 0), setQrExpired(!1);
|
|
2475
2486
|
try {
|
|
2476
2487
|
let session = await props.control("client.account.qr.start", { provider }), image = await import_qrcode.default.toDataURL(session.scanUrl, {
|
|
@@ -2478,34 +2489,49 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2478
2489
|
margin: 1,
|
|
2479
2490
|
errorCorrectionLevel: "L"
|
|
2480
2491
|
});
|
|
2492
|
+
if (run !== qrFlowRun.current) return;
|
|
2481
2493
|
setQrSession(session), setQrImage(image);
|
|
2482
2494
|
} catch (reason) {
|
|
2483
|
-
setError(messageOf(reason));
|
|
2495
|
+
run === qrFlowRun.current && setError(messageOf(reason));
|
|
2484
2496
|
} finally {
|
|
2485
|
-
setBusy(!1);
|
|
2497
|
+
run === qrFlowRun.current && setBusy(!1);
|
|
2486
2498
|
}
|
|
2487
2499
|
};
|
|
2488
2500
|
React.useEffect(() => {
|
|
2489
2501
|
!open || !needsAuthorization || loginMethod === "password" || qrSession !== void 0 || qrExpired || startQrLogin(loginMethod);
|
|
2490
2502
|
}, [open, needsAuthorization, loginMethod, qrSession, qrExpired]), React.useEffect(() => {
|
|
2491
2503
|
if (!open || loginMethod === "password" || qrSession === void 0) return;
|
|
2492
|
-
let active = !0, poll = () => {
|
|
2493
|
-
props.control("client.account.qr.poll", { qrId: qrSession.qrId }).then(async (result) => {
|
|
2494
|
-
|
|
2504
|
+
let active = !0, polling = !1, settled = !1, run = qrFlowRun.current, timer, poll = () => {
|
|
2505
|
+
polling || settled || (polling = !0, props.control("client.account.qr.poll", { qrId: qrSession.qrId }).then(async (result) => {
|
|
2506
|
+
if (!(!active || settled || run !== qrFlowRun.current))
|
|
2507
|
+
if (result.status === "complete") {
|
|
2508
|
+
settled = !0, timer !== void 0 && window.clearInterval(timer), setBusy(!0), setError(void 0), setQrExpired(!1), setNeedsAuthorization(!1);
|
|
2509
|
+
try {
|
|
2510
|
+
let [nextDevices, nextStatus] = await Promise.all([
|
|
2511
|
+
props.control("devices"),
|
|
2512
|
+
props.control("status")
|
|
2513
|
+
]);
|
|
2514
|
+
active && run === qrFlowRun.current && (setDevices(nextDevices), setStatus(nextStatus));
|
|
2515
|
+
} catch (reason) {
|
|
2516
|
+
active && run === qrFlowRun.current && setError(messageOf(reason));
|
|
2517
|
+
} finally {
|
|
2518
|
+
run === qrFlowRun.current && (setQrSession(void 0), setQrImage(void 0), setBusy(!1));
|
|
2519
|
+
}
|
|
2520
|
+
} else result.status === "expired" && (settled = !0, timer !== void 0 && window.clearInterval(timer), setQrExpired(!0), setQrSession(void 0), setQrImage(void 0));
|
|
2495
2521
|
}).catch((reason) => {
|
|
2496
|
-
active && setError(messageOf(reason));
|
|
2497
|
-
})
|
|
2522
|
+
active && !settled && run === qrFlowRun.current && setError(messageOf(reason));
|
|
2523
|
+
}).finally(() => {
|
|
2524
|
+
polling = !1;
|
|
2525
|
+
}));
|
|
2498
2526
|
};
|
|
2499
|
-
poll()
|
|
2500
|
-
|
|
2501
|
-
return () => {
|
|
2502
|
-
active = !1, window.clearInterval(timer);
|
|
2527
|
+
return poll(), timer = window.setInterval(poll, 1500), () => {
|
|
2528
|
+
active = !1, timer !== void 0 && window.clearInterval(timer);
|
|
2503
2529
|
};
|
|
2504
2530
|
}, [open, loginMethod, qrSession]), React.useEffect(() => {
|
|
2505
|
-
loginMethodManuallySelected || loginMethod === props.preferredQrProvider || (setLoginMethod(props.preferredQrProvider), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2531
|
+
loginMethodManuallySelected || loginMethod === props.preferredQrProvider || (qrFlowRun.current += 1, setLoginMethod(props.preferredQrProvider), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2506
2532
|
}, [props.preferredQrProvider, loginMethodManuallySelected]);
|
|
2507
2533
|
let selectLoginMethod = (method) => {
|
|
2508
|
-
setLoginMethodManuallySelected(!0), method !== loginMethod && (setLoginMethod(method), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2534
|
+
setLoginMethodManuallySelected(!0), method !== loginMethod && (qrFlowRun.current += 1, setLoginMethod(method), setQrSession(void 0), setQrImage(void 0), setQrExpired(!1), setError(void 0));
|
|
2509
2535
|
}, orderedQrProviders = props.preferredQrProvider === "zhihu" ? ["zhihu", "github"] : ["github", "zhihu"], qrLoginTab = (provider) => React.createElement("button", {
|
|
2510
2536
|
key: provider,
|
|
2511
2537
|
type: "button",
|
|
@@ -2551,21 +2577,30 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2551
2577
|
setBusy(!1);
|
|
2552
2578
|
}
|
|
2553
2579
|
}
|
|
2554
|
-
},
|
|
2555
|
-
|
|
2580
|
+
}, refreshRemote = async () => {
|
|
2581
|
+
setBusy(!0), setNotice(void 0), setError(void 0);
|
|
2556
2582
|
try {
|
|
2557
2583
|
let nextStatus = await props.control("status");
|
|
2558
|
-
if (setStatus(nextStatus), nextStatus.available)
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2584
|
+
if (setStatus(nextStatus), !nextStatus.available) {
|
|
2585
|
+
setDevices([]), setNeedsAuthorization(!1), setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0);
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
try {
|
|
2589
|
+
let nextDevices = await props.control("devices");
|
|
2590
|
+
if (setDevices(nextDevices), setNeedsAuthorization(!1), selectedHost !== void 0) {
|
|
2591
|
+
let nextSelectedHost = nextDevices.find((device) => device.deviceId === selectedHost.deviceId);
|
|
2592
|
+
nextSelectedHost === void 0 ? (setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0)) : setSelectedHost(nextSelectedHost);
|
|
2563
2593
|
}
|
|
2594
|
+
} catch {
|
|
2595
|
+
setDevices([]), setNeedsAuthorization(!0), setSelectedHost(void 0), setWorkspaces([]), setPath(""), setAddingWorkspace(!1), setDirectory(void 0);
|
|
2596
|
+
}
|
|
2564
2597
|
} catch (reason) {
|
|
2565
2598
|
setError(messageOf(reason));
|
|
2566
2599
|
} finally {
|
|
2567
2600
|
setBusy(!1);
|
|
2568
2601
|
}
|
|
2602
|
+
}, show = async () => {
|
|
2603
|
+
setOpen(!0), await refreshRemote();
|
|
2569
2604
|
}, signInClient = async () => {
|
|
2570
2605
|
if (!(email.trim() === "" || password === "")) {
|
|
2571
2606
|
setBusy(!0), setError(void 0);
|
|
@@ -2673,7 +2708,19 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
2673
2708
|
React.createElement("strong", null, t("remoteTitle")),
|
|
2674
2709
|
React.createElement("p", null, t("remoteDescription"))
|
|
2675
2710
|
),
|
|
2676
|
-
React.createElement(
|
|
2711
|
+
React.createElement(
|
|
2712
|
+
"div",
|
|
2713
|
+
{ className: "dshRemotePageActions" },
|
|
2714
|
+
React.createElement("button", {
|
|
2715
|
+
type: "button",
|
|
2716
|
+
className: "dshRemotePageRefresh",
|
|
2717
|
+
disabled: busy,
|
|
2718
|
+
title: t("refreshRemote"),
|
|
2719
|
+
"aria-label": t("refreshRemote"),
|
|
2720
|
+
onClick: () => void refreshRemote()
|
|
2721
|
+
}, t("refreshRemoteShort")),
|
|
2722
|
+
React.createElement("button", { type: "button", onClick: () => setOpen(!1), "aria-label": t("close") }, "\xD7")
|
|
2723
|
+
)
|
|
2677
2724
|
),
|
|
2678
2725
|
React.createElement(
|
|
2679
2726
|
"main",
|
|
@@ -3273,7 +3320,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3273
3320
|
".dshRemoteSessionHeader{left:auto;right:148px;transform:none;max-width:calc(100vw - 420px)}@media(max-width:760px){.dshRemoteSessionHeader{left:auto;right:104px;transform:none;max-width:calc(100vw - 124px)}}",
|
|
3274
3321
|
".dshRemoteModeButton:focus-visible,.dshRemotePage button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}",
|
|
3275
3322
|
".dshRemotePage{width:min(720px,100%);max-height:min(760px,calc(100vh - 40px));display:flex;flex-direction:column;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:14px;overflow:hidden;animation:dshRemotePageIn .18s cubic-bezier(.25,1,.5,1)}",
|
|
3276
|
-
".dshRemotePageHeader{min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:24px;padding:14px 24px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemotePageIntro{min-width:0;flex:1}.dshRemotePageHeader strong{display:block;font-size:18px;line-height:1.4}.dshRemotePageHeader p{min-width:0;max-width:70ch;margin:3px 0 0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}.
|
|
3323
|
+
".dshRemotePageHeader{min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:24px;padding:14px 24px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemotePageIntro{min-width:0;flex:1}.dshRemotePageHeader strong{display:block;font-size:18px;line-height:1.4}.dshRemotePageHeader p{min-width:0;max-width:70ch;margin:3px 0 0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}.dshRemotePageActions{flex:0 0 auto;display:flex;align-items:center;gap:4px}.dshRemotePageActions>button{height:40px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;border:0;border-radius:8px;background:transparent;color:inherit;line-height:1;cursor:pointer}.dshRemotePageActions>button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.dshRemotePageActions>button:disabled{opacity:.45;cursor:default}.dshRemotePageRefresh{min-width:48px;padding:0 10px;font:inherit;font-size:13px}.dshRemotePageActions>button:not(.dshRemotePageRefresh){width:40px;padding:0;font-size:24px}",
|
|
3277
3324
|
".dshRemotePageBody{padding:24px;overflow:auto;display:flex;flex-direction:column;gap:24px}.dshRemotePageBody button{font:inherit;color:inherit}",
|
|
3278
3325
|
".dshRemoteSectionHeading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:10px}.dshRemoteSectionTitle{min-width:0;display:flex;align-items:center;gap:10px}.dshRemoteSectionTitle>strong{font-size:14px}.dshRemoteSectionActions{display:flex;align-items:center;gap:14px}.dshRemoteSectionActions>button{border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;padding:5px 0;font-size:12px}.dshRemoteSectionActions>button:hover:not(:disabled){color:var(--dsw-alias-label-primary);text-decoration:underline}",
|
|
3279
3326
|
".dshRemoteSectionHeading>.dshRemoteAddWorkspace{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:50%;font-size:20px;line-height:1}.dshRemoteSectionHeading>.dshRemoteAddWorkspace:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",
|
|
@@ -3285,11 +3332,11 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3285
3332
|
".dshRemoteFolderBrowser{margin-top:14px}.dshRemoteFolderBrowser>p,.dshRemoteFolderList>p{margin:12px 0;color:var(--dsw-alias-label-secondary);font-size:13px}.dshRemoteFolderList{max-height:260px;overflow:auto;border-block:1px solid var(--dsw-alias-border-l2)}.dshRemoteFolderList>button{width:100%;min-height:42px;display:flex;align-items:center;gap:9px;border:0;border-bottom:1px solid var(--dsw-alias-border-l2);background:transparent;padding:7px 6px;text-align:left;cursor:pointer}.dshRemoteFolderList>button:hover{background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteFolderBrowser>small{display:block;margin-top:8px;color:var(--dsw-alias-state-warn-label)}",
|
|
3286
3333
|
".dshRemotePathField{display:flex;flex-direction:column;gap:6px;margin-top:20px}.dshRemotePathField>span{font-size:13px;font-weight:600}.dshRemotePathField>input{min-height:40px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:inherit;padding:0 12px;font:inherit}.dshRemotePathField>small{color:var(--dsw-alias-label-secondary)}",
|
|
3287
3334
|
".dshRemoteOpenBar{position:sticky;bottom:-96px;display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:20px;padding:14px 0;background:var(--dsw-alias-bg-layer-1);border-top:1px solid var(--dsw-alias-border-l2)}.dshRemoteOpenBar>div{min-width:0;display:flex;flex-direction:column;gap:3px}.dshRemoteOpenBar span{color:var(--dsw-alias-label-secondary);font-size:12px}.dshRemoteOpenBar strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.dshRemoteOpenBar>button,.dshRemoteEnable>button{min-height:40px;flex:0 0 auto;border:0;border-radius:8px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-1);padding:8px 16px;cursor:pointer}.dshRemoteOpenBar>button:disabled,.dshRemoteEnable>button:disabled{opacity:.5;cursor:default}",
|
|
3288
|
-
".dshRemoteEnable{max-width:
|
|
3335
|
+
".dshRemoteEnable{box-sizing:border-box;width:min(440px,100%);max-width:100%;min-height:388px;margin:0 auto;display:flex;flex-direction:column;align-items:stretch;gap:10px}.dshRemoteEnable p{margin:0;color:var(--dsw-alias-label-secondary);line-height:1.5}",
|
|
3289
3336
|
'.dshRemoteLoginTabs{width:min(440px,100%);display:flex;border-bottom:1px solid var(--dsw-alias-border-l2)}.dshRemoteLoginTabs>button{position:relative;min-height:38px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:6px 14px;font:inherit;font-size:13px;cursor:pointer}.dshRemoteLoginTabs>button:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshRemoteLoginTabs>button.isActive{color:var(--dsw-alias-label-primary);font-weight:600}.dshRemoteLoginTabs>button.isActive::after{content:"";position:absolute;right:12px;bottom:-1px;left:12px;height:2px;border-radius:2px 2px 0 0;background:var(--dsw-alias-brand-primary)}.dshRemoteLoginTabs>button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px;border-radius:6px}',
|
|
3290
3337
|
".dshRemoteClientLogin{width:min(440px,100%);display:flex;flex-direction:column;gap:8px}.dshRemoteClientLogin input{min-height:40px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:inherit;padding:0 12px;font:inherit}.dshRemoteClientLogin button{align-self:flex-start;min-height:40px;border:0;border-radius:8px;background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-1);padding:8px 16px;cursor:pointer}",
|
|
3291
3338
|
".dshRemoteQrLogin{width:min(440px,100%);display:flex;flex-direction:column;align-items:center;gap:8px;padding:6px 0 2px;text-align:center}.dshRemoteQrLogin img,.dshRemoteQrPlaceholder{box-sizing:border-box;width:200px;height:200px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:#fff;padding:8px}.dshRemoteQrOpen{display:flex;flex-direction:column;align-items:center;gap:5px;color:var(--dsw-alias-label-secondary);font-size:12px;text-decoration:none}.dshRemoteQrOpen:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteQrOpen:hover img{border-color:var(--dsw-alias-label-dimmed)}.dshRemoteQrOpen:focus-visible{border-radius:12px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.dshRemoteQrPlaceholder{display:flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-secondary)}.dshRemoteQrLogin>strong{font-size:14px}.dshRemoteQrLogin>p{max-width:48ch;margin:0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5}.dshRemoteQrLogin>.dshRemoteServiceAddress{margin-top:2px;color:var(--dsw-alias-label-tertiary)}.dshRemoteServiceAddress>a{color:var(--dsw-alias-label-secondary);text-decoration:none}.dshRemoteServiceAddress>a:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteQrLogin>button,.dshRemoteClientLogin>.dshRemoteLoginSwitch{min-height:32px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:4px 8px;font:inherit;font-size:12px;cursor:pointer}.dshRemoteQrLogin>button:hover,.dshRemoteClientLogin>.dshRemoteLoginSwitch:hover{color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteClientLogin>.dshRemoteLoginSwitch{align-self:flex-start;background:transparent;color:var(--dsw-alias-label-secondary);padding-left:0}",
|
|
3292
|
-
".
|
|
3339
|
+
".dshRemoteLoginHeading{box-sizing:border-box;width:100%;display:flex;align-items:baseline;gap:10px;overflow:hidden;white-space:nowrap}.dshRemoteLoginTitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dshRemoteLoginHeading>span{flex:0 0 auto;color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:400}.dshRemoteLoginTabs{box-sizing:border-box;width:100%}.dshRemoteLoginTabs>button{min-width:0;flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.dshRemoteLoginTabs>button.isActive::after{right:0;left:0;border-radius:0}.dshRemoteClientLogin,.dshRemoteQrLogin{box-sizing:border-box;width:100%;height:300px;min-height:300px}.dshRemoteClientLogin{align-items:stretch;padding-top:16px}.dshRemoteClientLogin>button{align-self:stretch;width:100%}.dshRemoteQrLogin{padding-top:12px}",
|
|
3293
3340
|
'.dshRemoteHostControlToggle{display:flex;align-items:center;gap:7px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;white-space:nowrap;cursor:default}.dshRemoteHostControlToggle>input{appearance:none;box-sizing:border-box;position:relative;width:32px;height:18px;flex:0 0 auto;margin:0;border:1px solid var(--dsw-alias-label-secondary);border-radius:999px;background:var(--dsw-alias-bg-layer-3);cursor:pointer;box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2);transition:background .16s ease-out,border-color .16s ease-out,box-shadow .16s ease-out}.dshRemoteHostControlToggle>input::after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:var(--dsw-alias-label-secondary);transition:transform .16s ease-out,background .16s ease-out}.dshRemoteHostControlToggle>input:checked{border-color:var(--dsw-alias-state-success-primary);background:var(--dsw-alias-state-success-primary);box-shadow:none}.dshRemoteHostControlToggle>input:checked::after{transform:translateX(14px);background:var(--dsw-alias-bg-layer-1)}.dshRemoteHostControlToggle>input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.dshRemoteHostControlToggle>input:disabled{opacity:.5;cursor:default}@media(prefers-reduced-motion:reduce){.dshRemoteHostControlToggle>input,.dshRemoteHostControlToggle>input::after{transition:none}}',
|
|
3294
3341
|
".dshRemoteAccountExit{flex:0 0 auto;border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;padding:5px 0;font-size:12px;line-height:1.5;white-space:nowrap}.dshRemoteAccountExit:hover:not(:disabled){color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteAccountExit:disabled{opacity:.5;cursor:default;text-decoration:none}",
|
|
3295
3342
|
".dshRemoteLocalLink{align-self:flex-start;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:4px 0;cursor:pointer}.dshRemoteLocalLink:hover{color:var(--dsw-alias-label-primary)}",
|
|
@@ -3354,15 +3401,15 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
3354
3401
|
}, "ds-harness-remote: resume selected workspace"), ctx.inject(["fileViewer"], (fileViewerContext) => {
|
|
3355
3402
|
let viewer = fileViewerContext.get("fileViewer");
|
|
3356
3403
|
viewer !== void 0 && fileViewerContext.effect(() => {
|
|
3357
|
-
let active = !0, unregister, latestSaveAsAllowed = !1, sync = async () => {
|
|
3404
|
+
let active = !0, unregister, latestSaveAsAllowed = !1, latestSaveAsMaxBytes = REMOTE_FILE_SAVE_AS_MAX_BYTES, sync = async () => {
|
|
3358
3405
|
try {
|
|
3359
3406
|
let status = await control("status");
|
|
3360
3407
|
if (!active) return;
|
|
3361
3408
|
let supported = shouldUseRemoteFileViewer(status);
|
|
3362
|
-
latestSaveAsAllowed = shouldAllowRemoteFileSaveAs(status), supported && unregister === void 0 ? unregister = viewer.registerContentProvider(createRemoteFileContentProvider(
|
|
3409
|
+
latestSaveAsAllowed = shouldAllowRemoteFileSaveAs(status), latestSaveAsMaxBytes = remoteFileSaveAsMaxBytes(status), supported && unregister === void 0 ? unregister = viewer.registerContentProvider(createRemoteFileContentProvider(
|
|
3363
3410
|
(endpoint, payload) => control(endpoint, payload),
|
|
3364
|
-
{ saveAsAllowed: () => latestSaveAsAllowed, saveAsMaxBytes:
|
|
3365
|
-
)) : !supported && unregister !== void 0 && (unregister(), unregister = void 0, latestSaveAsAllowed = !1);
|
|
3411
|
+
{ saveAsAllowed: () => latestSaveAsAllowed, saveAsMaxBytes: () => latestSaveAsMaxBytes }
|
|
3412
|
+
)) : !supported && unregister !== void 0 && (unregister(), unregister = void 0, latestSaveAsAllowed = !1, latestSaveAsMaxBytes = REMOTE_FILE_SAVE_AS_MAX_BYTES);
|
|
3366
3413
|
} catch {
|
|
3367
3414
|
}
|
|
3368
3415
|
};
|