From 173a83aafad4e549dcd3dbccdaf7b654adeea4b4 Mon Sep 17 00:00:00 2001 From: lateautumn233 Date: Tue, 2 Jun 2026 23:20:42 +0800 Subject: [PATCH] Extend HostProtocol union and host models with ET fields Add 'et' to HostProtocol union type. Add etEnabled, etPort, and etTerminalPath fields to Host and GroupConfig interfaces. Update vaultImport type guards to exclude 'et' from importable protocols. Register ET fields in groupConfig inheritable keys. --- domain/groupConfig.ts | 1 + domain/models/connection.ts | 8 +++++++- domain/models/history.ts | 2 +- domain/models/terminal.ts | 1 + domain/vaultImport.ts | 12 ++++++------ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/domain/groupConfig.ts b/domain/groupConfig.ts index ab6a12da..1af2fc96 100644 --- a/domain/groupConfig.ts +++ b/domain/groupConfig.ts @@ -89,6 +89,7 @@ const INHERITABLE_KEYS: (keyof GroupConfig)[] = [ 'port', 'protocol', 'agentForwarding', 'proxyProfileId', 'proxyConfig', 'hostChain', 'startupCommand', 'legacyAlgorithms', 'skipEcdsaHostKey', 'algorithms', 'environmentVariables', 'charset', 'moshEnabled', 'moshServerPath', + 'etEnabled', 'etPort', 'telnetEnabled', 'telnetPort', 'telnetUsername', 'telnetPassword', 'theme', 'themeOverride', 'fontFamily', 'fontFamilyOverride', 'fontSize', 'fontSizeOverride', 'fontWeight', 'fontWeightOverride', 'backspaceBehavior', diff --git a/domain/models/connection.ts b/domain/models/connection.ts index 34acf788..8e9327d7 100644 --- a/domain/models/connection.ts +++ b/domain/models/connection.ts @@ -46,7 +46,7 @@ export interface EnvVar { } // Protocol type for connections -export type HostProtocol = 'ssh' | 'telnet' | 'mosh' | 'local' | 'serial'; +export type HostProtocol = 'ssh' | 'telnet' | 'mosh' | 'et' | 'local' | 'serial'; // Serial port configuration export type SerialParity = 'none' | 'even' | 'odd' | 'mark' | 'space'; @@ -70,6 +70,8 @@ interface ProtocolConfig { enabled: boolean; // Mosh-specific moshServerPath?: string; + // EternalTerminal-specific + etPort?: number; // Protocol-specific theme override theme?: string; } @@ -114,6 +116,8 @@ export interface Host { charset?: string; moshEnabled?: boolean; moshServerPath?: string; // Custom mosh-server path (e.g., /usr/local/bin/mosh-server) + etEnabled?: boolean; + etPort?: number; // EternalTerminal server port (default: 2022) theme?: string; themeOverride?: boolean; // Explicitly override the global terminal theme for this host fontFamily?: string; // Terminal font family for this host @@ -261,6 +265,8 @@ export interface GroupConfig { charset?: string; moshEnabled?: boolean; moshServerPath?: string; + etEnabled?: boolean; + etPort?: number; telnetEnabled?: boolean; telnetPort?: number; telnetUsername?: string; diff --git a/domain/models/history.ts b/domain/models/history.ts index faffe0fd..59bfe7d1 100644 --- a/domain/models/history.ts +++ b/domain/models/history.ts @@ -29,7 +29,7 @@ export interface ConnectionLog { hostLabel: string; // Display label (e.g., 'Local Terminal' or host label) hostname: string; // Target hostname or 'localhost' username: string; // SSH username or system username - protocol: 'ssh' | 'telnet' | 'local' | 'mosh' | 'serial'; + protocol: 'ssh' | 'telnet' | 'local' | 'mosh' | 'et' | 'serial'; startTime: number; // Connection start timestamp endTime?: number; // Connection end timestamp (undefined if still active) localUsername: string; // System username of the local user diff --git a/domain/models/terminal.ts b/domain/models/terminal.ts index 7ee2af03..c58692c4 100644 --- a/domain/models/terminal.ts +++ b/domain/models/terminal.ts @@ -327,6 +327,7 @@ export interface TerminalSession { protocol?: 'ssh' | 'telnet' | 'local' | 'serial'; port?: number; moshEnabled?: boolean; + etEnabled?: boolean; shellType?: 'posix' | 'fish' | 'powershell' | 'cmd' | 'unknown'; charset?: string; // Connection-time charset override (e.g. for quick-connect serial) // Serial-specific connection settings diff --git a/domain/vaultImport.ts b/domain/vaultImport.ts index 88c04915..65a38dc8 100644 --- a/domain/vaultImport.ts +++ b/domain/vaultImport.ts @@ -119,7 +119,7 @@ const normalizeGroupPath = (raw: string | undefined): string | undefined => { const normalizeProtocol = ( raw: string | undefined, -): Exclude | undefined => { +): Exclude | undefined => { const s = raw?.trim().toLowerCase(); if (!s) return undefined; if (s === "ssh" || s === "ssh2" || s === "ssh-2") return "ssh"; @@ -154,7 +154,7 @@ const createHost = (input: { username?: string; password?: string; port?: number; - protocol?: Exclude; + protocol?: Exclude; group?: string; tags?: string[]; notes?: string; @@ -210,7 +210,7 @@ const looksLikeHostnameToken = (token: string): boolean => { const parseTarget = ( raw: string, -): { hostname: string; username?: string; port?: number; protocol?: Exclude } | null => { +): { hostname: string; username?: string; port?: number; protocol?: Exclude } | null => { const trimmed = raw.trim(); if (!trimmed) return null; @@ -380,7 +380,7 @@ const importFromPuttyReg = (text: string): VaultImportResult => { hostname?: string; username?: string; port?: number; - protocol?: Exclude; + protocol?: Exclude; }; const sessions: Session[] = []; @@ -698,7 +698,7 @@ const importFromSecureCrt = (text: string, fileName?: string): VaultImportResult hostname?: string; username?: string; port?: number; - protocol?: Exclude; + protocol?: Exclude; }; const sessions: Session[] = []; @@ -832,7 +832,7 @@ const importFromMobaXterm = (text: string): VaultImportResult => { const group = keyParts.length > 1 ? keyParts.slice(0, -1).join("/") : undefined; - let protocol: Exclude | undefined; + let protocol: Exclude | undefined; let hostname: string | undefined; let username: string | undefined; let port: number | undefined;