fix: 不上传没有设置来源的同步配置

This commit is contained in:
xream 2024-01-16 23:41:51 +08:00
parent 1e61088ed8
commit 14d9885db8
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 16 additions and 3 deletions

View File

@ -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": {

View File

@ -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,
);