1605b5b7ae
- win32/autostart: SetAutoStart/IsAutoStartEnabled 操作 HKCU Run 键 - win32/window_size: GetWindowSize 通过 GetWindowRect 获取窗口尺寸 - config: 新增 AutoStart、WindowWidth、WindowHeight 字段 - store: Preferences/SetPreferences 扩展支持 autoStart + windowSize - dialog_preferences: 新增"开机自启动"复选框 - app.go: 启动时恢复窗口大小,关闭时通过 SetWindowSize 保存 - i18n: label_auto_start / hint_auto_start 三语翻译
45 lines
2.5 KiB
Go
45 lines
2.5 KiB
Go
// Package config defines the persistent shape of a winauth-go config and
|
||
// provides loaders for both the new YAML format and the legacy WinAuth
|
||
// XML format produced by the original C# application.
|
||
package config
|
||
|
||
// Entry is a serialized authenticator inside the config file. Vendor
|
||
// determines how Data is interpreted by the authenticator package's
|
||
// SetSecretData method.
|
||
type Entry struct {
|
||
Name string `yaml:"name" json:"name"`
|
||
Vendor string `yaml:"vendor" json:"vendor"` // google|microsoft|okta|hotp|battlenet|steam
|
||
IconName string `yaml:"icon" json:"icon,omitempty"`
|
||
SecretRaw string `yaml:"secret" json:"secret"` // value returned by Authenticator.SecretData()
|
||
// Hotkey is a human-readable global hotkey like "Ctrl+Alt+G". Empty
|
||
// means no hotkey. Parsed by internal/hotkey.Parse — invalid strings
|
||
// log a warning at registration time and are otherwise ignored.
|
||
Hotkey string `yaml:"hotkey,omitempty" json:"hotkey,omitempty"`
|
||
}
|
||
|
||
// Config is the top-level file shape. Entries are stored unencrypted by
|
||
// default; if Encrypted is true, EncryptedBlob holds a WAGO1 base64 ciphertext
|
||
// produced by internal/crypto.EncryptModern and Entries is empty on disk.
|
||
type Config struct {
|
||
Version int `yaml:"version" json:"version"`
|
||
Language string `yaml:"language,omitempty" json:"language,omitempty"`
|
||
// Theme is one of "", "light", "dark", "system" (empty = system).
|
||
Theme string `yaml:"theme,omitempty" json:"theme,omitempty"`
|
||
// AutoLockMinutes locks the UI (hides codes, requires password) after
|
||
// this many minutes of inactivity. 0 disables auto-lock.
|
||
AutoLockMinutes int `yaml:"auto_lock_minutes,omitempty" json:"auto_lock_minutes,omitempty"`
|
||
// MinimizeToTray sends the window to the system tray instead of
|
||
// exiting when the close button is pressed.
|
||
MinimizeToTray bool `yaml:"minimize_to_tray,omitempty" json:"minimize_to_tray,omitempty"`
|
||
// AutoStart registers the application to launch at Windows logon
|
||
// via the HKCU Run key.
|
||
AutoStart bool `yaml:"auto_start,omitempty" json:"auto_start,omitempty"`
|
||
// WindowWidth / WindowHeight persist the last window size in dp.
|
||
// Zero means "use the default 560×420".
|
||
WindowWidth int `yaml:"window_width,omitempty" json:"window_width,omitempty"`
|
||
WindowHeight int `yaml:"window_height,omitempty" json:"window_height,omitempty"`
|
||
Encrypted bool `yaml:"encrypted" json:"encrypted"`
|
||
EncryptedBlob string `yaml:"encrypted_blob,omitempty" json:"encrypted_blob,omitempty"`
|
||
Entries []Entry `yaml:"entries,omitempty" json:"entries,omitempty"`
|
||
}
|