mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 12:40:44 +08:00
Fix WebCRT Quick Connect stuck on authenticating.
New-session path filled wsUrl after mount, remounting the terminal and dropping the connect wait WS. Mint tickets from sessionId only and ignore late wsUrl changes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fb3da4dfc7
commit
e684339511
2 changed files with 10 additions and 9 deletions
|
|
@ -715,8 +715,10 @@ export const WebTerminal = forwardRef<WebTerminalHandle, Props>(function WebTerm
|
||||||
termRef.current = null;
|
termRef.current = null;
|
||||||
fitRef.current = null;
|
fitRef.current = null;
|
||||||
};
|
};
|
||||||
// Fresh ticket per mount when sessionId is set; wsUrl is fallback only.
|
// Fresh ticket per mount when sessionId is set. Do not re-run when a late
|
||||||
}, [wsUrl, sessionId]);
|
// parent wsUrl fill-in arrives — that remount dropped the wait-loop WS and
|
||||||
|
// left Quick Connect stuck on "authenticating".
|
||||||
|
}, [sessionId || wsUrl]);
|
||||||
|
|
||||||
const pasteFromClipboard = async () => {
|
const pasteFromClipboard = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import {
|
||||||
webcrtSftpRemove,
|
webcrtSftpRemove,
|
||||||
webcrtSftpRename,
|
webcrtSftpRename,
|
||||||
webcrtSftpUpload,
|
webcrtSftpUpload,
|
||||||
webcrtWsUrl,
|
|
||||||
type WebcrtSftpItem,
|
type WebcrtSftpItem,
|
||||||
} from "../services/api";
|
} from "../services/api";
|
||||||
import { pageCount } from "../utils/display";
|
import { pageCount } from "../utils/display";
|
||||||
|
|
@ -887,6 +886,8 @@ export function WebcrtPage() {
|
||||||
) => {
|
) => {
|
||||||
const key = targetKey(target);
|
const key = targetKey(target);
|
||||||
const existing = tabsRef.current.find((tab) => tab.key === key);
|
const existing = tabsRef.current.find((tab) => tab.key === key);
|
||||||
|
// WebTerminal mints its own ws_ticket from sessionId; leave wsUrl empty so a
|
||||||
|
// late ticket fill-in cannot remount the terminal mid-connect (Quick Connect).
|
||||||
const pending: TermTab = {
|
const pending: TermTab = {
|
||||||
key,
|
key,
|
||||||
sessionId,
|
sessionId,
|
||||||
|
|
@ -906,12 +907,9 @@ export function WebcrtPage() {
|
||||||
return [...without, pending];
|
return [...without, pending];
|
||||||
});
|
});
|
||||||
setActiveTabKey(key);
|
setActiveTabKey(key);
|
||||||
void webcrtWsUrl(sessionId).then((wsUrl) => {
|
|
||||||
updateTab(key, { wsUrl });
|
|
||||||
});
|
|
||||||
showOk(t("webcrt.opened", { name: deviceLabel(target) }));
|
showOk(t("webcrt.opened", { name: deviceLabel(target) }));
|
||||||
},
|
},
|
||||||
[showOk, t, updateTab],
|
[showOk, t],
|
||||||
);
|
);
|
||||||
|
|
||||||
const openAuthForTarget = useCallback((target: CliTargetItem, errorHint?: string) => {
|
const openAuthForTarget = useCallback((target: CliTargetItem, errorHint?: string) => {
|
||||||
|
|
@ -1003,11 +1001,12 @@ export function WebcrtPage() {
|
||||||
keepalive_sec: keepaliveSec,
|
keepalive_sec: keepaliveSec,
|
||||||
async_connect: true,
|
async_connect: true,
|
||||||
};
|
};
|
||||||
|
// Prefer sessionId; WebTerminal mints a fresh ticket on mount.
|
||||||
|
// Avoid a second updateTab({wsUrl}) — that remounted the terminal mid-connect.
|
||||||
const sess = await createWebcrtSession(body);
|
const sess = await createWebcrtSession(body);
|
||||||
const wsUrl = await webcrtWsUrl(sess.session_id);
|
|
||||||
updateTab(key, {
|
updateTab(key, {
|
||||||
sessionId: sess.session_id,
|
sessionId: sess.session_id,
|
||||||
wsUrl,
|
wsUrl: "",
|
||||||
status: "connecting",
|
status: "connecting",
|
||||||
connectPhase: "authenticating",
|
connectPhase: "authenticating",
|
||||||
termEpoch: pending.termEpoch + 1,
|
termEpoch: pending.termEpoch + 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue