picacg: re-login if login expires while loading comic information

This commit is contained in:
2025-01-21 16:30:05 +08:00
parent 65aeab9e75
commit 6a79adb56b
2 changed files with 13 additions and 3 deletions

View File

@@ -21,7 +21,7 @@
"name": "Picacg", "name": "Picacg",
"fileName": "picacg.js", "fileName": "picacg.js",
"key": "picacg", "key": "picacg",
"version": "1.0.0" "version": "1.0.1"
}, },
{ {
"name": "nhentai", "name": "nhentai",

View File

@@ -3,7 +3,7 @@ class Picacg extends ComicSource {
key = "picacg" key = "picacg"
version = "1.0.0" version = "1.0.1"
minAppVersion = "1.0.0" minAppVersion = "1.0.0"
@@ -445,7 +445,17 @@ class Picacg extends ComicSource {
}) })
return comics return comics
} }
let [info, eps, related] = await Promise.all([infoLoader(), epsLoader(), relatedLoader()]) let info, eps, related
try {
[info, eps, related] = await Promise.all([infoLoader(), epsLoader(), relatedLoader()])
}
catch (e) {
if (e === 'Invalid status code: 401') {
await this.account.reLogin();
[info, eps, related] = await Promise.all([infoLoader(), epsLoader(), relatedLoader()]);
}
throw e
}
let tags = {} let tags = {}
if(info.author) { if(info.author) {
tags['Author'] = [info.author]; tags['Author'] = [info.author];