mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 17:48:58 +08:00
Node.js 版的通知支持第三方推送服务. 环境变量名 SUB_STORE_PUSH_SERVICE
. 支持 Bark/PushPlus 等服务. 形如: https://api.day.app/XXXXXXXXX/[推送标题]/[推送内容]?group=SubStore&autoCopy=1&isArchive=1&sound=shake&level=timeSensitive
或 http://www.pushplus.plus/send?token=XXXXXXXXX&title=[推送标题]&content=[推送内容]&channel=wechat
的 URL, [推送标题]
和 [推送内容]
会被自动替换
This commit is contained in:
parent
de1d40f41a
commit
9bb4739d56
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.137",
|
"version": "2.14.139",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
26
backend/src/vendor/open-api.js
vendored
26
backend/src/vendor/open-api.js
vendored
@ -191,6 +191,32 @@ export class OpenAPI {
|
|||||||
(openURL ? `\n点击跳转: ${openURL}` : '') +
|
(openURL ? `\n点击跳转: ${openURL}` : '') +
|
||||||
(mediaURL ? `\n多媒体: ${mediaURL}` : '');
|
(mediaURL ? `\n多媒体: ${mediaURL}` : '');
|
||||||
console.log(`${title}\n${subtitle}\n${content_}\n\n`);
|
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}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user