Documentation
¶
Overview ¶
Package services contains application services that orchestrate business logic.
Index ¶
- func ZoomKeyForLog(raw string) string
- type BrowserService
- func (s *BrowserService) AttachWebView(view *webkit.WebView)
- func (s *BrowserService) ClearHistory(ctx context.Context) error
- func (s *BrowserService) CopyCurrentURL(ctx context.Context, url string) error
- func (s *BrowserService) DeleteHistoryEntry(ctx context.Context, id int64) error
- func (s *BrowserService) GetConfig(ctx context.Context) (*config.Config, error)
- func (s *BrowserService) GetCurrentURL(ctx context.Context) (string, error)
- func (s *BrowserService) GetHistoryStats(ctx context.Context) (map[string]interface{}, error)
- func (s *BrowserService) GetInitialURL(ctx context.Context) (string, error)
- func (s *BrowserService) GetRecentHistory(ctx context.Context, limit int) ([]HistoryEntry, error)
- func (s *BrowserService) GetSearchShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
- func (s *BrowserService) GetZoomLevel(ctx context.Context, url string) (float64, error)
- func (s *BrowserService) GoBack(ctx context.Context) error
- func (s *BrowserService) GoForward(ctx context.Context) error
- func (s *BrowserService) InjectControlScript(ctx context.Context) error
- func (s *BrowserService) LoadInjectableScript(assets embed.FS) error
- func (s *BrowserService) Navigate(ctx context.Context, url string) (*NavigationResult, error)
- func (s *BrowserService) ResetZoom(ctx context.Context, url string) (float64, error)
- func (s *BrowserService) SearchHistory(ctx context.Context, query string, limit int) ([]HistoryEntry, error)
- func (s *BrowserService) ServiceName() string
- func (s *BrowserService) SetWindowTitleUpdater(updater WindowTitleUpdater)
- func (s *BrowserService) SetZoomLevel(ctx context.Context, url string, zoomLevel float64) error
- func (s *BrowserService) UpdateConfig(ctx context.Context, newConfig *config.Config) error
- func (s *BrowserService) UpdatePageTitle(ctx context.Context, url, title string) error
- func (s *BrowserService) ZoomIn(ctx context.Context, url string) (float64, error)
- func (s *BrowserService) ZoomOut(ctx context.Context, url string) (float64, error)
- type ConfigInfo
- type ConfigService
- func (s *ConfigService) AddSearchShortcut(ctx context.Context, key string, shortcut config.SearchShortcut) error
- func (s *ConfigService) DeleteSearchShortcut(ctx context.Context, key string) error
- func (s *ConfigService) ExportConfig(ctx context.Context) (*config.Config, error)
- func (s *ConfigService) GetConfigInfo(ctx context.Context) (*ConfigInfo, error)
- func (s *ConfigService) GetConfigPath(ctx context.Context) (string, error)
- func (s *ConfigService) GetDatabasePath(ctx context.Context) (string, error)
- func (s *ConfigService) GetDefaultBrowser(ctx context.Context) (string, error)
- func (s *ConfigService) GetDmenuSettings(ctx context.Context) (*config.DmenuConfig, error)
- func (s *ConfigService) GetRenderingMode(ctx context.Context) (string, error)
- func (s *ConfigService) GetSearchShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
- func (s *ConfigService) ImportConfig(ctx context.Context, newConfig *config.Config) error
- func (s *ConfigService) ReloadConfig(ctx context.Context) error
- func (s *ConfigService) SetDatabasePath(ctx context.Context, path string) error
- func (s *ConfigService) SetDefaultBrowser(ctx context.Context, browser string) error
- func (s *ConfigService) SetRenderingMode(ctx context.Context, mode string) error
- func (s *ConfigService) UpdateDmenuSettings(ctx context.Context, settings *config.DmenuConfig) error
- func (s *ConfigService) UpdateSearchShortcut(ctx context.Context, key string, shortcut config.SearchShortcut) error
- func (s *ConfigService) ValidateConfig(ctx context.Context) ([]string, error)
- type DatabaseHistoryProvider
- func (h *DatabaseHistoryProvider) GetAllHistory() ([]*db.History, error)
- func (h *DatabaseHistoryProvider) GetHistoryByURL(url string) (*db.History, error)
- func (h *DatabaseHistoryProvider) GetRecentHistory(limit int) ([]*db.History, error)
- func (h *DatabaseHistoryProvider) SearchHistory(query string, limit int) ([]*db.History, error)
- type HistoryEntry
- type NavigationResult
- type ParserService
- func (s *ParserService) CalculateSimilarity(ctx context.Context, s1, s2 string) (float64, error)
- func (s *ParserService) FuzzySearchHistory(ctx context.Context, query string, threshold float64) ([]parser.FuzzyMatch, error)
- func (s *ParserService) GetCompletions(ctx context.Context, input string, limit int) ([]string, error)
- func (s *ParserService) GetFuzzyConfig(ctx context.Context) (*parser.FuzzyConfig, error)
- func (s *ParserService) GetSupportedShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
- func (s *ParserService) ParseInput(ctx context.Context, input string) (*parser.ParseResult, error)
- func (s *ParserService) PreviewParse(ctx context.Context, input string) (*parser.ParseResult, error)
- func (s *ParserService) ProcessShortcut(ctx context.Context, shortcut, query string) (string, error)
- func (s *ParserService) UpdateFuzzyConfig(ctx context.Context, config *parser.FuzzyConfig) error
- func (s *ParserService) ValidateURL(ctx context.Context, input string) (bool, error)
- type WindowTitleUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ZoomKeyForLog ¶ added in v0.3.0
ZoomKeyForLog exposes the derived zoom key (host or raw URL) for logging from other packages.
Types ¶
type BrowserService ¶
type BrowserService struct {
// contains filtered or unexported fields
}
BrowserService handles browser-related operations for the built-in browser.
func NewBrowserService ¶
func NewBrowserService(cfg *config.Config, queries db.DatabaseQuerier) *BrowserService
NewBrowserService creates a new BrowserService instance.
func (*BrowserService) AttachWebView ¶
func (s *BrowserService) AttachWebView(view *webkit.WebView)
AttachWebView connects a native WebKit WebView to this service for integration.
func (*BrowserService) ClearHistory ¶
func (s *BrowserService) ClearHistory(ctx context.Context) error
ClearHistory removes all history entries.
func (*BrowserService) CopyCurrentURL ¶
func (s *BrowserService) CopyCurrentURL(ctx context.Context, url string) error
CopyCurrentURL copies the current URL to clipboard (frontend-initiated)
func (*BrowserService) DeleteHistoryEntry ¶
func (s *BrowserService) DeleteHistoryEntry(ctx context.Context, id int64) error
DeleteHistoryEntry removes a specific history entry.
func (*BrowserService) GetCurrentURL ¶
func (s *BrowserService) GetCurrentURL(ctx context.Context) (string, error)
GetCurrentURL returns the current URL (this would be implemented by the frontend)
func (*BrowserService) GetHistoryStats ¶
func (s *BrowserService) GetHistoryStats(ctx context.Context) (map[string]interface{}, error)
GetHistoryStats returns statistics about browser history.
func (*BrowserService) GetInitialURL ¶
func (s *BrowserService) GetInitialURL(ctx context.Context) (string, error)
GetInitialURL returns the initially navigated URL for frontend synchronization
func (*BrowserService) GetRecentHistory ¶
func (s *BrowserService) GetRecentHistory(ctx context.Context, limit int) ([]HistoryEntry, error)
GetRecentHistory returns recent browser history entries.
func (*BrowserService) GetSearchShortcuts ¶
func (s *BrowserService) GetSearchShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
GetSearchShortcuts returns available search shortcuts.
func (*BrowserService) GetZoomLevel ¶
GetZoomLevel retrieves the saved zoom level for a URL.
func (*BrowserService) GoBack ¶
func (s *BrowserService) GoBack(ctx context.Context) error
GoBack provides navigation back functionality
func (*BrowserService) GoForward ¶
func (s *BrowserService) GoForward(ctx context.Context) error
GoForward provides navigation forward functionality
func (*BrowserService) InjectControlScript ¶
func (s *BrowserService) InjectControlScript(ctx context.Context) error
InjectControlScript injects the global controls script into the current page
func (*BrowserService) LoadInjectableScript ¶
func (s *BrowserService) LoadInjectableScript(assets embed.FS) error
LoadInjectableScript loads the minified injectable controls script from assets
func (*BrowserService) Navigate ¶
func (s *BrowserService) Navigate(ctx context.Context, url string) (*NavigationResult, error)
Navigate handles navigation to a URL and records it in history.
func (*BrowserService) SearchHistory ¶
func (s *BrowserService) SearchHistory(ctx context.Context, query string, limit int) ([]HistoryEntry, error)
SearchHistory searches browser history.
func (*BrowserService) ServiceName ¶
func (s *BrowserService) ServiceName() string
ServiceName returns the service name for frontend binding
func (*BrowserService) SetWindowTitleUpdater ¶
func (s *BrowserService) SetWindowTitleUpdater(updater WindowTitleUpdater)
SetWindowTitleUpdater sets the window title updater interface
func (*BrowserService) SetZoomLevel ¶
SetZoomLevel sets the zoom level for a URL.
func (*BrowserService) UpdateConfig ¶
UpdateConfig updates the browser configuration.
func (*BrowserService) UpdatePageTitle ¶
func (s *BrowserService) UpdatePageTitle(ctx context.Context, url, title string) error
UpdatePageTitle updates the title of the current page in history and the window title.
type ConfigInfo ¶
type ConfigInfo struct {
ConfigPath string `json:"config_path"`
DatabasePath string `json:"database_path"`
SearchShortcuts map[string]config.SearchShortcut `json:"search_shortcuts"`
RenderingMode string `json:"rendering_mode"`
}
ConfigInfo represents configuration information for the frontend.
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService handles configuration operations for the application.
func NewConfigService ¶
func NewConfigService(cfg *config.Config, configPath string) *ConfigService
NewConfigService creates a new ConfigService instance.
func (*ConfigService) AddSearchShortcut ¶
func (s *ConfigService) AddSearchShortcut(ctx context.Context, key string, shortcut config.SearchShortcut) error
AddSearchShortcut adds a new search shortcut.
func (*ConfigService) DeleteSearchShortcut ¶
func (s *ConfigService) DeleteSearchShortcut(ctx context.Context, key string) error
DeleteSearchShortcut removes a search shortcut.
func (*ConfigService) ExportConfig ¶
ExportConfig returns the current configuration as JSON.
func (*ConfigService) GetConfigInfo ¶
func (s *ConfigService) GetConfigInfo(ctx context.Context) (*ConfigInfo, error)
GetConfigInfo returns comprehensive configuration information.
func (*ConfigService) GetConfigPath ¶
func (s *ConfigService) GetConfigPath(ctx context.Context) (string, error)
GetConfigPath returns the path to the configuration file.
func (*ConfigService) GetDatabasePath ¶
func (s *ConfigService) GetDatabasePath(ctx context.Context) (string, error)
GetDatabasePath returns the current database path.
func (*ConfigService) GetDefaultBrowser ¶
func (s *ConfigService) GetDefaultBrowser(ctx context.Context) (string, error)
GetDefaultBrowser returns the default browser setting.
func (*ConfigService) GetDmenuSettings ¶
func (s *ConfigService) GetDmenuSettings(ctx context.Context) (*config.DmenuConfig, error)
GetDmenuSettings returns current dmenu settings.
func (*ConfigService) GetRenderingMode ¶
func (s *ConfigService) GetRenderingMode(ctx context.Context) (string, error)
GetRenderingMode returns the current rendering mode (auto|gpu|cpu).
func (*ConfigService) GetSearchShortcuts ¶
func (s *ConfigService) GetSearchShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
GetSearchShortcuts returns all configured search shortcuts.
func (*ConfigService) ImportConfig ¶
ImportConfig imports configuration from a Config object.
func (*ConfigService) ReloadConfig ¶
func (s *ConfigService) ReloadConfig(ctx context.Context) error
ReloadConfig reloads configuration from file.
func (*ConfigService) SetDatabasePath ¶
func (s *ConfigService) SetDatabasePath(ctx context.Context, path string) error
SetDatabasePath updates the database path.
func (*ConfigService) SetDefaultBrowser ¶
func (s *ConfigService) SetDefaultBrowser(ctx context.Context, browser string) error
SetDefaultBrowser updates the default browser setting.
func (*ConfigService) SetRenderingMode ¶
func (s *ConfigService) SetRenderingMode(ctx context.Context, mode string) error
SetRenderingMode updates the rendering mode (auto|gpu|cpu).
func (*ConfigService) UpdateDmenuSettings ¶
func (s *ConfigService) UpdateDmenuSettings(ctx context.Context, settings *config.DmenuConfig) error
UpdateDmenuSettings updates dmenu configuration.
func (*ConfigService) UpdateSearchShortcut ¶
func (s *ConfigService) UpdateSearchShortcut(ctx context.Context, key string, shortcut config.SearchShortcut) error
UpdateSearchShortcut updates an existing search shortcut.
func (*ConfigService) ValidateConfig ¶
func (s *ConfigService) ValidateConfig(ctx context.Context) ([]string, error)
ValidateConfig validates the current configuration.
type DatabaseHistoryProvider ¶
type DatabaseHistoryProvider struct {
// contains filtered or unexported fields
}
DatabaseHistoryProvider implements HistoryProvider using the database.
func (*DatabaseHistoryProvider) GetAllHistory ¶
func (h *DatabaseHistoryProvider) GetAllHistory() ([]*db.History, error)
GetAllHistory returns all history entries for fuzzy search.
func (*DatabaseHistoryProvider) GetHistoryByURL ¶
func (h *DatabaseHistoryProvider) GetHistoryByURL(url string) (*db.History, error)
GetHistoryByURL retrieves history entry by exact URL match.
func (*DatabaseHistoryProvider) GetRecentHistory ¶
func (h *DatabaseHistoryProvider) GetRecentHistory(limit int) ([]*db.History, error)
GetRecentHistory returns recent history entries limited by count.
func (*DatabaseHistoryProvider) SearchHistory ¶
SearchHistory performs a basic text search in history.
type HistoryEntry ¶
type HistoryEntry struct {
ID int64 `json:"id"`
URL string `json:"url"`
Title string `json:"title"`
VisitCount int32 `json:"visit_count"`
LastVisited time.Time `json:"last_visited"`
CreatedAt time.Time `json:"created_at"`
}
HistoryEntry represents a simplified history entry for frontend.
type NavigationResult ¶
type NavigationResult struct {
}
NavigationResult represents the result of a navigation operation.
type ParserService ¶
type ParserService struct {
// contains filtered or unexported fields
}
ParserService wraps the parser functionality for the application.
func NewParserService ¶
func NewParserService(cfg *config.Config, queries *db.Queries) *ParserService
NewParserService creates a new ParserService instance.
func (*ParserService) CalculateSimilarity ¶
CalculateSimilarity calculates similarity between two strings.
func (*ParserService) FuzzySearchHistory ¶
func (s *ParserService) FuzzySearchHistory( ctx context.Context, query string, threshold float64, ) ([]parser.FuzzyMatch, error)
FuzzySearchHistory performs fuzzy search on history entries.
func (*ParserService) GetCompletions ¶
func (s *ParserService) GetCompletions(ctx context.Context, input string, limit int) ([]string, error)
GetCompletions provides URL/search completions based on input.
func (*ParserService) GetFuzzyConfig ¶
func (s *ParserService) GetFuzzyConfig(ctx context.Context) (*parser.FuzzyConfig, error)
GetFuzzyConfig returns current fuzzy matching configuration.
func (*ParserService) GetSupportedShortcuts ¶
func (s *ParserService) GetSupportedShortcuts(ctx context.Context) (map[string]config.SearchShortcut, error)
GetSupportedShortcuts returns configured search shortcuts.
func (*ParserService) ParseInput ¶
func (s *ParserService) ParseInput(ctx context.Context, input string) (*parser.ParseResult, error)
ParseInput parses user input and returns navigation result.
func (*ParserService) PreviewParse ¶
func (s *ParserService) PreviewParse(ctx context.Context, input string) (*parser.ParseResult, error)
PreviewParse provides a preview of what ParseInput would return.
func (*ParserService) ProcessShortcut ¶
func (s *ParserService) ProcessShortcut(ctx context.Context, shortcut, query string) (string, error)
ProcessShortcut processes a shortcut and returns the resulting URL.
func (*ParserService) UpdateFuzzyConfig ¶
func (s *ParserService) UpdateFuzzyConfig(ctx context.Context, config *parser.FuzzyConfig) error
UpdateFuzzyConfig updates the fuzzy matching configuration.
func (*ParserService) ValidateURL ¶
ValidateURL checks if the input represents a valid URL.
type WindowTitleUpdater ¶
type WindowTitleUpdater interface {
SetTitle(title string)
}
WindowTitleUpdater interface allows the service to update the window title Decoupled from any specific GUI framework.