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
- The built-in default URL (the librarr-sources companion repo)
- On-disk cache of the last successful fetch
The production binary ships no embedded registry — Librarr matches the Prowlarr pattern of fetching its indexer definitions at runtime. The on-disk cache lets subsequent restarts work even if the network is down.
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 ¶
func NormalizeDomain ¶ added in v1.2.0
NormalizeDomain accepts either a hostname or URL and returns only the host. Source drivers that consume domain fields add their own scheme and paths.
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 Load ¶
Load resolves the active registry in this order:
- path — local JSON file (LIBRARR_SOURCES_PATH)
- url — user-supplied HTTP(S) URL (LIBRARR_SOURCES_URL)
- The built-in default URL (librarr-sources)
- cachePath — on-disk copy of the last successful fetch
On a successful HTTP fetch (steps 2 or 3) the body is written to cachePath so subsequent restarts work offline. If every step fails the function returns a non-nil empty Registry — callers can still range over slices, but search will return no results until the registry can be reached.
All inputs 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) Normalize ¶ added in v1.2.0
Normalize canonicalizes host-only fields after any registry or env load.
func (*Registry) WebNovel ¶
func (r *Registry) WebNovel(id string) *WebNovelSite
WebNovel looks up a configured web-novel site by ID. Returns nil if absent.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sourcestest is a test-only helper that exposes the canonical librarr-sources registry as Go bytes/types.
|
Package sourcestest is a test-only helper that exposes the canonical librarr-sources registry as Go bytes/types. |