Skip to content

Commit

Permalink
feat: support server chan v3 (#34)
Browse files Browse the repository at this point in the history
* feat: support server chan v3

* minor fix
  • Loading branch information
CodePwn2021 authored Oct 23, 2024
1 parent 79093d8 commit 1ba6a6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,20 @@ async function noticeAtri(options: CommonOptions) {
}

/**
* https://sct.ftqq.com/
* Turbo: https://sct.ftqq.com/
* V3: https://sc3.ft07.com/
*/
async function noticeServerChan(options: CommonOptions) {
checkParameters(options, ['token', 'content']);
let url: string;
let param: URLSearchParams;
if (options.token.substring(0, 3).toLowerCase() === 'sct') {
if (options.token.startsWith('sctp')) {
url = `https://${options.token.match(/^sctp(\d+)t/)[1]}.push.ft07.com/send`;
param = new URLSearchParams({
title: options.title || getTitle(options.content),
desp: options.content,
});
} else if (options.token.substring(0, 3).toLowerCase() === 'sct') {
url = 'https://sctapi.ftqq.com';
param = new URLSearchParams({
title: options.title || getTitle(options.content),
Expand Down

0 comments on commit 1ba6a6f

Please sign in to comment.