@@ -1206,6 +1206,7 @@ func (sf *ServerForm) getDefaultValues() ServerFormData {
12061206 Port : fmt .Sprint (sf .original .Port ),
12071207 Key : strings .Join (sf .original .IdentityFiles , ", " ),
12081208 Tags : strings .Join (sf .original .Tags , ", " ),
1209+ Password : sf .original .Password ,
12091210 ProxyJump : sf .original .ProxyJump ,
12101211 ProxyCommand : sf .original .ProxyCommand ,
12111212 RemoteCommand : sf .original .RemoteCommand ,
@@ -1218,181 +1219,104 @@ func (sf *ServerForm) getDefaultValues() ServerFormData {
12181219 AddressFamily : sf .original .AddressFamily ,
12191220 ExitOnForwardFailure : sf .original .ExitOnForwardFailure ,
12201221 IPQoS : sf .original .IPQoS ,
1221- // Hostname canonicalization
1222+
12221223 CanonicalizeHostname : sf .original .CanonicalizeHostname ,
12231224 CanonicalDomains : sf .original .CanonicalDomains ,
12241225 CanonicalizeFallbackLocal : sf .original .CanonicalizeFallbackLocal ,
12251226 CanonicalizeMaxDots : sf .original .CanonicalizeMaxDots ,
12261227 CanonicalizePermittedCNAMEs : sf .original .CanonicalizePermittedCNAMEs ,
1227- GatewayPorts : sf .original .GatewayPorts ,
1228- LocalForward : strings .Join (sf .original .LocalForward , ", " ),
1229- RemoteForward : strings .Join (sf .original .RemoteForward , ", " ),
1230- DynamicForward : strings .Join (sf .original .DynamicForward , ", " ),
1231- ClearAllForwardings : sf .original .ClearAllForwardings ,
1232- // Public key
1233- PubkeyAuthentication : sf .original .PubkeyAuthentication ,
1234- IdentitiesOnly : sf .original .IdentitiesOnly ,
1235- // SSH Agent
1236- AddKeysToAgent : sf .original .AddKeysToAgent ,
1237- IdentityAgent : sf .original .IdentityAgent ,
1238- // Password & Interactive
1228+
1229+ GatewayPorts : sf .original .GatewayPorts ,
1230+ LocalForward : strings .Join (sf .original .LocalForward , ", " ),
1231+ RemoteForward : strings .Join (sf .original .RemoteForward , ", " ),
1232+ DynamicForward : strings .Join (sf .original .DynamicForward , ", " ),
1233+ ClearAllForwardings : sf .original .ClearAllForwardings ,
1234+
1235+ PubkeyAuthentication : sf .original .PubkeyAuthentication ,
1236+ IdentitiesOnly : sf .original .IdentitiesOnly ,
1237+ AddKeysToAgent : sf .original .AddKeysToAgent ,
1238+ IdentityAgent : sf .original .IdentityAgent ,
12391239 PasswordAuthentication : sf .original .PasswordAuthentication ,
12401240 KbdInteractiveAuthentication : sf .original .KbdInteractiveAuthentication ,
12411241 NumberOfPasswordPrompts : sf .original .NumberOfPasswordPrompts ,
1242- // Advanced
1243- PreferredAuthentications : sf . original . PreferredAuthentications ,
1244- ForwardAgent : sf .original .ForwardAgent ,
1245- ForwardX11 : sf .original .ForwardX11 ,
1246- ForwardX11Trusted : sf .original .ForwardX11Trusted ,
1247- ControlMaster : sf .original .ControlMaster ,
1248- ControlPath : sf .original .ControlPath ,
1249- ControlPersist : sf .original .ControlPersist ,
1250- ServerAliveInterval : sf .original .ServerAliveInterval ,
1251- ServerAliveCountMax : sf .original .ServerAliveCountMax ,
1252- Compression : sf .original .Compression ,
1253- TCPKeepAlive : sf .original .TCPKeepAlive ,
1254- BatchMode : sf .original .BatchMode ,
1255- StrictHostKeyChecking : sf .original .StrictHostKeyChecking ,
1256- UserKnownHostsFile : sf .original .UserKnownHostsFile ,
1257- HostKeyAlgorithms : sf .original .HostKeyAlgorithms ,
1258- PubkeyAcceptedAlgorithms : sf .original .PubkeyAcceptedAlgorithms ,
1242+ PreferredAuthentications : sf . original . PreferredAuthentications ,
1243+
1244+ ForwardAgent : sf .original .ForwardAgent ,
1245+ ForwardX11 : sf .original .ForwardX11 ,
1246+ ForwardX11Trusted : sf .original .ForwardX11Trusted ,
1247+ ControlMaster : sf .original .ControlMaster ,
1248+ ControlPath : sf .original .ControlPath ,
1249+ ControlPersist : sf .original .ControlPersist ,
1250+ ServerAliveInterval : sf .original .ServerAliveInterval ,
1251+ ServerAliveCountMax : sf .original .ServerAliveCountMax ,
1252+ Compression : sf .original .Compression ,
1253+ TCPKeepAlive : sf .original .TCPKeepAlive ,
1254+ BatchMode : sf .original .BatchMode ,
1255+ StrictHostKeyChecking : sf .original .StrictHostKeyChecking ,
1256+ UserKnownHostsFile : sf .original .UserKnownHostsFile ,
1257+ HostKeyAlgorithms : sf .original .HostKeyAlgorithms ,
1258+ PubkeyAcceptedAlgorithms : sf .original .PubkeyAcceptedAlgorithms ,
12591259 HostbasedAcceptedAlgorithms : sf .original .HostbasedAcceptedAlgorithms ,
1260- MACs : sf .original .MACs ,
1261- Ciphers : sf .original .Ciphers ,
1262- KexAlgorithms : sf .original .KexAlgorithms ,
1263- VerifyHostKeyDNS : sf .original .VerifyHostKeyDNS ,
1264- UpdateHostKeys : sf .original .UpdateHostKeys ,
1265- HashKnownHosts : sf .original .HashKnownHosts ,
1266- VisualHostKey : sf .original .VisualHostKey ,
1267- LocalCommand : sf .original .LocalCommand ,
1268- PermitLocalCommand : sf .original .PermitLocalCommand ,
1269- EscapeChar : sf .original .EscapeChar ,
1270- SendEnv : strings .Join (sf .original .SendEnv , ", " ),
1271- SetEnv : strings .Join (sf .original .SetEnv , ", " ),
1272- LogLevel : sf .original .LogLevel ,
1273- }
1274- }
1275- // For new servers, use empty values instead of SSH defaults
1276- // SSH defaults will be applied by the SSH client if values are not specified
1260+ MACs : sf .original .MACs ,
1261+ Ciphers : sf .original .Ciphers ,
1262+ KexAlgorithms : sf .original .KexAlgorithms ,
1263+ VerifyHostKeyDNS : sf .original .VerifyHostKeyDNS ,
1264+ UpdateHostKeys : sf .original .UpdateHostKeys ,
1265+ HashKnownHosts : sf .original .HashKnownHosts ,
1266+ VisualHostKey : sf .original .VisualHostKey ,
1267+ LocalCommand : sf .original .LocalCommand ,
1268+ PermitLocalCommand : sf .original .PermitLocalCommand ,
1269+ EscapeChar : sf .original .EscapeChar ,
1270+ SendEnv : strings .Join (sf .original .SendEnv , ", " ),
1271+ SetEnv : strings .Join (sf .original .SetEnv , ", " ),
1272+ LogLevel : sf .original .LogLevel ,
1273+ }
1274+ }
12771275 return ServerFormData {
1278- Alias : "" , // Explicitly empty for new servers
1279- Host : "" , // Explicitly empty for new servers
1280- User : "" , // Empty for new servers (SSH will use current username)
1281- Port : "22" , // Keep port 22 as it's the standard SSH port
1282- Key : "" , // Empty for new servers (SSH will try default keys)
1283- Tags : "" ,
1284-
1285- // All other fields should be empty for new servers
1286- // The SSH client will use its defaults when these are not specified
1287- ProxyJump : "" ,
1288- ProxyCommand : "" ,
1289- RemoteCommand : "" ,
1290- RequestTTY : "" ,
1291- SessionType : "" ,
1292- ConnectTimeout : "" ,
1293- ConnectionAttempts : "" ,
1294- BindAddress : "" ,
1295- BindInterface : "" ,
1296- AddressFamily : "" ,
1297- ExitOnForwardFailure : "" ,
1298- IPQoS : "" ,
1299-
1300- // Hostname canonicalization
1301- CanonicalizeHostname : "" ,
1302- CanonicalDomains : "" ,
1303- CanonicalizeFallbackLocal : "" ,
1304- CanonicalizeMaxDots : "" ,
1305- CanonicalizePermittedCNAMEs : "" ,
1306-
1307- // Port forwarding
1308- LocalForward : "" ,
1309- RemoteForward : "" ,
1310- DynamicForward : "" ,
1311- ClearAllForwardings : "" ,
1312- GatewayPorts : "" ,
1313-
1314- // Authentication
1315- PubkeyAuthentication : "" ,
1316- IdentitiesOnly : "" ,
1317- AddKeysToAgent : "" ,
1318- IdentityAgent : "" ,
1319- PasswordAuthentication : "" ,
1320- KbdInteractiveAuthentication : "" ,
1321- NumberOfPasswordPrompts : "" ,
1322- PreferredAuthentications : "" ,
1323- PubkeyAcceptedAlgorithms : "" ,
1324- HostbasedAcceptedAlgorithms : "" ,
1325-
1326- // Forwarding
1327- ForwardAgent : "" ,
1328- ForwardX11 : "" ,
1329- ForwardX11Trusted : "" ,
1330-
1331- // Multiplexing
1332- ControlMaster : "" ,
1333- ControlPath : "" ,
1334- ControlPersist : "" ,
1335-
1336- // Keep-alive
1337- ServerAliveInterval : "" ,
1338- ServerAliveCountMax : "" ,
1339- TCPKeepAlive : "" ,
1340-
1341- // Connection
1342- Compression : "" ,
1343- BatchMode : "" ,
1344-
1345- // Security
1346- StrictHostKeyChecking : "" ,
1347- CheckHostIP : "" ,
1348- FingerprintHash : "" ,
1349- UserKnownHostsFile : "" ,
1350- HostKeyAlgorithms : "" ,
1351- MACs : "" ,
1352- Ciphers : "" ,
1353- KexAlgorithms : "" ,
1354- VerifyHostKeyDNS : "" ,
1355- UpdateHostKeys : "" ,
1356- HashKnownHosts : "" ,
1357- VisualHostKey : "" ,
1358-
1359- // Command execution
1360- LocalCommand : "" ,
1361- PermitLocalCommand : "" ,
1362- EscapeChar : "" ,
1363-
1364- // Environment
1365- SendEnv : "" ,
1366- SetEnv : "" ,
1367-
1368- // Debugging
1369- LogLevel : "" ,
1276+ Alias : "" ,
1277+ Host : "" ,
1278+ User : "" ,
1279+ Port : "" ,
1280+ Key : "" ,
1281+ Tags : "" ,
1282+ Password : "" ,
13701283 }
13711284}
13721285
1373- // createBasicForm creates the Basic configuration tab
13741286func (sf * ServerForm ) createBasicForm () {
13751287 form := tview .NewForm ()
13761288 defaultValues := sf .getDefaultValues ()
13771289
1378- // Add validated input fields
13791290 sf .addValidatedInputField (form , "Alias:" , "Alias" , defaultValues .Alias , 20 , GetFieldPlaceholder ("Alias" ))
13801291 sf .addValidatedInputField (form , "Host/IP:" , "Host" , defaultValues .Host , 20 , GetFieldPlaceholder ("Host" ))
13811292 sf .addValidatedInputField (form , "User:" , "User" , defaultValues .User , 20 , GetFieldPlaceholder ("User" ))
13821293 sf .addValidatedInputField (form , "Port:" , "Port" , defaultValues .Port , 20 , GetFieldPlaceholder ("Port" ))
13831294
1384- // Keys field with autocomplete
13851295 keysField := sf .addValidatedInputField (form , "Keys:" , "Keys" , defaultValues .Key , 40 , GetFieldPlaceholder ("Keys" ))
13861296 keysField .SetAutocompleteFunc (sf .createSSHKeyAutocomplete ())
13871297
1388- // Tags field
1298+ authMethodOptions := []string {i18n .T ("auth.method.key" ), i18n .T ("auth.method.password" ), i18n .T ("auth.method.key_password" )}
1299+ authMethodIndex := 0
1300+ if defaultValues .Password != "" {
1301+ if defaultValues .Key != "" {
1302+ authMethodIndex = 2
1303+ } else {
1304+ authMethodIndex = 1
1305+ }
1306+ }
1307+ sf .addDropDownWithHelp (form , "AuthMethod:" , "AuthMethod" , authMethodOptions , authMethodIndex )
1308+
1309+ sf .addValidatedInputField (form , "Password:" , "Password" , defaultValues .Password , 40 , GetFieldPlaceholder ("Password" ))
1310+
1311+ loginModeOptions := []string {i18n .T ("auth.login_mode.interactive" ), i18n .T ("auth.login_mode.batch" ), i18n .T ("auth.login_mode.auto" )}
1312+ loginModeIndex := 2
1313+ sf .addDropDownWithHelp (form , "LoginMode:" , "LoginMode" , loginModeOptions , loginModeIndex )
1314+
13891315 sf .addValidatedInputField (form , "Tags:" , "Tags" , defaultValues .Tags , 30 , GetFieldPlaceholder ("Tags" ))
13901316
1391- // Add save and cancel buttons
1392- form .AddButton ("Save" , sf .handleSaveButton )
1393- form .AddButton ("Cancel" , sf .handleCancel )
1317+ form .AddButton (i18n .T ("form.btn.save" ), sf .handleSaveButton )
1318+ form .AddButton (i18n .T ("form.btn.cancel" ), sf .handleCancel )
13941319
1395- // Set up form-level input capture for shortcuts
13961320 sf .setupFormShortcuts (form )
13971321
13981322 sf .forms ["Basic" ] = form
@@ -1773,14 +1697,14 @@ func (sf *ServerForm) createAdvancedForm() {
17731697}
17741698
17751699type ServerFormData struct {
1776- Alias string
1777- Host string
1778- User string
1779- Port string
1780- Key string
1781- Tags string
1782-
1783- // Connection and proxy settings
1700+ Alias string
1701+ Host string
1702+ User string
1703+ Port string
1704+ Key string
1705+ Tags string
1706+ Password string
1707+
17841708 ProxyJump string
17851709 ProxyCommand string
17861710 RemoteCommand string
@@ -1793,33 +1717,27 @@ type ServerFormData struct {
17931717 AddressFamily string
17941718 ExitOnForwardFailure string
17951719 IPQoS string
1796- // Hostname canonicalization
1720+
17971721 CanonicalizeHostname string
17981722 CanonicalDomains string
17991723 CanonicalizeFallbackLocal string
18001724 CanonicalizeMaxDots string
18011725 CanonicalizePermittedCNAMEs string
18021726
1803- // Port forwarding
18041727 LocalForward string
18051728 RemoteForward string
18061729 DynamicForward string
18071730 ClearAllForwardings string
18081731 GatewayPorts string
18091732
1810- // Authentication and key management
1811- // Public key
18121733 PubkeyAuthentication string
18131734 IdentitiesOnly string
1814- // SSH Agent
1815- AddKeysToAgent string
1816- IdentityAgent string
1817- // Password & Interactive
1735+ AddKeysToAgent string
1736+ IdentityAgent string
18181737 PasswordAuthentication string
18191738 KbdInteractiveAuthentication string
18201739 NumberOfPasswordPrompts string
1821- // Advanced
1822- PreferredAuthentications string
1740+ PreferredAuthentications string
18231741
18241742 // Agent and X11 forwarding
18251743 ForwardAgent string
0 commit comments