diff --git a/back/data/notify.ts b/back/data/notify.ts index dcb317bd..5a46174e 100644 --- a/back/data/notify.ts +++ b/back/data/notify.ts @@ -108,6 +108,7 @@ export class EmailNotification extends NotificationBaseInfo { export class PushMeNotification extends NotificationBaseInfo { public pushMeKey: string = ''; + public pushMeUrl: string = ''; } export class ChronocatNotification extends NotificationBaseInfo { diff --git a/back/services/notify.ts b/back/services/notify.ts index 35f40d47..9ec13123 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -573,13 +573,14 @@ export default class NotificationService { } private async pushMe() { - const { pushMeKey } = this.params; + const { pushMeKey, pushMeUrl } = this.params; try { const res: any = await got.post( - `https://push.i-i.me/?push_key=${pushMeKey}`, + pushMeUrl || 'https://push.i-i.me/', { ...this.gotOption, json: { + push_key: pushMeKey, title: this.title, content: this.content, }, diff --git a/sample/config.sample.sh b/sample/config.sample.sh index 543da592..60d54b12 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -176,7 +176,9 @@ export SMTP_NAME="" ## 15. PushMe ## 官方说明文档:https://push.i-i.me/ ## PUSHME_KEY (必填)填写PushMe APP上获取的push_key +## PUSHME_URL (选填)填写自建的PushMeServer消息服务接口地址,例如:http://127.0.0.1:3010,不填则使用官方接口服务 export PUSHME_KEY="" +export PUSHME_URL="" ## 16. 飞书机器人 ## 官方文档:https://www.feishu.cn/hc/zh-CN/articles/360024984973 diff --git a/sample/notify.js b/sample/notify.js index a86a0aa5..c8f81279 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -935,11 +935,11 @@ async function smtpNotify(text, desp) { function pushMeNotify(text, desp, params = {}) { return new Promise((resolve) => { - const { PUSHME_KEY } = push_config; + const { PUSHME_KEY, PUSHME_URL } = push_config; if (PUSHME_KEY) { const options = { - url: `https://push.i-i.me?push_key=${PUSHME_KEY}`, - json: { title: text, content: desp, ...params }, + url: PUSHME_URL || 'https://push.i-i.me', + json: { push_key: PUSHME_KEY, title: text, content: desp, ...params }, headers: { 'Content-Type': 'application/json', }, diff --git a/sample/notify.py b/sample/notify.py index 800bd477..015a2569 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -101,7 +101,8 @@ push_config = { 'SMTP_PASSWORD': '', # SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定 'SMTP_NAME': '', # SMTP 收发件人姓名,可随意填写 - 'PUSHME_KEY': '', # PushMe 酱的 PUSHME_KEY + 'PUSHME_KEY': '', # PushMe 的 PUSHME_KEY + 'PUSHME_URL': '', # PushMe 的 PUSHME_URL 'CHRONOCAT_QQ': '', # qq号 'CHRONOCAT_TOKEN': '', # CHRONOCAT 的token @@ -668,10 +669,13 @@ def pushme(title: str, content: str) -> None: return print("PushMe 服务启动") - url = f'https://push.i-i.me/?push_key={push_config.get("PUSHME_KEY")}' + url = push_config.get("PUSHME_URL") if push_config.get("PUSHME_URL") else "https://push.i-i.me/" data = { + "push_key": push_config.get("PUSHME_KEY"), "title": title, "content": content, + "date": push_config.get("date") if push_config.get("date") else "", + "type": push_config.get("type") if push_config.get("type") else "", } response = requests.post(url, data=data) diff --git a/src/locales/en-US.json b/src/locales/en-US.json index f8ca6308..ad44c066 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -383,6 +383,7 @@ "邮箱地址": "Email Address", "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "The SMTP login password may also be a special passphrase, depending on the specific email service provider's instructions", "PushMe的Key,https://push.i-i.me/": "PushMe key, https://push.i-i.me/", + "自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口": "The self built PushMeServer message interface address, for example: http://127.0.0.1:3010 If left blank, use the official message interface", "请求方法": "Request Method", "请求头Content-Type": "Request Header Content-Type", "请求链接以http或者https开头。url或者body中必须包含$title,$content可选,对应api内容的位置": "Request URL should start with http or https. URL or body must contain $title, $content is optional and corresponds to the API content position.", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 283ed674..99962611 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -383,6 +383,7 @@ "邮箱地址": "邮箱地址", "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定", "PushMe的Key,https://push.i-i.me/": "PushMe的Key,https://push.i-i.me/", + "自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口": "自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口", "请求方法": "请求方法", "请求头Content-Type": "请求头Content-Type", "请求链接以http或者https开头。url或者body中必须包含$title,$content可选,对应api内容的位置": "请求链接以http或者https开头。url或者body中必须包含$title,$content可选,对应api内容的位置", diff --git a/src/utils/config.ts b/src/utils/config.ts index 06e40920..552d3d88 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -338,6 +338,11 @@ export default { tip: intl.get('PushMe的Key,https://push.i-i.me/'), required: true, }, + { + label: 'pushMeUrl', + tip: intl.get('自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口'), + required: false, + }, ], chronocat: [ {