mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-09-12 17:53:13 +08:00
Fixed a bug when script download failed
This commit is contained in:
parent
a0d799c832
commit
ff9586f2bd
@ -703,6 +703,11 @@ function service() {
|
||||
let content;
|
||||
switch (action) {
|
||||
case "upload":
|
||||
// update syncTime.
|
||||
const settings = $.read(SETTINGS_KEY);
|
||||
settings.syncTime = new Date().getTime();
|
||||
$.write(settings, SETTINGS_KEY);
|
||||
|
||||
content = $.read("#sub-store");
|
||||
$.info(`上传备份中...`);
|
||||
await gist.upload({filename: GIST_BACKUP_FILE_NAME, content});
|
||||
@ -2642,14 +2647,18 @@ var ProxyUtils = (function () {
|
||||
const {mode, content} = item.args;
|
||||
if (mode === "link") {
|
||||
// if this is remote script, download it
|
||||
script = await $.http
|
||||
.get(content)
|
||||
.then((resp) => resp.body)
|
||||
.catch((err) => {
|
||||
throw new Error(
|
||||
`Error when downloading remote script: ${item.args.content}.\n Reason: ${err}`
|
||||
);
|
||||
});
|
||||
try {
|
||||
script = await $.http
|
||||
.get(content)
|
||||
.then((resp) => resp.body);
|
||||
} catch (err) {
|
||||
$.error(
|
||||
`Error when downloading remote script: ${item.args.content}.\n Reason: ${err}`
|
||||
);
|
||||
// skip the script if download failed.
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
script = content;
|
||||
}
|
||||
@ -2959,7 +2968,7 @@ var RuleUtils = (function () {
|
||||
let matched;
|
||||
try {
|
||||
matched = parser.test(raw);
|
||||
} catch {
|
||||
} catch(err) {
|
||||
matched = false;
|
||||
}
|
||||
if (matched) {
|
||||
|
4
backend/sub-store.min.js
vendored
4
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user