diff --git a/backend/package.json b/backend/package.json index 63b7791..0b1b6c8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.298", + "version": "2.14.299", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/artifacts.js b/backend/src/restful/artifacts.js index ef6a740..e4626a3 100644 --- a/backend/src/restful/artifacts.js +++ b/backend/src/restful/artifacts.js @@ -253,7 +253,25 @@ async function syncToGist(files) { key: ARTIFACT_REPOSITORY_KEY, syncPlatform, }); - return manager.upload(files); + const res = await manager.upload(files); + let body = {}; + try { + body = JSON.parse(res.body); + // eslint-disable-next-line no-empty + } catch (e) {} + + const url = body?.html_url ?? body?.web_url; + const settings = $.read(SETTINGS_KEY); + if (url) { + $.log(`同步 Gist 后, 找到 Sub-Store Gist: ${url}`); + settings.artifactStore = url; + settings.artifactStoreStatus = 'VALID'; + } else { + $.error(`同步 Gist 后, 找不到 Sub-Store Gist`); + settings.artifactStoreStatus = 'NOT FOUND'; + } + $.write(settings, SETTINGS_KEY); + return res; } export { syncToGist }; diff --git a/backend/src/utils/gist.js b/backend/src/utils/gist.js index 20e4cd1..78b1075 100644 --- a/backend/src/utils/gist.js +++ b/backend/src/utils/gist.js @@ -135,9 +135,9 @@ export default class Gist { } } }); - console.log(`result`, result); - console.log(`files`, files); - console.log(`actions`, actions); + // console.log(`result`, result); + // console.log(`files`, files); + // console.log(`actions`, actions); if (this.syncPlatform === 'gitlab') { if (Object.keys(result).length === 0) {