diff --git a/src/push/server-chan-v3.ts b/src/push/server-chan-v3.ts index b917ad5..dce45b8 100644 --- a/src/push/server-chan-v3.ts +++ b/src/push/server-chan-v3.ts @@ -31,6 +31,8 @@ export class ServerChanV3 implements Send { */ private sendkey: string + private uid: string = '' + /** * @author CaoMeiYouRen * @date 2024-10-04 @@ -42,6 +44,10 @@ export class ServerChanV3 implements Send { if (!this.sendkey) { throw new Error('sendkey 是必须的!') } + this.uid = this.sendkey.match(/^sctp(\d+)t/)?.[1] + if (!this.uid) { + throw new Error('sendkey 不合法!') + } } async send(text: string, desp: string = '', options: ServerChanV3Options = {}): Promise { @@ -55,7 +61,7 @@ export class ServerChanV3 implements Send { ...options, } return ajax({ - url: `https://${this.sendkey}.push.ft07.com/send`, + url: `https://${this.uid}.push.ft07.com/send/${this.sendkey}.send`, method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/utils/ajax.ts b/src/utils/ajax.ts index a3cd21d..1dc45e8 100644 --- a/src/utils/ajax.ts +++ b/src/utils/ajax.ts @@ -1,7 +1,7 @@ import axios, { AxiosResponse, Method, AxiosRequestHeaders } from 'axios' import debug from 'debug' -import HttpsProxyAgent from 'https-proxy-agent' -import SocksProxyAgent from 'socks-proxy-agent' +import { HttpsProxyAgent } from 'https-proxy-agent' +import { SocksProxyAgent } from 'socks-proxy-agent' import { isHttpURL, isSocksUrl } from './helper' const Debugger = debug('push:ajax') @@ -43,15 +43,15 @@ export async function ajax(config: AjaxConfig): Promise