mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-21 09:14:42 +08:00
fix: overwrite categories with file config when in d1 and upstash
This commit is contained in:
@@ -1 +1 @@
|
||||
20250801133915
|
||||
20250804185737
|
||||
@@ -337,34 +337,15 @@ export async function getConfig(): Promise<AdminConfig> {
|
||||
// 将 Map 转换回数组
|
||||
adminConfig.SourceConfig = Array.from(sourceConfigMap.values());
|
||||
|
||||
// 补全 CustomCategories
|
||||
// 覆盖 CustomCategories
|
||||
const customCategories = fileConfig.custom_category || [];
|
||||
const customCategoriesMap = new Map(
|
||||
adminConfig.CustomCategories.map((c) => [c.query + c.type, c])
|
||||
);
|
||||
|
||||
customCategories.forEach((category) => {
|
||||
customCategoriesMap.set(category.query + category.type, {
|
||||
name: category.name,
|
||||
type: category.type,
|
||||
query: category.query,
|
||||
from: 'config',
|
||||
disabled: false,
|
||||
});
|
||||
});
|
||||
|
||||
// 检查现有 CustomCategories 是否在 fileConfig.custom_categories 中,如果不在则标记为 custom
|
||||
const customCategoriesKeys = new Set(
|
||||
customCategories.map((c) => c.query + c.type)
|
||||
);
|
||||
customCategoriesMap.forEach((category) => {
|
||||
if (!customCategoriesKeys.has(category.query + category.type)) {
|
||||
category.from = 'custom';
|
||||
}
|
||||
});
|
||||
|
||||
// 将 Map 转换回数组
|
||||
adminConfig.CustomCategories = Array.from(customCategoriesMap.values());
|
||||
adminConfig.CustomCategories = customCategories.map((category) => ({
|
||||
name: category.name,
|
||||
type: category.type,
|
||||
query: category.query,
|
||||
from: 'config',
|
||||
disabled: false,
|
||||
}));
|
||||
|
||||
const ownerUser = process.env.USERNAME || '';
|
||||
// 检查配置中的站长用户是否和 USERNAME 匹配,如果不匹配则降级为普通用户
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
'use client';
|
||||
|
||||
const CURRENT_VERSION = '20250801133915';
|
||||
const CURRENT_VERSION = '20250804185737';
|
||||
|
||||
// 版本检查结果枚举
|
||||
export enum UpdateStatus {
|
||||
|
||||
Reference in New Issue
Block a user