diff --git a/back/services/notify.ts b/back/services/notify.ts index a229d305..ea80133d 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -152,7 +152,7 @@ export default class NotificationService { private async serverChan() { const { serverChanKey } = this.params; const matchResult = serverChanKey.match(/^sctp(\d+)t/i); - const url = matchResult + const url = matchResult && matchResult[1] ? `https://${matchResult[1]}.push.ft07.com/send/${serverChanKey}.send` : `https://sctapi.ftqq.com/${serverChanKey}.send`; @@ -160,7 +160,7 @@ export default class NotificationService { const res: any = await got .post(url, { ...this.gotOption, - body: `title=${this.title}&desp=${this.content}`, + body: `title=${encodeURIComponent(this.title)}&desp=${encodeURIComponent(this.content)}`, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, }) .json(); diff --git a/sample/notify.js b/sample/notify.js index edae3c29..9c9018ca 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -227,7 +227,7 @@ function serverNotify(text, desp) { const matchResult = PUSH_KEY.match(/^sctp(\d+)t/i); const options = { - url: matchResult + url: matchResult && matchResult[1] ? `https://${matchResult[1]}.push.ft07.com/send/${PUSH_KEY}.send` : `https://sctapi.ftqq.com/${PUSH_KEY}.send`, body: `text=${encodeURIComponent(text)}&desp=${encodeURIComponent(desp)}`,