From 7c9f892de3f26d579ac0b5d2aea75a4bb9cbc68b Mon Sep 17 00:00:00 2001 From: Ghost Lee Date: Sat, 11 Dec 2021 20:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DgoCqHttpBotToken=E4=B8=AD?= =?UTF-8?q?=E5=AD=98=E5=9C=A8&=E5=AD=97=E7=AC=A6=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改goCqHttpBot鉴权方式,调整为使用Header模式,此处回调函数可使用[send_msg 发送消息](https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_msg-%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF)API来实现更为优雅的前端配置方式,但考虑到需要同时修改前后端,暂不提交 --- back/services/notify.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/services/notify.ts b/back/services/notify.ts index 84119d7c..ba53a574 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -91,11 +91,12 @@ export default class NotificationService { const { goCqHttpBotQq, goCqHttpBotToken, goCqHttpBotUrl } = this.params; const res: any = await got .post( - `${goCqHttpBotUrl}?access_token=${goCqHttpBotToken}&${goCqHttpBotQq}`, + `${goCqHttpBotUrl}?${goCqHttpBotQq}`, { timeout: this.timeout, retry: 0, json: { message: `${this.title}\n${this.content}` }, + headers: { 'Authorization': 'Bearer '+goCqHttpBotToken }, }, ) .json();