修复未配置opds源不显示电子书馆入口
This commit is contained in:
+5
-12
@@ -113,12 +113,8 @@ export default async function RootLayout({
|
|||||||
let musicFeatureEnabled = false;
|
let musicFeatureEnabled = false;
|
||||||
let suwayomiEnabled = false;
|
let suwayomiEnabled = false;
|
||||||
let booksEnabled =
|
let booksEnabled =
|
||||||
process.env.OPDS_ENABLED === 'true' &&
|
process.env.OPDS_ENABLED === 'true' ||
|
||||||
!!(
|
process.env.LEGADO_ENABLED === 'true';
|
||||||
process.env.OPDS_URL ||
|
|
||||||
process.env.NEXT_PUBLIC_OPDS_URL ||
|
|
||||||
process.env.OPDS_SOURCES_JSON
|
|
||||||
);
|
|
||||||
let musicProxyEnabled = true;
|
let musicProxyEnabled = true;
|
||||||
let advancedRecommendationEnabled = false;
|
let advancedRecommendationEnabled = false;
|
||||||
let userFeatureAccess =
|
let userFeatureAccess =
|
||||||
@@ -201,12 +197,9 @@ export default async function RootLayout({
|
|||||||
);
|
);
|
||||||
// 电子书功能配置
|
// 电子书功能配置
|
||||||
const opdsConfig = config.OPDSConfig;
|
const opdsConfig = config.OPDSConfig;
|
||||||
const rawOpdsSources = opdsConfig?.Sources;
|
// 电子书馆同时支持 OPDS 与 Legado。Legado 源通过订阅单独配置,
|
||||||
const opdsSources = Array.isArray(rawOpdsSources) ? rawOpdsSources : [];
|
// 不一定会出现在 OPDS Sources 中;入口应由“启用电子书馆”开关控制。
|
||||||
booksEnabled = !!(
|
booksEnabled = !!opdsConfig?.Enabled;
|
||||||
opdsConfig?.Enabled &&
|
|
||||||
opdsSources.some((source) => source?.enabled !== false && !!source?.url)
|
|
||||||
);
|
|
||||||
// 高级推荐功能配置:存在已启用视频源脚本时显示
|
// 高级推荐功能配置:存在已启用视频源脚本时显示
|
||||||
advancedRecommendationEnabled =
|
advancedRecommendationEnabled =
|
||||||
(await listEnabledSourceScripts()).length > 0;
|
(await listEnabledSourceScripts()).length > 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user