Skip to content

Commit 670c13b

Browse files
authored
v2.0: optimzed performance, dropped 3rd party jslib
1 parent b0be544 commit 670c13b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

RawMangaAssistant.user.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ let locale = {
7575
aria2: {
7676
label: 'Download with Aria2',
7777
done: '%n% images are sent to Download with Aria2',
78-
error: 'Please config Download with Aria2 correctly'
78+
error: 'Please config Download with Aria2 correctly',
79+
fatal: '"Download With Aria2" is either not installed, disabled, or lower than v4.17.0.3548'
7980
},
8081
gotop: {
8182
label: 'Back to Top',
@@ -97,8 +98,9 @@ let locale = {
9798
},
9899
aria2: {
99100
label: '通过 Aria2 下载',
100-
done: '%n% 个图片已传入通过 Aria2 下载',
101-
error: '请检查通过 Aria2 下载是否正确配置'
101+
done: '%n% 个图片已传入"通过 Aria2 下载"',
102+
error: '请检查"通过 Aria2 下载"是否正确配置',
103+
fatal: '"通过 Aria2 下载" 未安装,或未启用,或版本低于4.17.0.3548'
102104
},
103105
gotop: {
104106
label: '回到顶部',
@@ -196,11 +198,8 @@ function downloadWithAria2() {
196198
params.push({ url, options });
197199
}
198200
let { result, error } = await bridge('aria2c_download', params);
199-
if (result) {
200-
notification('aria2', 'done');
201-
} else {
202-
notification('aria2', 'error');
203-
}
201+
let action = result ? 'done' : 'error';
202+
notification('aria2', action);
204203
}).catch(notification);
205204
}
206205

@@ -304,7 +303,7 @@ function bridge(aria2c, params) {
304303
let id = crypto.randomUUID();
305304
let timer = setTimeout(() => {
306305
delete message[id];
307-
reject( new Error('"Download With Aria2" is either not installed, disabled, or lower than v4.17.0.3548.') );
306+
reject( new Error() );
308307
}, 3000);
309308
message[id] = (result) => {
310309
clearTimeout(timer);

0 commit comments

Comments
 (0)