Documentation
¶
Overview ¶
Package sources holds the runtime registry of indexer endpoints.
The registry is loaded at startup from one of:
- LIBRARR_SOURCES_PATH — local JSON file (takes precedence)
- LIBRARR_SOURCES_URL — HTTP(S) URL to a JSON file
- embedded defaults — fallback if neither is set or both fail to load
Legacy per-source environment variables (ANNAS_ARCHIVE_DOMAIN, etc.) still take precedence over the registry value when they are set.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnasSpec ¶
type AnnasSpec struct {
Domain string `json:"domain"`
}
AnnasSpec is the configurable endpoint for an Anna's-Archive-style direct-download driver.
type AudioBookBaySpec ¶
type AudioBookBaySpec struct {
Mirrors []string `json:"mirrors"`
Trackers []string `json:"trackers"`
}
AudioBookBaySpec is the mirror + tracker list for an AudioBookBay-style scrape driver.
type MangaDexSpec ¶
type MangaDexSpec struct {
APIURL string `json:"api_url"`
UploadsURL string `json:"uploads_url"`
WebURL string `json:"web_url"`
}
MangaDexSpec carries the three independent endpoints used by the MangaDex driver.
type OpenLibrarySpec ¶
type OpenLibrarySpec struct {
SearchURL string `json:"search_url"`
CoverURL string `json:"cover_url"`
}
OpenLibrarySpec splits search and cover endpoints for the Open Library driver.
type Registry ¶
type Registry struct {
Version int `json:"version"`
Annas AnnasSpec `json:"annas"`
AudioBookBay AudioBookBaySpec `json:"audiobookbay"`
ThePirateBay URLSpec `json:"thepiratebay"`
Gutenberg URLSpec `json:"gutenberg"`
OpenLibrary OpenLibrarySpec `json:"openlibrary"`
Librivox URLSpec `json:"librivox"`
StandardEbooks URLSpec `json:"standardebooks"`
MangaDex MangaDexSpec `json:"mangadex"`
Nyaa URLSpec `json:"nyaa"`
WebNovels []WebNovelSite `json:"webnovels"`
LibgenMirrors []string `json:"libgen_mirrors"`
ZLibraryDefault string `json:"zlibrary_default"`
}
Registry is the in-memory representation of the indexer registry.
func Default ¶
Default returns the embedded fallback registry. Used when no external source is configured or when fetching fails.
func Load ¶
Load resolves the active registry from (in order): a local file path, an HTTP URL, or the embedded defaults. Any error fetching/parsing an external source is logged and the embedded defaults are returned so the binary never fails to start over a missing registry.
path takes precedence over url. Both arguments may be empty.
func (*Registry) ApplyEnvOverrides ¶
ApplyEnvOverrides patches the registry with any legacy per-source environment variables that are set. Returns the (mutated) input registry for chaining. This preserves backwards compatibility for users who configure individual endpoints via env vars instead of editing the registry.
func (*Registry) WebNovel ¶
func (r *Registry) WebNovel(id string) *WebNovelSite
WebNovel looks up a configured web-novel site by ID. Returns nil if absent.