Documentation
¶
Index ¶
- Constants
- Variables
- func MapSettingsLogLevelToSlog(logLevel string) slog.Level
- type Browser
- type BrowserMatch
- type BrowserService
- type BrowserSettings
- type Plugin
- type PluginServiceProvider
- type PluginSettings
- type Settings
- func (s *Settings) AddRuleToBrowser(b *Browser, matchType, matchValue string)
- func (s *Settings) GetMatchingBrowser(u string) (*Browser, error)
- func (s *Settings) GetSelectableBrowsers() []Browser
- func (s *Settings) NormalizeBrowsers() *Settings
- func (s *Settings) UpdateWithBrowsers(browsers []Browser) *Settings
- type SettingsService
- type URL
- type UiSettings
Constants ¶
View Source
const ( BrowserMatchTypeRegex = "regex" BrowserMatchTypeDomain = "domain" BrowserMatchTypeSite = "site" SourceAuto = "auto" SourceManual = "manual" )
Variables ¶
View Source
var ErrNoMatchFound = errors.New("no match found")
Functions ¶
Types ¶
type BrowserMatch ¶
type BrowserService ¶
type BrowserService interface {
// GetAvailableBrowsers returns a list of available browsers in the system
GetAvailableBrowsers() ([]Browser, error)
// GetDefaultBrowser returns the default browser in the system
GetDefaultBrowser() (Browser, error)
// OpenUrlWithDefaultBrowser launches the given url with the default system browser
OpenUrlWithDefaultBrowser(url string) error
// OpenUrlWithBrowser launches the given url with the given browser
OpenUrlWithBrowser(url string, browser *Browser) error
// AreWeTheDefaultBrowser returns true if Linkquisition is the default browser
AreWeTheDefaultBrowser() bool
// MakeUsTheDefaultBrowser sets Linkquisition as the default browser
MakeUsTheDefaultBrowser() error
// GetIconForBrowser returns the icon for the given browser
GetIconForBrowser(browser Browser) ([]byte, error)
}
type BrowserSettings ¶
type BrowserSettings struct {
Name string `json:"name"`
Command string `json:"command"`
Hidden bool `json:"hidden"`
Source string `json:"source"`
Matches []BrowserMatch `json:"matches"`
}
func (*BrowserSettings) MatchesUrl ¶
func (s *BrowserSettings) MatchesUrl(u string) bool
MatchesUrl returns true if the given url matches any of the browser's rules
type Plugin ¶
type Plugin interface {
// Setup is called when the plugin is being setup
Setup(serviceProvider PluginServiceProvider, config map[string]interface{})
// ModifyUrl is called just before the URL is being matched against the browser-rules
// The plugin can modify the URL and return it (or otherwise just return the original URL)
ModifyUrl(url string) string
}
Plugin is an interface that all plugins must implement
type PluginServiceProvider ¶
PluginServiceProvider is an interface that provides the logger and settings to the plugin This is passed to the plugin as a dependency when being setup.
func NewPluginServiceProvider ¶
func NewPluginServiceProvider(logger *slog.Logger, settings *Settings) PluginServiceProvider
type PluginSettings ¶
type Settings ¶
type Settings struct {
LogLevel string `json:"logLevel,omitempty"`
Browsers []BrowserSettings `json:"browsers"`
Plugins []PluginSettings `json:"plugins,omitempty"`
Ui UiSettings `json:"ui,omitempty"`
}
func GetDefaultSettings ¶
func GetDefaultSettings() *Settings
func (*Settings) AddRuleToBrowser ¶ added in v1.4.6
func (*Settings) GetMatchingBrowser ¶
func (*Settings) GetSelectableBrowsers ¶
func (*Settings) NormalizeBrowsers ¶
NormalizeBrowsers moves hidden browsers to the end of the list
func (*Settings) UpdateWithBrowsers ¶
type SettingsService ¶
type SettingsService interface {
// IsConfigured returns true if the settings have been configured (i.e. the config-file exists)
IsConfigured() (bool, error)
// GetSettings returns the settings, either from the config-file or the default settings
GetSettings() *Settings
// ReadSettings reads the config-file and returns the settings
ReadSettings() (*Settings, error)
// WriteSettings writes the settings to the config-file
WriteSettings(settings *Settings) error
// ScanBrowsers scans (or re-scans) the system for available browsers and creates/updates the config-file
ScanBrowsers() error
// GetLogFilePath returns the path to the config-file
GetLogFilePath() string
// GetLogFolderPath returns the path to the config-file
GetLogFolderPath() string
// GetPluginFolderPath returns the absolute path to the plugin-folder
GetPluginFolderPath() string
}
type UiSettings ¶ added in v1.4.6
type UiSettings struct {
HideKeyboardGuideLabel bool `json:"hideKeyboardGuideLabel,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.
