Skip to content

Commit

Permalink
适配Server酱APP分支(Server酱³),移除已废弃的旧版api入口 (#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
easychen authored Oct 10, 2024
1 parent 6ea8d36 commit 71dd82f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions back/services/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ export default class NotificationService {

private async serverChan() {
const { serverChanKey } = this.params;
const url = serverChanKey.startsWith('SCT')
? `https://sctapi.ftqq.com/${serverChanKey}.send`
: `https://sc.ftqq.com/${serverChanKey}.send`;
const url = serverChanKey.startsWith('sctp')
? `https://${serverChanKey}.push.ft07.com/send`
: `https://sctapi.ftqq.com/${serverChanKey}.send`;
try {
const res: any = await got
.post(url, {
Expand Down
6 changes: 3 additions & 3 deletions sample/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ function serverNotify(text, desp) {
// 微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
desp = desp.replace(/[\n\r]/g, '\n\n');
const options = {
url: PUSH_KEY.includes('SCT')
? `https://sctapi.ftqq.com/${PUSH_KEY}.send`
: `https://sc.ftqq.com/${PUSH_KEY}.send`,
url: PUSH_KEY.startsWith('sctp')
? `https://${PUSH_KEY}.push.ft07.com/send`
: `https://sctapi.ftqq.com/${PUSH_KEY}.send`,
body: `text=${text}&desp=${desp}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down
6 changes: 3 additions & 3 deletions sample/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ def serverJ(title: str, content: str) -> None:
print("serverJ 服务启动")

data = {"text": title, "desp": content.replace("\n", "\n\n")}
if push_config.get("PUSH_KEY").find("SCT") != -1:
url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send'
if push_config.get("PUSH_KEY").startswith("sctp"):
url = f'https://{push_config.get("PUSH_KEY")}.push.ft07.com/send'
else:
url = f'https://sc.ftqq.com/{push_config.get("PUSH_KEY")}.send'
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:
Expand Down

0 comments on commit 71dd82f

Please sign in to comment.