优化Server酱Key相关的逻辑 (#2538)

* 优化sendkey的兼容

* 对title和desp encode
This commit is contained in:
Easy
2024-10-22 21:49:07 +08:00
committed by GitHub
parent 185fd2ff91
commit ecc55883f0
3 changed files with 17 additions and 9 deletions
+6 -2
View File
@@ -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: