File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,12 @@ const xbpqInit = async (site) => {
144
144
145
145
let ext = site . ext ;
146
146
try {
147
+ if ( typeof ext === 'string' && ext . startsWith ( 'http' ) ) {
148
+ ext = await request ( {
149
+ method : 'GET' ,
150
+ url : ext ,
151
+ } ) ;
152
+ }
147
153
ext = JSON5 . parse ( site . ext ) ;
148
154
} catch ( err ) { }
149
155
Original file line number Diff line number Diff line change @@ -498,18 +498,6 @@ class XBPQAdapter {
498
498
this . source = source ;
499
499
this . XBPQRule = source . ext ;
500
500
501
- // 检查source.ext是否为字符串类型,如果是,则尝试解析JSON5格式的字符串
502
- if ( typeof source . ext === 'string' && source . ext . startsWith ( 'http' ) ) {
503
- // 注意:fetch函数是异步的,这里需要处理异步逻辑
504
- // 以下代码仅为示例,实际使用时需要根据具体情况调整
505
- fetch ( source . ext )
506
- . then ( ( response ) => response . text ( ) )
507
- . then ( ( text ) => {
508
- this . XBPQRule = JSON5 . parse ( text ) ;
509
- } )
510
- . catch ( ( error ) => console . error ( 'Fetch error:' , error ) ) ;
511
- }
512
-
513
501
if ( source . click ) {
514
502
this . XBPQRule [ 'click' ] = source . click ;
515
503
}
You can’t perform that action at this time.
0 commit comments