fix: sync artifacts issue (#164)

This commit is contained in:
Jasonzza 2022-09-11 23:52:51 +08:00 committed by GitHub
parent 029900085c
commit 06d0c14abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.13.3", "version": "2.13.4",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -51,12 +51,14 @@ async function doSync() {
const body = JSON.parse(resp.body); const body = JSON.parse(resp.body);
for (const artifact of allArtifacts) { for (const artifact of allArtifacts) {
artifact.updated = new Date().getTime(); if (artifact.sync) {
// extract real url from gist artifact.updated = new Date().getTime();
artifact.url = body.files[artifact.name].raw_url.replace( // extract real url from gist
/\/raw\/[^/]*\/(.*)/, artifact.url = body.files[artifact.name].raw_url.replace(
'/raw/$1', /\/raw\/[^/]*\/(.*)/,
); '/raw/$1',
);
}
} }
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);

View File

@ -201,12 +201,14 @@ async function syncAllArtifacts(_, res) {
const body = JSON.parse(resp.body); const body = JSON.parse(resp.body);
for (const artifact of allArtifacts) { for (const artifact of allArtifacts) {
artifact.updated = new Date().getTime(); if (artifact.sync) {
// extract real url from gist artifact.updated = new Date().getTime();
artifact.url = body.files[artifact.name].raw_url.replace( // extract real url from gist
/\/raw\/[^/]*\/(.*)/, artifact.url = body.files[artifact.name].raw_url.replace(
'/raw/$1', /\/raw\/[^/]*\/(.*)/,
); '/raw/$1',
);
}
} }
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);