diff --git a/backend/package.json b/backend/package.json index 6d5e44e..d947dde 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.40", + "version": "2.16.41", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/collections.js b/backend/src/restful/collections.js index f6ff1b3..cdf29cb 100644 --- a/backend/src/restful/collections.js +++ b/backend/src/restful/collections.js @@ -59,7 +59,18 @@ function getCollection(req, res) { res.set('content-type', 'application/json') .set( 'content-disposition', - `attachment; filename="${encodeURIComponent(name)}.json"`, + `attachment; filename="${encodeURIComponent( + `sub-store_collection_${name}_${new Date() + .toLocaleString('zh-CN', { + year: 'numeric', + day: 'numeric', + month: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }) + .replace(/\D/g, '')}.json`, + )}"`, ) .send(JSON.stringify(collection)); } else { diff --git a/backend/src/restful/file.js b/backend/src/restful/file.js index 210d9ff..51ee72e 100644 --- a/backend/src/restful/file.js +++ b/backend/src/restful/file.js @@ -209,7 +209,18 @@ function getWholeFile(req, res) { res.set('content-type', 'application/json') .set( 'content-disposition', - `attachment; filename="${encodeURIComponent(name)}.json"`, + `attachment; filename="${encodeURIComponent( + `sub-store_file_${name}_${new Date() + .toLocaleString('zh-CN', { + year: 'numeric', + day: 'numeric', + month: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }) + .replace(/\D/g, '')}.json`, + )}"`, ) .send(JSON.stringify(file)); } else { diff --git a/backend/src/restful/miscs.js b/backend/src/restful/miscs.js index 4d90fe6..ea650a5 100644 --- a/backend/src/restful/miscs.js +++ b/backend/src/restful/miscs.js @@ -27,7 +27,18 @@ export default function register($app) { res.set('content-type', 'application/json') .set( 'content-disposition', - 'attachment; filename="sub-store.json"', + `attachment; filename="${encodeURIComponent( + `sub-store_data_${new Date() + .toLocaleString('zh-CN', { + year: 'numeric', + day: 'numeric', + month: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }) + .replace(/\D/g, '')}.json`, + )}"`, ) .send( $.env.isNode diff --git a/backend/src/restful/subscriptions.js b/backend/src/restful/subscriptions.js index 6ec5847..d8425f6 100644 --- a/backend/src/restful/subscriptions.js +++ b/backend/src/restful/subscriptions.js @@ -264,7 +264,18 @@ function getSubscription(req, res) { res.set('content-type', 'application/json') .set( 'content-disposition', - `attachment; filename="${encodeURIComponent(name)}.json"`, + `attachment; filename="${encodeURIComponent( + `sub-store_subscription_${name}_${new Date() + .toLocaleString('zh-CN', { + year: 'numeric', + day: 'numeric', + month: 'numeric', + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }) + .replace(/\D/g, '')}.json`, + )}"`, ) .send(JSON.stringify(sub)); } else {