test prod emby
This commit is contained in:
@@ -302,11 +302,18 @@ async function getInitConfig(configFile: string, subConfig: {
|
||||
export async function getConfig(): Promise<AdminConfig> {
|
||||
// 直接使用内存缓存
|
||||
if (cachedConfig) {
|
||||
console.log('[Config] 使用缓存的配置');
|
||||
console.log('[Config] 缓存中EmbyConfig存在:', !!cachedConfig.EmbyConfig);
|
||||
console.log('[Config] 缓存中EmbyConfig.Sources存在:', !!cachedConfig.EmbyConfig?.Sources);
|
||||
if (cachedConfig.EmbyConfig?.Sources) {
|
||||
console.log('[Config] 缓存中Sources长度:', cachedConfig.EmbyConfig.Sources.length);
|
||||
}
|
||||
return cachedConfig;
|
||||
}
|
||||
|
||||
// 如果正在初始化,等待初始化完成
|
||||
if (configInitPromise) {
|
||||
console.log('[Config] 等待配置初始化完成');
|
||||
return configInitPromise;
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -43,14 +43,24 @@ class EmbyManager {
|
||||
*/
|
||||
private async getSources(): Promise<EmbySourceConfig[]> {
|
||||
const config = await getConfig();
|
||||
console.log('[EmbyManager] 获取配置完成');
|
||||
console.log('[EmbyManager] EmbyConfig存在:', !!config.EmbyConfig);
|
||||
console.log('[EmbyManager] EmbyConfig.Sources存在:', !!config.EmbyConfig?.Sources);
|
||||
console.log('[EmbyManager] EmbyConfig.Sources是数组:', Array.isArray(config.EmbyConfig?.Sources));
|
||||
if (config.EmbyConfig?.Sources) {
|
||||
console.log('[EmbyManager] Sources长度:', config.EmbyConfig.Sources.length);
|
||||
console.log('[EmbyManager] Sources内容:', JSON.stringify(config.EmbyConfig.Sources, null, 2));
|
||||
}
|
||||
|
||||
// 如果是新格式(Sources数组)
|
||||
if (config.EmbyConfig?.Sources && Array.isArray(config.EmbyConfig.Sources)) {
|
||||
console.log('[EmbyManager] 使用新格式Sources,返回', config.EmbyConfig.Sources.length, '个源');
|
||||
return config.EmbyConfig.Sources;
|
||||
}
|
||||
|
||||
// 如果是旧格式(单源配置),转换为数组格式
|
||||
if (config.EmbyConfig?.ServerURL) {
|
||||
console.log('[EmbyManager] 使用旧格式配置,转换为数组');
|
||||
return [{
|
||||
key: 'default',
|
||||
name: 'Emby',
|
||||
@@ -68,6 +78,7 @@ class EmbyManager {
|
||||
}];
|
||||
}
|
||||
|
||||
console.log('[EmbyManager] 没有找到任何Emby配置,返回空数组');
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -130,8 +141,12 @@ class EmbyManager {
|
||||
* 获取所有启用的Emby源配置
|
||||
*/
|
||||
async getEnabledSources(): Promise<EmbySourceConfig[]> {
|
||||
console.log('[EmbyManager] getEnabledSources 被调用');
|
||||
const sources = await this.getSources();
|
||||
return sources.filter(s => s.enabled);
|
||||
console.log('[EmbyManager] 获取到所有源:', sources.length, '个');
|
||||
const enabledSources = sources.filter(s => s.enabled);
|
||||
console.log('[EmbyManager] 过滤后启用的源:', enabledSources.length, '个');
|
||||
return enabledSources;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -127,6 +127,20 @@ export interface IStorage {
|
||||
getUserMovieRequests(userName: string): Promise<string[]>;
|
||||
addUserMovieRequest(userName: string, requestId: string): Promise<void>;
|
||||
removeUserMovieRequest(userName: string, requestId: string): Promise<void>;
|
||||
|
||||
// 新版用户存储(V2)- 可选方法
|
||||
getUserInfoV2?(userName: string): Promise<{
|
||||
role: 'owner' | 'admin' | 'user';
|
||||
banned: boolean;
|
||||
tags?: string[];
|
||||
oidcSub?: string;
|
||||
enabledApis?: string[];
|
||||
created_at: number;
|
||||
playrecord_migrated?: boolean;
|
||||
favorite_migrated?: boolean;
|
||||
skip_migrated?: boolean;
|
||||
last_movie_request_time?: number;
|
||||
} | null>;
|
||||
}
|
||||
|
||||
// 搜索结果数据结构
|
||||
|
||||
Reference in New Issue
Block a user