diff --git a/backend/package.json b/backend/package.json index 89c90381..0e21b3eb 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.20.82", + "version": "2.20.83", "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 f1723978..5cb3c6f8 100644 --- a/backend/src/restful/artifacts.js +++ b/backend/src/restful/artifacts.js @@ -160,14 +160,16 @@ function createArtifact(req, res) { } function updateArtifact(req, res) { + let artifact = req.body; const allArtifacts = $.read(ARTIFACTS_KEY); let oldName = req.params.name; - const artifact = findByName(allArtifacts, oldName); - if (artifact) { - $.info(`正在更新远程配置:${artifact.name}`); + const oldArtifact = findByName(allArtifacts, oldName); + if (oldArtifact) { + if (!artifact.name) artifact.name = oldArtifact.name; + $.info(`正在更新远程配置:${oldArtifact.name}`); const newArtifact = { + ...oldArtifact, ...artifact, - ...req.body, }; if (!validateArtifactName(newArtifact.name)) { failed( diff --git a/backend/src/restful/collections.js b/backend/src/restful/collections.js index 852a1a80..6b3b55fc 100644 --- a/backend/src/restful/collections.js +++ b/backend/src/restful/collections.js @@ -87,6 +87,7 @@ function updateCollection(req, res) { const allCols = $.read(COLLECTIONS_KEY); const oldCol = findByName(allCols, name); if (oldCol) { + if (!collection.name) collection.name = oldCol.name; const newCol = { ...oldCol, ...collection, diff --git a/backend/src/restful/file.js b/backend/src/restful/file.js index 1ee2ba97..5a9c988d 100644 --- a/backend/src/restful/file.js +++ b/backend/src/restful/file.js @@ -267,6 +267,7 @@ function updateFile(req, res) { const allFiles = $.read(FILES_KEY); const oldFile = findByName(allFiles, name); if (oldFile) { + if (!file.name) file.name = oldFile.name; const newFile = { ...oldFile, ...file, diff --git a/backend/src/restful/subscriptions.js b/backend/src/restful/subscriptions.js index 35b50ce5..936a115b 100644 --- a/backend/src/restful/subscriptions.js +++ b/backend/src/restful/subscriptions.js @@ -298,6 +298,7 @@ function updateSubscription(req, res) { const allSubs = $.read(SUBS_KEY); const oldSub = findByName(allSubs, name); if (oldSub) { + if (!sub.name) sub.name = oldSub.name; const newSub = { ...oldSub, ...sub,