Documentation
¶
Index ¶
- func ShowDockerRecoveryFailed(reason string) error
- func ShowDockerRecoveryStarted() error
- func ShowDockerRecoverySuccess(serverCount int) error
- type App
- type AutostartManager
- type ConnectionState
- type GitHubRelease
- type MenuManager
- func (m *MenuManager) ForceRefresh()
- func (m *MenuManager) GetQuarantineMenuItem(serverName string) *systray.MenuItem
- func (m *MenuManager) GetServerMenuItem(serverName string) *systray.MenuItem
- func (m *MenuManager) LatestQuarantineSnapshot() []map[string]interface{}
- func (m *MenuManager) LatestServersSnapshot() []map[string]interface{}
- func (m *MenuManager) SetActionCallback(callback func(serverName string, action string))
- func (m *MenuManager) UpdateProfilesMenu(profiles []ProfileInfo, active string)
- func (m *MenuManager) UpdateQuarantineMenu(quarantinedServers []map[string]interface{})
- func (m *MenuManager) UpdateUpstreamServersMenu(servers []map[string]interface{})
- type NotificationHandler
- type ProfileInfo
- type ServerInterface
- type ServerStateManager
- func (m *ServerStateManager) EnableServer(serverName string, enabled bool) error
- func (m *ServerStateManager) GetAllServers() ([]map[string]interface{}, error)
- func (m *ServerStateManager) GetQuarantinedServers() ([]map[string]interface{}, error)
- func (m *ServerStateManager) QuarantineServer(serverName string, quarantined bool) error
- func (m *ServerStateManager) RefreshState() error
- func (m *ServerStateManager) UnquarantineServer(serverName string) error
- type SynchronizationManager
- func (m *SynchronizationManager) HandleServerEnable(serverName string, enabled bool) error
- func (m *SynchronizationManager) HandleServerQuarantine(serverName string, quarantined bool) error
- func (m *SynchronizationManager) HandleServerUnquarantine(serverName string) error
- func (m *SynchronizationManager) SetConnected(connected bool)
- func (m *SynchronizationManager) SetOnSync(cb func())
- func (m *SynchronizationManager) Start()
- func (m *SynchronizationManager) Stop()
- func (m *SynchronizationManager) SyncDelayed()
- func (m *SynchronizationManager) SyncNow() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowDockerRecoveryFailed ¶
ShowDockerRecoveryFailed shows a notification when Docker recovery fails
func ShowDockerRecoveryStarted ¶
func ShowDockerRecoveryStarted() error
ShowDockerRecoveryStarted shows a notification when Docker recovery starts
func ShowDockerRecoverySuccess ¶
ShowDockerRecoverySuccess shows a notification when Docker recovery succeeds
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the system tray application
func New ¶
func New(server ServerInterface, logger *zap.SugaredLogger, version string, shutdown func()) *App
New creates a new tray application
func NewWithAPIClient ¶
func NewWithAPIClient(server ServerInterface, apiClient interface{ OpenWebUI() error }, logger *zap.SugaredLogger, version string, shutdown func()) *App
NewWithAPIClient creates a new tray application with an API client for web UI access
func (*App) ObserveConnectionState ¶
func (a *App) ObserveConnectionState(ctx context.Context, states <-chan ConnectionState)
ObserveConnectionState wires a channel of connection states into the tray UI.
func (*App) SetConnectionState ¶
func (a *App) SetConnectionState(state ConnectionState)
SetConnectionState updates the tray's view of the core connectivity status.
type AutostartManager ¶
type AutostartManager struct {
// contains filtered or unexported fields
}
AutostartManager handles autostart functionality across platforms
func NewAutostartManager ¶
func NewAutostartManager() (*AutostartManager, error)
NewAutostartManager creates a new autostart manager
func (*AutostartManager) Disable ¶
func (m *AutostartManager) Disable() error
Disable disables autostart functionality
func (*AutostartManager) Enable ¶
func (m *AutostartManager) Enable() error
Enable enables autostart functionality
func (*AutostartManager) IsEnabled ¶
func (m *AutostartManager) IsEnabled() bool
IsEnabled checks if autostart is currently enabled
func (*AutostartManager) Toggle ¶
func (m *AutostartManager) Toggle() error
Toggle toggles autostart functionality
type ConnectionState ¶
type ConnectionState string
ConnectionState represents the current connectivity status between the tray and the core runtime.
const ( ConnectionStateInitializing ConnectionState = "initializing" ConnectionStateStartingCore ConnectionState = "starting_core" ConnectionStateConnecting ConnectionState = "connecting" ConnectionStateConnected ConnectionState = "connected" ConnectionStateReconnecting ConnectionState = "reconnecting" ConnectionStateDisconnected ConnectionState = "disconnected" ConnectionStateAuthError ConnectionState = "auth_error" ConnectionStateErrorPortConflict ConnectionState = "error_port_conflict" // ADD: Specific error states ConnectionStateErrorDBLocked ConnectionState = "error_db_locked" ConnectionStateErrorDocker ConnectionState = "error_docker" ConnectionStateRecoveringDocker ConnectionState = "recovering_docker" // Docker recovery in progress ConnectionStateErrorConfig ConnectionState = "error_config" ConnectionStateErrorGeneral ConnectionState = "error_general" ConnectionStateFailed ConnectionState = "failed" )
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Prerelease bool `json:"prerelease"`
Assets []struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
} `json:"assets"`
}
GitHubRelease represents a GitHub release
type MenuManager ¶
type MenuManager struct {
// contains filtered or unexported fields
}
MenuManager manages tray menu state and prevents duplications
func NewMenuManager ¶
func NewMenuManager(upstreamMenu, quarantineMenu, profileMenu *systray.MenuItem, logger *zap.SugaredLogger) *MenuManager
NewMenuManager creates a new menu manager
func (*MenuManager) ForceRefresh ¶
func (m *MenuManager) ForceRefresh()
ForceRefresh clears all menu tracking to force recreation (handles systray limitations)
func (*MenuManager) GetQuarantineMenuItem ¶
func (m *MenuManager) GetQuarantineMenuItem(serverName string) *systray.MenuItem
GetQuarantineMenuItem returns the quarantine menu item for a server (for action handling)
func (*MenuManager) GetServerMenuItem ¶
func (m *MenuManager) GetServerMenuItem(serverName string) *systray.MenuItem
GetServerMenuItem returns the menu item for a server (for action handling)
func (*MenuManager) LatestQuarantineSnapshot ¶
func (m *MenuManager) LatestQuarantineSnapshot() []map[string]interface{}
LatestQuarantineSnapshot returns a copy of the latest quarantine data used for menu generation.
func (*MenuManager) LatestServersSnapshot ¶
func (m *MenuManager) LatestServersSnapshot() []map[string]interface{}
LatestServersSnapshot returns a copy of the latest upstream server data used for menu generation.
func (*MenuManager) SetActionCallback ¶
func (m *MenuManager) SetActionCallback(callback func(serverName string, action string))
SetActionCallback sets the callback function for server actions
func (*MenuManager) UpdateProfilesMenu ¶ added in v0.46.0
func (m *MenuManager) UpdateProfilesMenu(profiles []ProfileInfo, active string)
UpdateProfilesMenu refreshes the profile switcher submenu (Profiles v2 T5). It renders an "All servers" entry plus one checkbox per configured profile, checks the active one, and (re)wires click handlers that ask the core to switch the server-level default active profile. systray menu items cannot be removed, only hidden, so the items are rebuilt only when the set of profile slugs changes; otherwise titles and checkmarks are updated in place. Because the active profile is re-read on every sync, a switch made by another client (Web UI, CLI) is reflected here within one sync interval.
func (*MenuManager) UpdateQuarantineMenu ¶
func (m *MenuManager) UpdateQuarantineMenu(quarantinedServers []map[string]interface{})
UpdateQuarantineMenu updates the quarantine menu using Hide/Show to prevent duplicates
func (*MenuManager) UpdateUpstreamServersMenu ¶
func (m *MenuManager) UpdateUpstreamServersMenu(servers []map[string]interface{})
UpdateUpstreamServersMenu updates the upstream servers menu without duplicates
type NotificationHandler ¶
type NotificationHandler struct {
// contains filtered or unexported fields
}
NotificationHandler implements upstream.NotificationHandler for system tray notifications
func NewNotificationHandler ¶
func NewNotificationHandler(logger *zap.SugaredLogger) *NotificationHandler
NewNotificationHandler creates a new tray notification handler
func (*NotificationHandler) SendNotification ¶
func (h *NotificationHandler) SendNotification(notification *upstream.Notification)
SendNotification implements upstream.NotificationHandler
type ProfileInfo ¶ added in v0.46.0
ProfileInfo is a tray-facing summary of a configured profile (Profiles v2 T5). Name is the profile slug; an empty active profile means "all servers". It lives in a build-constraint-free file so the cross-platform tray API adapter can reference it even in stub (headless/linux) builds of this package.
type ServerInterface ¶
type ServerInterface interface {
IsRunning() bool
GetListenAddress() string
GetUpstreamStats() map[string]interface{}
StartServer(ctx context.Context) error
StopServer() error
GetStatus() interface{} // Returns server status for display
StatusChannel() <-chan interface{} // Channel for status updates
EventsChannel() <-chan internalRuntime.Event
// Quarantine management methods
GetQuarantinedServers() ([]map[string]interface{}, error)
UnquarantineServer(serverName string) error
// Server management methods for tray menu
EnableServer(serverName string, enabled bool) error
QuarantineServer(serverName string, quarantined bool) error
GetAllServers() ([]map[string]interface{}, error)
SetListenAddress(addr string, persist bool) error
SuggestAlternateListen(baseAddr string) (string, error)
// Config management for file watching
ReloadConfiguration() error
GetConfigPath() string
GetLogDir() string
// OAuth control
TriggerOAuthLogin(serverName string) error
// Profile switcher (Profiles v2 T5). The tray holds no state — it reads the
// configured profiles and the server-level default active profile from the
// core, and writes the active profile back, all via REST.
GetProfiles() ([]ProfileInfo, error)
GetActiveProfile() (string, error)
SetActiveProfile(name string) error
}
ServerInterface defines the interface for server control
type ServerStateManager ¶
type ServerStateManager struct {
// contains filtered or unexported fields
}
ServerStateManager manages server state synchronization between storage, config, and menu
func NewServerStateManager ¶
func NewServerStateManager(server ServerInterface, logger *zap.SugaredLogger) *ServerStateManager
NewServerStateManager creates a new server state manager
func (*ServerStateManager) EnableServer ¶
func (m *ServerStateManager) EnableServer(serverName string, enabled bool) error
EnableServer enables/disables a server and ensures all state is synchronized
func (*ServerStateManager) GetAllServers ¶
func (m *ServerStateManager) GetAllServers() ([]map[string]interface{}, error)
GetAllServers returns cached or fresh server list
func (*ServerStateManager) GetQuarantinedServers ¶
func (m *ServerStateManager) GetQuarantinedServers() ([]map[string]interface{}, error)
GetQuarantinedServers returns cached or fresh quarantined server list
func (*ServerStateManager) QuarantineServer ¶
func (m *ServerStateManager) QuarantineServer(serverName string, quarantined bool) error
QuarantineServer quarantines a server and ensures all state is synchronized
func (*ServerStateManager) RefreshState ¶
func (m *ServerStateManager) RefreshState() error
RefreshState forces a refresh of server state from the server
func (*ServerStateManager) UnquarantineServer ¶
func (m *ServerStateManager) UnquarantineServer(serverName string) error
UnquarantineServer removes a server from quarantine and ensures all state is synchronized
type SynchronizationManager ¶
type SynchronizationManager struct {
// contains filtered or unexported fields
}
SynchronizationManager coordinates between state manager and menu manager
func NewSynchronizationManager ¶
func NewSynchronizationManager(stateManager *ServerStateManager, server ServerInterface, menuManager *MenuManager, logger *zap.SugaredLogger) *SynchronizationManager
NewSynchronizationManager creates a new synchronization manager
func (*SynchronizationManager) HandleServerEnable ¶
func (m *SynchronizationManager) HandleServerEnable(serverName string, enabled bool) error
HandleServerEnable handles server enable/disable with full synchronization
func (*SynchronizationManager) HandleServerQuarantine ¶
func (m *SynchronizationManager) HandleServerQuarantine(serverName string, quarantined bool) error
HandleServerQuarantine handles server quarantine with full synchronization
func (*SynchronizationManager) HandleServerUnquarantine ¶
func (m *SynchronizationManager) HandleServerUnquarantine(serverName string) error
HandleServerUnquarantine handles server unquarantine with full synchronization
func (*SynchronizationManager) SetConnected ¶
func (m *SynchronizationManager) SetConnected(connected bool)
SetConnected updates the connection state and controls whether syncing is allowed
func (*SynchronizationManager) SetOnSync ¶
func (m *SynchronizationManager) SetOnSync(cb func())
SetOnSync registers a callback invoked after successful menu synchronization.
func (*SynchronizationManager) Start ¶
func (m *SynchronizationManager) Start()
Start begins background synchronization
func (*SynchronizationManager) Stop ¶
func (m *SynchronizationManager) Stop()
Stop stops background synchronization
func (*SynchronizationManager) SyncDelayed ¶
func (m *SynchronizationManager) SyncDelayed()
SyncDelayed schedules a delayed synchronization to batch updates
func (*SynchronizationManager) SyncNow ¶
func (m *SynchronizationManager) SyncNow() error
SyncNow performs immediate synchronization