对title和desp encode

This commit is contained in:
Easy 2024-10-22 15:46:57 +08:00
parent f8706815d6
commit 647db4c9c1
2 changed files with 3 additions and 3 deletions

View File

@ -152,7 +152,7 @@ export default class NotificationService {
private async serverChan() { private async serverChan() {
const { serverChanKey } = this.params; const { serverChanKey } = this.params;
const matchResult = serverChanKey.match(/^sctp(\d+)t/i); 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://${matchResult[1]}.push.ft07.com/send/${serverChanKey}.send`
: `https://sctapi.ftqq.com/${serverChanKey}.send`; : `https://sctapi.ftqq.com/${serverChanKey}.send`;
@ -160,7 +160,7 @@ export default class NotificationService {
const res: any = await got const res: any = await got
.post(url, { .post(url, {
...this.gotOption, ...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' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
}) })
.json(); .json();

View File

@ -227,7 +227,7 @@ function serverNotify(text, desp) {
const matchResult = PUSH_KEY.match(/^sctp(\d+)t/i); const matchResult = PUSH_KEY.match(/^sctp(\d+)t/i);
const options = { const options = {
url: matchResult url: matchResult && matchResult[1]
? `https://${matchResult[1]}.push.ft07.com/send/${PUSH_KEY}.send` ? `https://${matchResult[1]}.push.ft07.com/send/${PUSH_KEY}.send`
: `https://sctapi.ftqq.com/${PUSH_KEY}.send`, : `https://sctapi.ftqq.com/${PUSH_KEY}.send`,
body: `text=${encodeURIComponent(text)}&desp=${encodeURIComponent(desp)}`, body: `text=${encodeURIComponent(text)}&desp=${encodeURIComponent(desp)}`,