diff --git a/backend/package.json b/backend/package.json index 6bc43a1..cdf5555 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.137", + "version": "2.14.139", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/vendor/open-api.js b/backend/src/vendor/open-api.js index 5bb37d7..6f30858 100644 --- a/backend/src/vendor/open-api.js +++ b/backend/src/vendor/open-api.js @@ -191,6 +191,32 @@ export class OpenAPI { (openURL ? `\n点击跳转: ${openURL}` : '') + (mediaURL ? `\n多媒体: ${mediaURL}` : ''); console.log(`${title}\n${subtitle}\n${content_}\n\n`); + + let push = eval('process.env.SUB_STORE_PUSH_SERVICE'); + if (push) { + const url = push + .replace( + '[推送标题]', + encodeURIComponent(title || 'Sub-Store'), + ) + .replace( + '[推送内容]', + encodeURIComponent( + [subtitle, content_].map((i) => i).join('\n'), + ), + ); + const $http = HTTP(); + $http + .get({ url }) + .then((resp) => { + console.log( + `[Push Service] URL: ${url}\nRES: ${resp.statusCode} ${resp.body}`, + ); + }) + .catch((e) => { + console.log(`[Push Service] URL: ${url}\nERROR: ${e}`); + }); + } } }