mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
PushMe 通知支持自建服务 (#2358)
This commit is contained in:
parent
0b52e05af8
commit
8dd379b6b9
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -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内容的位置",
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user