Split Pane Layout: - Add SplitPaneManager with recursive tree-based pane splitting - Support horizontal (Cmd+Shift+E) and vertical (Cmd+Shift+D) splits - Draggable resize dividers with 100px minimum pane size - Hover-visible close button to unsplit panes - Session picker in new panes for connecting separate terminals - Automatic xterm refit on all pane resize operations Custom Terminal Themes: - Add themes.js with 8 preset colour schemes: Charcoal (default), Solarized Dark, Monokai, Nord, Dracula, One Dark, Gruvbox Dark, Tokyo Night - Add TerminalTheme preference to AppPreferences model - Add colour scheme selector to Settings → Terminal tab - Live-apply theme changes to all active terminals on save - TerminalManager now uses themed colours instead of hardcoded values Master Password Strength Meter: - Add visual strength bar to vault creation dialog - Entropy estimation based on length, character diversity, uniqueness - Four levels: Weak (red), Fair (amber), Good (green), Strong (green) - Animated transitions on strength changes - Charcoal-themed CSS matching modal design
114 lines
2.9 KiB
Go
114 lines
2.9 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Default port numbers for each protocol.
|
|
const (
|
|
DefaultSSHPort = 22
|
|
DefaultTelnetPort = 23
|
|
DefaultRAWPort = 23
|
|
DefaultGitHubPort = 443
|
|
)
|
|
|
|
// 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",
|
|
TerminalTheme: "charcoal",
|
|
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{},
|
|
PortForwards: []PortForward{},
|
|
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{},
|
|
}
|
|
case ProtocolGitHub:
|
|
p.Port = DefaultGitHubPort
|
|
p.Host = "github.com"
|
|
p.GitHub = &GitHubConfig{
|
|
BaseURL: "https://api.github.com",
|
|
SecretMode: SecretModeSaved,
|
|
RefreshIntervalSecs: 300,
|
|
}
|
|
}
|
|
|
|
return p
|
|
}
|