File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "name" : " OrionTV" ,
33 "private" : true ,
44 "main" : " expo-router/entry" ,
5- "version" : " 1.3.3 " ,
5+ "version" : " 1.3.4 " ,
66 "scripts" : {
77 "start" : " EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start" ,
88 "android" : " EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo run:android" ,
Original file line number Diff line number Diff line change @@ -208,9 +208,31 @@ export class API {
208208 }
209209
210210 async getResources ( signal ?: AbortSignal ) : Promise < ApiSite [ ] > {
211- const url = `/api/search/resources ` ;
211+ const url = `/api/admin/config ` ;
212212 const response = await this . _fetch ( url , { signal } ) ;
213- return response . json ( ) ;
213+ const config = await response . json ( ) ;
214+
215+ // 添加安全检查
216+ if ( ! config || ! config . Config . SourceConfig ) {
217+ console . warn ( 'API response missing SourceConfig:' , config ) ;
218+ return [ ] ;
219+ }
220+
221+ // 确保 SourceConfig 是数组
222+ if ( ! Array . isArray ( config . Config . SourceConfig ) ) {
223+ console . warn ( 'SourceConfig is not an array:' , config . Config . SourceConfig ) ;
224+ return [ ] ;
225+ }
226+
227+ // 过滤并验证每个站点配置
228+ return config . Config . SourceConfig
229+ . filter ( ( site : any ) => site && ! site . disabled )
230+ . map ( ( site : any ) => ( {
231+ key : site . key || '' ,
232+ api : site . api || '' ,
233+ name : site . name || '' ,
234+ detail : site . detail
235+ } ) ) ;
214236 }
215237
216238 async getVideoDetail ( source : string , id : string ) : Promise < VideoDetail > {
You can’t perform that action at this time.
0 commit comments