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,6 +51,7 @@ 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) {
if (artifact.sync) {
artifact.updated = new Date().getTime(); artifact.updated = new Date().getTime();
// extract real url from gist // extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace( artifact.url = body.files[artifact.name].raw_url.replace(
@ -58,6 +59,7 @@ async function doSync() {
'/raw/$1', '/raw/$1',
); );
} }
}
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);
$.notify('🌍 Sub-Store', '全部订阅同步成功!'); $.notify('🌍 Sub-Store', '全部订阅同步成功!');

View File

@ -201,6 +201,7 @@ 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) {
if (artifact.sync) {
artifact.updated = new Date().getTime(); artifact.updated = new Date().getTime();
// extract real url from gist // extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace( artifact.url = body.files[artifact.name].raw_url.replace(
@ -208,6 +209,7 @@ async function syncAllArtifacts(_, res) {
'/raw/$1', '/raw/$1',
); );
} }
}
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);
$.info('全部订阅同步成功!'); $.info('全部订阅同步成功!');