Skip to content

Commit 58dc280

Browse files
author
Hiram
committed
[bugs] fix xbpq ext is url not load
1 parent 3db8004 commit 58dc280

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/renderer/src/utils/cms.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ const xbpqInit = async (site) => {
144144

145145
let ext = site.ext;
146146
try {
147+
if (typeof ext === 'string' && ext.startsWith('http')) {
148+
ext = await request({
149+
method: 'GET',
150+
url: ext,
151+
});
152+
}
147153
ext = JSON5.parse(site.ext);
148154
} catch (err) {}
149155

src/renderer/src/utils/xbpq/adapter.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -498,18 +498,6 @@ class XBPQAdapter {
498498
this.source = source;
499499
this.XBPQRule = source.ext;
500500

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-
513501
if (source.click) {
514502
this.XBPQRule['click'] = source.click;
515503
}

0 commit comments

Comments
 (0)