修正观影室管理面板设置

This commit is contained in:
mtvpls
2025-12-08 10:03:25 +08:00
parent 857f7ce73e
commit b99a495a8a
7 changed files with 322 additions and 68 deletions
+28 -1
View File
@@ -10,11 +10,38 @@ export const runtime = 'nodejs';
export async function GET(request: NextRequest) {
console.log('server-config called: ', request.url);
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';
// 如果使用 localStorage,返回默认配置
if (storageType === 'localstorage') {
return NextResponse.json({
SiteName: process.env.NEXT_PUBLIC_SITE_NAME || 'MoonTV',
StorageType: 'localstorage',
Version: CURRENT_VERSION,
// localStorage 模式下,返回默认观影室配置
// 可以通过环境变量控制是否启用
WatchRoom: {
enabled: process.env.WATCH_ROOM_ENABLED === 'true',
serverType: 'internal',
externalServerUrl: undefined,
externalServerAuth: undefined,
},
});
}
// 非 localStorage 模式,从数据库读取配置
const config = await getConfig();
const result = {
SiteName: config.SiteConfig.SiteName,
StorageType: process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage',
StorageType: storageType,
Version: CURRENT_VERSION,
// 添加观影室配置(供所有用户访问)
WatchRoom: {
enabled: config.WatchRoomConfig?.enabled ?? false,
serverType: config.WatchRoomConfig?.serverType ?? 'internal',
externalServerUrl: config.WatchRoomConfig?.externalServerUrl,
externalServerAuth: config.WatchRoomConfig?.externalServerAuth,
},
};
return NextResponse.json(result);
}