mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
feat(metadata): add external HTTP metadata providers
Register book-metadata-provider services by address, with no code change per provider; Settings lists ready-made ones to install. Ranking prefers a record of the book's own medium. LubimyCzytac moves out to its own provider and Aladin, whose API closes, is retired; their ids stay. Adds migrations 0129 and 0130. See docs/METADATA_PROVIDERS.md. Ref #1405
This commit is contained in:
@@ -13,6 +13,7 @@ export const appConfig = registerAs('app', () => ({
|
||||
version: process.env.APP_VERSION ?? 'Local build',
|
||||
githubReleasesRepo: process.env.GITHUB_RELEASES_REPO?.trim() || 'bookorbit/bookorbit',
|
||||
githubReleasesToken: process.env.GITHUB_RELEASES_TOKEN?.trim() || undefined,
|
||||
metadataProviderDirectoryUrl: parseDirectoryUrl(process.env.METADATA_PROVIDER_DIRECTORY_URL),
|
||||
oidcAllowLocalIssuers: parseBooleanFlag(process.env.OIDC_ALLOW_LOCAL_ISSUERS, false),
|
||||
swaggerEnabled: parseBooleanFlag(process.env.SWAGGER_ENABLED, false),
|
||||
koboCloudscraperPython: process.env.KOBO_CLOUDSCRAPER_PYTHON?.trim() || undefined,
|
||||
@@ -134,3 +135,12 @@ function parseBooleanFlag(value: string | undefined, fallback: boolean): boolean
|
||||
if (['false', '0', 'no', 'off'].includes(normalized)) return false;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
const DEFAULT_METADATA_PROVIDER_DIRECTORY_URL = 'https://raw.githubusercontent.com/bookorbit/bookorbit-metadata-providers/main/directory.json';
|
||||
|
||||
/** Null when the online list of ready-made metadata providers is turned off. */
|
||||
function parseDirectoryUrl(value: string | undefined): string | null {
|
||||
const trimmed = value?.trim();
|
||||
if (!trimmed) return DEFAULT_METADATA_PROVIDER_DIRECTORY_URL;
|
||||
return trimmed.toLowerCase() === 'off' ? null : trimmed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user