Tab close confirmation:
- Add is-visible to both backdrop AND modal element — the modal CSS
starts with visibility:hidden/opacity:0, so the modal was invisible
despite the backdrop blur appearing
Section headers (sidebar + profile editor):
- Add mousedown preventDefault() on all clickable section headers —
WKWebView initiates a text selection gesture on mousedown for divs,
swallowing the first click and requiring a double-click
- Fix sidebar delete profile to use custom modal instead of blocked
window.confirm()
Credential storage:
- buildSecretCallback now respects profile's secretMode field:
- 'saved': checks keychain/vault first, prompts if missing, then
persists to keychain (preferred) or encrypted vault
- 'session-only': caches in memory per-session, prompts once
- 'ask-every-time': always prompts
- Previously the callback always prompted and never saved
- Change default secretMode from 'ask-every-time' to 'saved' in both
Go defaults and JS frontend defaults
103 lines
2.6 KiB
Go
103 lines
2.6 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Default port numbers for each protocol.
|
|
const (
|
|
DefaultSSHPort = 22
|
|
DefaultTelnetPort = 23
|
|
DefaultRAWPort = 23
|
|
)
|
|
|
|
// Default timeout values (in seconds).
|
|
const (
|
|
DefaultConnectTimeout = 30
|
|
DefaultReadTimeout = 0 // no timeout
|
|
)
|
|
|
|
// Default terminal rendering settings.
|
|
const (
|
|
DefaultScrollback = 10000
|
|
DefaultFontSize = 14
|
|
DefaultFontFamily = "JetBrains Mono, Menlo, Monaco, Consolas, monospace"
|
|
DefaultCursorStyle = "block"
|
|
DefaultTerminalType = "xterm-256color"
|
|
)
|
|
|
|
// Default SSH keepalive settings.
|
|
const (
|
|
DefaultKeepaliveInterval = 30
|
|
DefaultKeepaliveCountMax = 3
|
|
)
|
|
|
|
// DefaultAppPreferences returns sensible default application preferences.
|
|
func DefaultAppPreferences() AppPreferences {
|
|
return AppPreferences{
|
|
Theme: "dark",
|
|
DefaultProtocol: string(ProtocolSSH),
|
|
ConfirmOnClose: true,
|
|
ConfirmOnDisconnect: true,
|
|
ShowStatusBar: true,
|
|
SidebarWidth: 280,
|
|
DefaultFontFamily: DefaultFontFamily,
|
|
DefaultFontSize: DefaultFontSize,
|
|
DefaultScrollback: DefaultScrollback,
|
|
DefaultCursorStyle: DefaultCursorStyle,
|
|
}
|
|
}
|
|
|
|
// NewProfile creates a new Profile with sensible defaults for the given protocol.
|
|
func NewProfile(protocol Protocol) Profile {
|
|
now := time.Now()
|
|
p := Profile{
|
|
ID: uuid.New().String(),
|
|
Protocol: protocol,
|
|
Tags: []string{},
|
|
ConnectTimeout: DefaultConnectTimeout,
|
|
ReadTimeout: DefaultReadTimeout,
|
|
TerminalFontFamily: DefaultFontFamily,
|
|
TerminalFontSize: DefaultFontSize,
|
|
TerminalScrollback: DefaultScrollback,
|
|
TerminalCursorStyle: DefaultCursorStyle,
|
|
CreatedAt: now,
|
|
UpdatedAt: now,
|
|
}
|
|
|
|
switch protocol {
|
|
case ProtocolSSH:
|
|
p.Port = DefaultSSHPort
|
|
p.SSH = &SSHConfig{
|
|
AuthMethods: []string{"publickey", "password", "keyboard-interactive"},
|
|
SecretMode: SecretModeSaved,
|
|
KeySecretMode: SecretModeSaved,
|
|
HostKeyPolicy: HostKeyAsk,
|
|
TerminalType: DefaultTerminalType,
|
|
KeepaliveInterval: DefaultKeepaliveInterval,
|
|
KeepaliveCountMax: DefaultKeepaliveCountMax,
|
|
JumpHosts: []JumpHost{},
|
|
EnvVars: map[string]string{},
|
|
}
|
|
case ProtocolTelnet:
|
|
p.Port = DefaultTelnetPort
|
|
p.Telnet = &TelnetConfig{
|
|
LocalEcho: false,
|
|
LineEnding: LineEndingCRLF,
|
|
TerminalType: DefaultTerminalType,
|
|
Encoding: "utf-8",
|
|
}
|
|
case ProtocolRAW:
|
|
p.Port = DefaultRAWPort
|
|
p.RAW = &RAWConfig{
|
|
LineEnding: LineEndingCRLF,
|
|
Encoding: "utf-8",
|
|
PayloadPresets: []PayloadPreset{},
|
|
}
|
|
}
|
|
|
|
return p
|
|
}
|