mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 14:10:44 +08:00
Reuse SSH for WebCRT SFTP and fix folder navigation UX.
Open SFTP on the live session transport after SSH connect, pass the target path on every list refresh, and use folder/file icons in the browser panel. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d87bdf4be1
commit
499b4cc2a1
10 changed files with 525 additions and 131 deletions
|
|
@ -69,7 +69,12 @@ type Props = {
|
|||
pasteDelayMs?: number;
|
||||
copyOnSelect?: boolean;
|
||||
keywordHighlight?: KeywordHighlightConfig;
|
||||
onStatus?: (state: string, message?: string, phase?: string) => void;
|
||||
onStatus?: (
|
||||
state: string,
|
||||
message?: string,
|
||||
phase?: string,
|
||||
meta?: { sftpReady?: boolean; cliHop?: boolean },
|
||||
) => void;
|
||||
onReady?: () => void;
|
||||
onStdout?: (data: string) => void;
|
||||
};
|
||||
|
|
@ -481,6 +486,8 @@ export const WebTerminal = forwardRef<WebTerminalHandle, Props>(function WebTerm
|
|||
state?: string;
|
||||
message?: string;
|
||||
phase?: string;
|
||||
sftp_ready?: boolean;
|
||||
cli_hop?: boolean;
|
||||
};
|
||||
if (msg.type === "stdout" && typeof msg.data === "string") {
|
||||
writeStdout(msg.data);
|
||||
|
|
@ -490,7 +497,14 @@ export const WebTerminal = forwardRef<WebTerminalHandle, Props>(function WebTerm
|
|||
if (msg.type === "status") {
|
||||
if (!isActiveSocket()) return;
|
||||
const phase = typeof msg.phase === "string" ? msg.phase : undefined;
|
||||
onStatusRef.current?.(String(msg.state || ""), msg.message, phase);
|
||||
const meta =
|
||||
typeof msg.sftp_ready === "boolean" || typeof msg.cli_hop === "boolean"
|
||||
? {
|
||||
sftpReady: typeof msg.sftp_ready === "boolean" ? msg.sftp_ready : undefined,
|
||||
cliHop: typeof msg.cli_hop === "boolean" ? msg.cli_hop : undefined,
|
||||
}
|
||||
: undefined;
|
||||
onStatusRef.current?.(String(msg.state || ""), msg.message, phase, meta);
|
||||
if (msg.state === "connected" || msg.state === "connecting") {
|
||||
maybeFocus();
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue