Documentation
¶
Index ¶
- func ExistingCookiePathOrDefault() string
- func FindConfigFile() (string, bool)
- func Load(cliParams CLIParams) (*Config, *ConfigSource, error)
- func LoadLegacyCookies() (string, string, error)
- func LoadLegacyRSS() (map[string][]RssConfig, error)
- func LoadLegacySites() (map[string]SiteConfig, error)
- func LoadRSSFromPath(path string) (map[string][]RssConfig, error)
- func LoadWithOptions(cliParams CLIParams, options LoadOptions) (*Config, *ConfigSource, error)
- func ResolveCookiesFile(cookiesFile string, tomlPath string) string
- func ResolveDatabasePath(dbPath string, tomlPath string) string
- func TransformTOMLRSS(tomlRSS []TOMLRSSConfig) map[string][]RssConfig
- func TransformTOMLSites(tomlSites map[string]TOMLSiteConfig) map[string]SiteConfig
- type AuthConfig
- type CLIParams
- type Config
- type ConfigSource
- type DatabaseConfig
- type LegacyConfig
- type LoadOptions
- type P115Config
- type P115Option
- type ProxyConfig
- type RssConfig
- type ServerConfig
- type SiteConfig
- type TOMLAuthConfig
- type TOMLConfig
- type TOMLDatabaseConfig
- type TOMLP115Config
- type TOMLProxyConfig
- type TOMLRSSConfig
- type TOMLServerConfig
- type TOMLSiteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistingCookiePathOrDefault ¶
func ExistingCookiePathOrDefault() string
func FindConfigFile ¶
FindConfigFile discovers config.toml in standard locations Returns path and true if found, empty string and false otherwise
func Load ¶
func Load(cliParams CLIParams) (*Config, *ConfigSource, error)
Load discovers and loads configuration from all sources Returns merged configuration and source tracking information
func LoadLegacyCookies ¶
LoadLegacyCookies reads .cookies file using existing search rules Returns cookies string and path, or empty string and empty path if not found
func LoadLegacyRSS ¶
LoadLegacyRSS reads rss.json using existing search rules Returns empty config (not error) when file doesn't exist
func LoadLegacySites ¶
func LoadLegacySites() (map[string]SiteConfig, error)
LoadLegacySites reads node-site-config.json using existing search rules Returns empty config (not error) when file doesn't exist
func LoadRSSFromPath ¶
LoadRSSFromPath loads RSS configuration from a specific file path
func LoadWithOptions ¶
func LoadWithOptions(cliParams CLIParams, options LoadOptions) (*Config, *ConfigSource, error)
LoadWithOptions discovers and loads only the requested file-backed sections.
func ResolveCookiesFile ¶
ResolveCookiesFile resolves cookies_file path relative to config.toml directory If the path is absolute, it is returned as-is If the path is relative, it is resolved relative to the directory containing config.toml
func ResolveDatabasePath ¶
ResolveDatabasePath resolves database path relative to config.toml directory If the path is absolute, it is returned as-is If the path is relative, it is resolved relative to the directory containing config.toml
func TransformTOMLRSS ¶
func TransformTOMLRSS(tomlRSS []TOMLRSSConfig) map[string][]RssConfig
TransformTOMLRSS converts []TOMLRSSConfig to map[string][]RssConfig grouped by site
func TransformTOMLSites ¶
func TransformTOMLSites(tomlSites map[string]TOMLSiteConfig) map[string]SiteConfig
TransformTOMLSites converts map[string]TOMLSiteConfig to map[string]SiteConfig
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Cookies string
}
AuthConfig represents authentication configuration
type CLIParams ¶
type CLIParams struct {
Cookies string
RSSPath string
Port int
PortSet bool
DisableCache bool
DisableCacheSet bool
ChunkDelay int
ChunkDelaySet bool
ChunkSize int
ChunkSizeSet bool
CooldownMinMs int
CooldownMinMsSet bool
CooldownMaxMs int
CooldownMaxMsSet bool
}
CLIParams captures command-line parameters
type Config ¶
type Config struct {
Auth AuthConfig
Server ServerConfig
Database DatabaseConfig
P115 P115Config
Proxy ProxyConfig
RSS map[string][]RssConfig // Keyed by site host
Sites map[string]SiteConfig // Keyed by site host
}
Config represents the unified configuration
func Resolve ¶
func Resolve(cli CLIParams, toml *TOMLConfig, tomlPath string, legacy *LegacyConfig) *Config
Resolve merges configuration from multiple sources according to priority rules Priority: CLI > TOML > Legacy > Defaults
type ConfigSource ¶
type ConfigSource struct {
TOMLPath string // Path to config.toml if loaded
CookiesPath string // Path to cookies file that was read
}
ConfigSource tracks the source of loaded configuration for cookie save operations
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string
}
DatabaseConfig represents database configuration
type LegacyConfig ¶
type LegacyConfig struct {
RSS map[string][]RssConfig
Sites map[string]SiteConfig
Cookies string
CookiesPath string
}
LegacyConfig holds loaded legacy configuration
type LoadOptions ¶
LoadOptions controls which file-backed sections should be loaded.
func LoadAllOptions ¶
func LoadAllOptions() LoadOptions
type P115Config ¶
type P115Config struct {
DisableCache bool
ChunkDelay int
ChunkSize int
CooldownMinMs int
CooldownMaxMs int
}
P115Config represents 115 cloud storage configuration
func (*P115Config) ToP115Option ¶
func (c *P115Config) ToP115Option() P115Option
ToP115Option converts P115Config to P115Option
type P115Option ¶
type P115Option struct {
DisableCache bool
ChunkDelay int
ChunkSize int
CooldownMinMs int
CooldownMaxMs int
}
P115Option represents 115 cloud storage options (local copy to avoid circular dependency)
type ProxyConfig ¶
type ProxyConfig struct {
HTTP string
}
ProxyConfig represents proxy configuration
type RssConfig ¶
type RssConfig struct {
Name string `json:"name"`
Url string `json:"url"`
Cid string `json:"cid,omitempty"`
SavePath string `json:"savepath,omitempty"`
Filter string `json:"filter,omitempty"`
Expiration uint `json:"expiration,omitempty"`
}
RssConfig represents RSS feed configuration (local copy to avoid circular dependency)
type ServerConfig ¶
type ServerConfig struct {
Port int
}
ServerConfig represents server configuration
type SiteConfig ¶
type SiteConfig struct {
HttpsAgent string `json:"httpsAgent,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
SiteConfig represents site-specific HTTP configuration (local copy to avoid circular dependency)
type TOMLAuthConfig ¶
type TOMLAuthConfig struct {
CookiesFile string `toml:"cookies_file"` // Relative to config.toml directory
Cookies string `toml:"cookies"` // Direct cookie string
}
TOMLAuthConfig represents authentication configuration
type TOMLConfig ¶
type TOMLConfig struct {
Auth TOMLAuthConfig `toml:"auth"`
Server TOMLServerConfig `toml:"server"`
Database TOMLDatabaseConfig `toml:"database"`
P115 TOMLP115Config `toml:"p115"`
Proxy TOMLProxyConfig `toml:"proxy"`
RSS []TOMLRSSConfig `toml:"rss"`
Sites map[string]TOMLSiteConfig `toml:"sites"`
}
TOMLConfig represents the structure of config.toml
func LoadTOML ¶
func LoadTOML(path string) (*TOMLConfig, error)
LoadTOML parses config.toml from the given path
type TOMLDatabaseConfig ¶
type TOMLDatabaseConfig struct {
Path string `toml:"path"` // SQLite database file path
}
TOMLDatabaseConfig represents database configuration
type TOMLP115Config ¶
type TOMLP115Config struct {
DisableCache bool `toml:"disable_cache"`
ChunkDelay int `toml:"chunk_delay"`
ChunkSize int `toml:"chunk_size"`
CooldownMinMs int `toml:"cooldown_min_ms"`
CooldownMaxMs int `toml:"cooldown_max_ms"`
}
TOMLP115Config represents 115 cloud storage configuration
type TOMLProxyConfig ¶
type TOMLProxyConfig struct {
HTTP string `toml:"http"` // HTTP proxy URL
}
TOMLProxyConfig represents proxy configuration
type TOMLRSSConfig ¶
type TOMLRSSConfig struct {
Site string `toml:"site"` // Required: host for grouping
Name string `toml:"name"` // Required: feed name
URL string `toml:"url"` // Required: RSS feed URL
Cid string `toml:"cid"` // Optional: 115 directory ID
SavePath string `toml:"savepath"` // Optional: save path
Filter string `toml:"filter"` // Optional: content filter
Expiration uint `toml:"expiration"` // Optional: cache expiration
}
TOMLRSSConfig represents a single RSS feed configuration
type TOMLServerConfig ¶
type TOMLServerConfig struct {
Port int `toml:"port"` // Valid range: 1-65535
}
TOMLServerConfig represents server configuration
type TOMLSiteConfig ¶
type TOMLSiteConfig struct {
HTTPSAgent bool `toml:"https_agent"` // Enable proxy for this site
Headers map[string]string `toml:"headers"` // Custom HTTP headers
}
TOMLSiteConfig represents site-specific HTTP configuration