From bd97e1b875cfe3eaad6f97b9c59a6747d2acc9f6 Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 4 Aug 2026 10:40:22 +0800 Subject: [PATCH] Reuse stored managed-NE credentials when opening WebCRT from topology. Deep-link open was missing has_password/protocol, so SSH always prompted for login. Co-authored-by: Cursor --- netx_api/ne_schemas.py | 2 ++ netx_api/ne_service_common.py | 1 + web/src/pages/WebcrtPage.tsx | 4 ++++ web/src/types.ts | 2 ++ 4 files changed, 9 insertions(+) diff --git a/netx_api/ne_schemas.py b/netx_api/ne_schemas.py index da4b22b..2ee5800 100644 --- a/netx_api/ne_schemas.py +++ b/netx_api/ne_schemas.py @@ -89,6 +89,8 @@ class ManagedNeOut(BaseModel): port: int protocol: str username: str + # True when a non-empty password ciphertext is stored (never returns the secret). + has_password: bool = False connect_status: ConnectStatus connect_message: str connect_detail: str = "" diff --git a/netx_api/ne_service_common.py b/netx_api/ne_service_common.py index 1e189e9..5b94704 100644 --- a/netx_api/ne_service_common.py +++ b/netx_api/ne_service_common.py @@ -201,6 +201,7 @@ def row_to_out(row: ManagedNE) -> ManagedNeOut: port=int(row.port or 22), protocol=str(row.protocol or "ssh"), username=str(row.username or ""), + has_password=bool(str(row.password_enc or "").strip()), connect_status=status, # type: ignore[arg-type] connect_message=str(row.connect_message or "")[:500], connect_detail=str(row.connect_detail or "")[:8000], diff --git a/web/src/pages/WebcrtPage.tsx b/web/src/pages/WebcrtPage.tsx index 9619a32..d482e1e 100644 --- a/web/src/pages/WebcrtPage.tsx +++ b/web/src/pages/WebcrtPage.tsx @@ -1901,6 +1901,10 @@ export function WebcrtPage() { ip_address: row.ip_address, vendor: row.vendor, device_type: row.device_type, + protocol: row.protocol || "ssh", + username: row.username || "", + has_password: Boolean(row.has_password), + hop_enabled: Boolean(row.hop_enabled), connect_status: row.connect_status, cli_profile_ready: true, }); diff --git a/web/src/types.ts b/web/src/types.ts index 3c3a491..8119d43 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -182,6 +182,8 @@ export type ManagedNeItem = { port: number; protocol: string; username: string; + /** True when a password is stored server-side (secret never returned). */ + has_password?: boolean; connect_status: ConnectStatus; connect_message: string; connect_detail: string;