From 14d9885db8d2ae89b2316185d9101841850341b7 Mon Sep 17 00:00:00 2001 From: xream Date: Tue, 16 Jan 2024 23:41:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8D=E4=B8=8A=E4=BC=A0=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=AE=BE=E7=BD=AE=E6=9D=A5=E6=BA=90=E7=9A=84=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/restful/sync.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index d275aac..56f20bf 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.169", + "version": "2.14.170", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index 9f65781..baa8508 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -449,7 +449,7 @@ async function syncArtifacts() { try { await Promise.all( allArtifacts.map(async (artifact) => { - if (artifact.sync) { + if (artifact.sync && artifact.source) { $.info(`正在同步云配置:${artifact.name}...`); const output = await produceArtifact({ type: artifact.type, @@ -516,7 +516,20 @@ async function syncArtifact(req, res) { res, new ResourceNotFoundError( 'RESOURCE_NOT_FOUND', - `Artifact ${name} does not exist!`, + `找不到远程配置 ${name}`, + ), + 404, + ); + return; + } + + if (!artifact.source) { + $.error(`远程配置 ${name} 未设置来源`); + failed( + res, + new ResourceNotFoundError( + 'RESOURCE_HAS_NO_SOURCE', + `远程配置 ${name} 未设置来源`, ), 404, );