mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-04-22 13:49:35 +08:00
Bug fixed
This commit is contained in:
parent
583f94e5b3
commit
03bc695ae3
15
backend/.idea/workspace.xml
generated
15
backend/.idea/workspace.xml
generated
@ -20,21 +20,8 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8b97a098-48b2-4e64-a9ef-522fe2d30b52" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/../web/vercel.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/sub-store.js" beforeDir="false" afterPath="$PROJECT_DIR$/sub-store.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/../web/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../web/package-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/../web/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/public/favicon.ico" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/public/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/../web/public/index.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/config.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/router/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/router/index.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/store/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/store/index.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/utils/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/utils/index.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/views/CollectionEditor.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/views/CollectionEditor.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/views/SubEditor.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/views/SubEditor.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../web/src/views/Subscription.vue" beforeDir="false" afterPath="$PROJECT_DIR$/../web/src/views/Subscription.vue" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -91,7 +78,7 @@
|
||||
<workItem from="1598235738199" duration="3192000" />
|
||||
<workItem from="1598323737081" duration="1913000" />
|
||||
<workItem from="1598442849645" duration="8914000" />
|
||||
<workItem from="1598778633049" duration="7671000" />
|
||||
<workItem from="1598778633049" duration="8564000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -12,19 +12,17 @@ const $ = API("sub-store", true);
|
||||
// Constants
|
||||
const SUBS_KEY = "subs";
|
||||
const COLLECTIONS_KEY = "collections";
|
||||
const RESOURCE_CACHE_KEY = "resources";
|
||||
|
||||
// SOME INITIALIZATIONS
|
||||
if (!$.read(SUBS_KEY)) $.write({}, SUBS_KEY);
|
||||
if (!$.read(COLLECTIONS_KEY)) $.write({}, COLLECTIONS_KEY);
|
||||
if (!$.read(RESOURCE_CACHE_KEY)) $.write({}, RESOURCE_CACHE_KEY);
|
||||
|
||||
// BACKEND API
|
||||
const $app = express();
|
||||
|
||||
// download
|
||||
$app.get("/download/:name", downloadSub);
|
||||
$app.get("/download/collection/:name", downloadCollection);
|
||||
$app.get("/download/:name", downloadSub);
|
||||
|
||||
// refresh
|
||||
$app.post("/api/refresh", refreshResource);
|
||||
@ -129,20 +127,12 @@ async function downloadSub(req, res) {
|
||||
}
|
||||
|
||||
async function parseSub(sub, platform) {
|
||||
let raw;
|
||||
const cachedResources = $.read(RESOURCE_CACHE_KEY);
|
||||
if (platform === "Raw") {
|
||||
// use cache if available
|
||||
raw = cachedResources[sub.url];
|
||||
}
|
||||
|
||||
// always download from url
|
||||
raw = raw || await $.http.get(sub.url).then(resp => resp.body).catch(err => {
|
||||
const raw = await $.http.get(sub.url).then(resp => resp.body).catch(err => {
|
||||
throw new Error(err);
|
||||
});
|
||||
cachedResources[sub.url] = raw;
|
||||
|
||||
$.write(cachedResources, RESOURCE_CACHE_KEY);
|
||||
|
||||
$.log("=======================================================================");
|
||||
$.log(`Processing subscription: ${sub.name}, target platform ==> ${platform}.`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user