diff --git a/dailycheckin/configs.py b/dailycheckin/configs.py
old mode 100755
new mode 100644
index b8c0da1c5..d6cc29465
--- a/dailycheckin/configs.py
+++ b/dailycheckin/configs.py
@@ -41,6 +41,12 @@ def checkin_map():
"TG_PROXY": "",
"TG_USER_ID": "",
"MERGE_PUSH": "",
+ 'GOTIFY_URL': "", # gotify地址,如https://push.example.de:8080
+ 'GOTIFY_TOKEN': "", # gotify的消息应用token
+ 'GOTIFY_PRIORITY': "", # 推送消息优先级,默认为0
+ 'NTFY_URL': "", # ntfy地址,如https://ntfy.sh
+ 'NTFY_TOPIC': "", # ntfy的消息应用topic
+ 'NTFY_PRIORITY': "", # 推送消息优先级,默认为3
}
diff --git a/dailycheckin/utils/message.py b/dailycheckin/utils/message.py
old mode 100755
new mode 100644
index f92795a29..d586099e0
--- a/dailycheckin/utils/message.py
+++ b/dailycheckin/utils/message.py
@@ -189,6 +189,51 @@ def message2pushplus(pushplus_token, content, pushplus_topic=None):
requests.post(url="http://www.pushplus.plus/send", data=json.dumps(data))
return
+def message2gotify(gotify_url: str, gotify_token: str, gotify_priority: str, content: str) -> None:
+ print("Gotify 服务启动")
+ if not gotify_priority:
+ gotify_priority = "3"
+ url = "{}/message?token={}".format(gotify_url, gotify_token)
+ data = {
+ "title": "Dailycheckin签到通知",
+ "message": content,
+ "priority": gotify_priority,
+ }
+ response = requests.post(url, data=data).json()
+
+ if response.get("id"):
+ print("Gotify 推送成功!")
+ else:
+ print("Gotify 推送失败!")
+ return
+
+def message2ntfy(ntfy_url: str, ntfy_topic: str, ntfy_priority: str, content: str) -> None:
+ def encode_rfc2047(text: str) -> str:
+ """将文本编码为符合 RFC 2047 标准的格式"""
+ encoded_bytes = base64.b64encode(text.encode('utf-8'))
+ encoded_str = encoded_bytes.decode('utf-8')
+ return f'=?utf-8?B?{encoded_str}?='
+
+ print("Ntfy 服务启动")
+ if not ntfy_url:
+ ntfy_url = "https://ntfy.sh"
+ if not ntfy_priority:
+ ntfy_priority = "3"
+ # 使用 RFC 2047 编码 title
+ encoded_title = encode_rfc2047("Dailycheckin签到通知")
+
+ data = content.encode(encoding='utf-8')
+ headers = {
+ "Title": encoded_title, # 使用编码后的 title
+ "Priority": ntfy_priority
+ }
+ url = "{}/{}".format(ntfy_url, ntfy_topic)
+ response = requests.post(url, data=data, headers=headers)
+ if response.status_code == 200: # 使用 response.status_code 进行检查
+ print("Ntfy 推送成功!")
+ else:
+ print("Ntfy 推送失败!错误信息:", response.text)
+
def important_notice():
datas = requests.get(
@@ -231,7 +276,12 @@ def push_message(content_list: list, notice_info: dict):
qywx_origin = notice_info.get("qywx_origin")
pushplus_token = notice_info.get("pushplus_token")
pushplus_topic = notice_info.get("pushplus_topic")
- merge_push = notice_info.get("merge_push")
+ gotify_url = notice_info.get("gotify_url")
+ gotify_token = notice_info.get("gotify_token")
+ gotify_priority = notice_info.get("gotify_priority")
+ ntfy_url = notice_info.get("ntfy_url")
+ ntfy_topic = notice_info.get("ntfy_topic")
+ ntfy_priority = notice_info.get("ntfy_priority")
content_str = "\n————————————\n\n".join(content_list)
message_list = [content_str]
try:
@@ -250,6 +300,8 @@ def push_message(content_list: list, notice_info: dict):
or qywx_agentid
or bark_url
or pushplus_token
+ or ntfy_topic
+ or (gotify_url and gotify_token)
):
merge_push = False
else:
@@ -340,7 +392,26 @@ def push_message(content_list: list, notice_info: dict):
)
except Exception as e:
print("Telegram 推送失败", e)
-
+ if gotify_url and gotify_token:
+ try:
+ message2gotify(
+ gotify_url=gotify_url,
+ gotify_token=gotify_token,
+ gotify_priority=gotify_priority,
+ content=message,
+ )
+ except Exception as e:
+ print("Gotify 推送失败", e)
+ if ntfy_topic:
+ try:
+ message2ntfy(
+ ntfy_url=ntfy_url,
+ ntfy_topic=ntfy_topic,
+ ntfy_priority=ntfy_priority,
+ content=message,
+ )
+ except Exception as e:
+ print("Ntfy 推送失败", e)
if __name__ == "__main__":
print(important_notice())
diff --git a/docs/pages/settings/notify/_meta.json b/docs/pages/settings/notify/_meta.json
index 323fbd547..659438b7e 100644
--- a/docs/pages/settings/notify/_meta.json
+++ b/docs/pages/settings/notify/_meta.json
@@ -9,5 +9,7 @@
"qywxrobot": "企业微信群机器人",
"telegram": "Telegram",
"server": "Server 酱",
- "turbo": "Server 酱 Turbo"
+ "turbo": "Server 酱 Turbo",
+ "ntfy": "Ntfy",
+ "gotify": "Gotify"
}
diff --git a/docs/pages/settings/notify/bark.mdx b/docs/pages/settings/notify/bark.mdx
index fff5b12d4..922128a42 100644
--- a/docs/pages/settings/notify/bark.mdx
+++ b/docs/pages/settings/notify/bark.mdx
@@ -46,6 +46,14 @@ import { Callout } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# BARK
diff --git a/docs/pages/settings/notify/coolpush.mdx b/docs/pages/settings/notify/coolpush.mdx
index 487e21b34..99439dfeb 100644
--- a/docs/pages/settings/notify/coolpush.mdx
+++ b/docs/pages/settings/notify/coolpush.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# CoolPush
diff --git a/docs/pages/settings/notify/dingtalk.mdx b/docs/pages/settings/notify/dingtalk.mdx
index 9af0f04a4..7ebb5f9d3 100644
--- a/docs/pages/settings/notify/dingtalk.mdx
+++ b/docs/pages/settings/notify/dingtalk.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# 钉钉
diff --git a/docs/pages/settings/notify/feishu.mdx b/docs/pages/settings/notify/feishu.mdx
index 8bd9c8bdc..0b61f0d6e 100644
--- a/docs/pages/settings/notify/feishu.mdx
+++ b/docs/pages/settings/notify/feishu.mdx
@@ -45,8 +45,15 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
-
# 飞书
### 配置示例
diff --git a/docs/pages/settings/notify/gotify.mdx b/docs/pages/settings/notify/gotify.mdx
new file mode 100644
index 000000000..42dda76ee
--- /dev/null
+++ b/docs/pages/settings/notify/gotify.mdx
@@ -0,0 +1,77 @@
+import { Cards, Card } from 'nextra/components'
+import { Callout } from 'nextra/components'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# GOTIFY
+
+
+### 配置示例
+
+```json filename="config.json" copy
+{
+ "GOTIFY_URL": "",
+ "GOTIFY_TOKEN": "",
+ "GOTIFY_PRIORITY": "",
+}
+```
+
+| 参数 | 说明 |
+| :--------------: | :--------------------------------------------------------------------------------------------: |
+| _**GOTIFY_URL**_ | [GOTIFY] ,填写 `GOTIFY_URL` |
+| _**GOTIFY_TOKEN**_| 填写 `GOTIFY_TOKEN` |
+| _**GOTIFY_PRIORITY**_| 填写 `GOTIFY_PRIORITY` |
+| _**MERGE_PUSH**_ | **true**: 将推送消息合并;**false**: 分开推送 |
diff --git a/docs/pages/settings/notify/ntfy.mdx b/docs/pages/settings/notify/ntfy.mdx
new file mode 100644
index 000000000..cf2df55ee
--- /dev/null
+++ b/docs/pages/settings/notify/ntfy.mdx
@@ -0,0 +1,77 @@
+import { Cards, Card } from 'nextra/components'
+import { Callout } from 'nextra/components'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# NTFY
+
+
+### 配置示例
+
+```json filename="config.json" copy
+{
+ "NTFY_URL": "",
+ "NTFY_TOPIC": "",
+ "NTFY_PRIORITY": "",
+}
+```
+
+| 参数 | 说明 |
+| :--------------: | :--------------------------------------------------------------------------------------------: |
+| _**NTFY_URL**_ | [NTFY](https://ntfy.sh) ,填写 `NTFY_URL` 例: `https://ntfy.sh` 也可以自建服务端 |
+| _**NTFY_TOPIC**_| 填写 `NTFY_TOPIC` 例: `dailycheckin` |
+| _**NTFY_PRIORITY**_| 填写 `NTFY_PRIORITY` 例: `3`, 默认为3 |
+| _**MERGE_PUSH**_ | **true**: 将推送消息合并;**false**: 分开推送 |
diff --git a/docs/pages/settings/notify/pushplus.mdx b/docs/pages/settings/notify/pushplus.mdx
index 7b6795903..168ec825c 100644
--- a/docs/pages/settings/notify/pushplus.mdx
+++ b/docs/pages/settings/notify/pushplus.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# PushPlus
diff --git a/docs/pages/settings/notify/qmsg.mdx b/docs/pages/settings/notify/qmsg.mdx
index c2d2e693f..7ccb544fd 100644
--- a/docs/pages/settings/notify/qmsg.mdx
+++ b/docs/pages/settings/notify/qmsg.mdx
@@ -46,6 +46,14 @@ import { Callout } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# Qmsg 酱
diff --git a/docs/pages/settings/notify/qywx.mdx b/docs/pages/settings/notify/qywx.mdx
index 74dfc7b86..ae45d19ff 100644
--- a/docs/pages/settings/notify/qywx.mdx
+++ b/docs/pages/settings/notify/qywx.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# 企业微信应用消息
diff --git a/docs/pages/settings/notify/qywxrobot.mdx b/docs/pages/settings/notify/qywxrobot.mdx
index 37d17a5e1..73c8a37de 100644
--- a/docs/pages/settings/notify/qywxrobot.mdx
+++ b/docs/pages/settings/notify/qywxrobot.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# 企业微信群机器人
diff --git a/docs/pages/settings/notify/server.mdx b/docs/pages/settings/notify/server.mdx
index 82032cfd7..3899500bc 100644
--- a/docs/pages/settings/notify/server.mdx
+++ b/docs/pages/settings/notify/server.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# Server 酱
diff --git a/docs/pages/settings/notify/telegram.mdx b/docs/pages/settings/notify/telegram.mdx
index 36afa1424..864b46805 100644
--- a/docs/pages/settings/notify/telegram.mdx
+++ b/docs/pages/settings/notify/telegram.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# Telegram
diff --git a/docs/pages/settings/notify/turbo.mdx b/docs/pages/settings/notify/turbo.mdx
index 7b1ee8b2e..5542dbd3f 100644
--- a/docs/pages/settings/notify/turbo.mdx
+++ b/docs/pages/settings/notify/turbo.mdx
@@ -45,6 +45,14 @@ import { Cards, Card } from 'nextra/components'
title="Server 酱 TURBO"
href="/settings/notify/turbo"
/>
+
+
# Server 酱 TURBO