From 9bb4739d568f3cec51ec17c163cdabd2b925236a Mon Sep 17 00:00:00 2001 From: xream Date: Tue, 2 Jan 2024 22:45:21 +0800 Subject: [PATCH] =?UTF-8?q?Node.js=20=E7=89=88=E7=9A=84=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=AC=AC=E4=B8=89=E6=96=B9=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1.=20=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=90=8D=20`SUB=5FSTORE=5FPUSH=5FSERVICE`.=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20Bark/PushPlus=20=E7=AD=89=E6=9C=8D=E5=8A=A1.=20?= =?UTF-8?q?=E5=BD=A2=E5=A6=82:=20`https://api.day.app/XXXXXXXXX/[=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E6=A0=87=E9=A2=98]/[=E6=8E=A8=E9=80=81=E5=86=85?= =?UTF-8?q?=E5=AE=B9]=3Fgroup=3DSubStore&autoCopy=3D1&isArchive=3D1&sound?= =?UTF-8?q?=3Dshake&level=3DtimeSensitive`=20=E6=88=96=20`http://www.pushp?= =?UTF-8?q?lus.plus/send=3Ftoken=3DXXXXXXXXX&title=3D[=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=A0=87=E9=A2=98]&content=3D[=E6=8E=A8=E9=80=81=E5=86=85?= =?UTF-8?q?=E5=AE=B9]&channel=3Dwechat`=20=E7=9A=84=20URL,=20`[=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E6=A0=87=E9=A2=98]`=20=E5=92=8C=20`[=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=86=85=E5=AE=B9]`=20=E4=BC=9A=E8=A2=AB=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/vendor/open-api.js | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) 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}`); + }); + } } }