From 40b988842c60f8bbada0942f0b3d7503fc2c9700 Mon Sep 17 00:00:00 2001 From: CaoMeiYouRen <996881204@qq.com> Date: Fri, 8 Nov 2024 00:01:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=8D=87=E7=BA=A7=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=9B=E4=BC=98=E5=8C=96=20Server=20?= =?UTF-8?q?=E9=85=B1=C2=B3=20=E8=B0=83=E7=94=A8=E6=96=B9=E5=BC=8F=E4=B8=BA?= =?UTF-8?q?=20=E5=AE=89=E5=85=A8=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/push/server-chan-v3.ts | 8 +++++++- src/utils/ajax.ts | 14 +++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) 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