diff --git a/back/services/notify.ts b/back/services/notify.ts index e386bcf9..e76ea30f 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -156,7 +156,7 @@ export default class NotificationService { const url = matchResult && matchResult[1] ? `https://${matchResult[1]}.push.ft07.com/send/${serverChanKey}.send` : `https://sctapi.ftqq.com/${serverChanKey}.send`; - + try { const res: any = await got .post(url, { diff --git a/sample/notify.py b/sample/notify.py index 3dc9e1b4..a6cfaa1a 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -302,10 +302,14 @@ def serverJ(title: str, content: str) -> None: print("serverJ 服务启动") data = {"text": title, "desp": content.replace("\n", "\n\n")} - if push_config.get("PUSH_KEY").startswith("sctp"): - url = f'https://{push_config.get("PUSH_KEY")}.push.ft07.com/send' + + match = re.match(r'sctp(\d+)t', push_config.get("PUSH_KEY")) + if match: + num = match.group(1) + url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send' else: url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send' + response = requests.post(url, data=data).json() if response.get("errno") == 0 or response.get("code") == 0: @@ -780,6 +784,7 @@ def chronocat(title: str, content: str) -> None: else: print(f"QQ群消息:{ids}推送失败!") + def ntfy(title: str, content: str) -> None: """ 通过 Ntfy 推送消息