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) GetGUIBundle() string
- 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) GetRecentHistoryWithOffset(ctx context.Context, limit, offset 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) InjectGUIBundle(ctx context.Context) error
- func (s *BrowserService) InjectToastSystem(ctx context.Context, theme string) error
- func (s *BrowserService) LoadGUIBundle(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 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 ¶
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) GetGUIBundle ¶
func (s *BrowserService) GetGUIBundle() string
GetGUIBundle returns the loaded GUI bundle string
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) GetRecentHistoryWithOffset ¶
func (s *BrowserService) GetRecentHistoryWithOffset(ctx context.Context, limit, offset int) ([]HistoryEntry, error)
GetRecentHistoryWithOffset returns recent browser history entries with pagination support.
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) InjectGUIBundle ¶
func (s *BrowserService) InjectGUIBundle(ctx context.Context) error
InjectGUIBundle injects the unified GUI bundle and initializes controls
func (*BrowserService) InjectToastSystem ¶
func (s *BrowserService) InjectToastSystem(ctx context.Context, theme string) error
InjectToastSystem injects the GUI bundle and initializes the toast system
func (*BrowserService) LoadGUIBundle ¶
func (s *BrowserService) LoadGUIBundle(assets embed.FS) error
LoadGUIBundle loads the unified GUI bundle 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 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"`
FaviconURL string `json:"favicon_url"`
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.