From a1dd76aee0e9a48c11d0f6073ae6ba54794271be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 27 Apr 2024 20:09:08 +0800 Subject: [PATCH] fix --- src/core | 2 +- src/onebot11/action/index.ts | 3 +- src/onebot11/action/types.ts | 1 + src/onebot11/action/user/GetCookies.ts | 38 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/onebot11/action/user/GetCookies.ts diff --git a/src/core b/src/core index 5d6d4460..69ea8dbb 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit 5d6d446065f5f4963aad96f94f6e36ff5c9e0986 +Subproject commit 69ea8dbb9784dd93265e0d5bc2c44e7cc6c90f04 diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index 45a8016b..e264a7d3 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -45,6 +45,7 @@ import GoCQHTTPGetGroupMsgHistory from './go-cqhttp/GetGroupMsgHistory'; import GetFile from './file/GetFile'; import { GoCQHTTGetForwardMsgAction } from './go-cqhttp/GetForwardMsg'; import GetFriendMsgHistory from './go-cqhttp/GetFriendMsgHistory'; +import { GetCookies } from './user/GetCookies'; export const actionHandlers = [ new GetFile(), @@ -80,7 +81,7 @@ export const actionHandlers = [ new GetImage(), new GetRecord(), // new CleanCache(), - + new GetCookies(), //以下为go-cqhttp api new GoCQHTTPSendForwardMsg(), new GoCQHTTPSendGroupForwardMsg(), diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index 138a5468..87df233b 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -50,6 +50,7 @@ export enum ActionName { GetImage = 'get_image', GetRecord = 'get_record', CleanCache = 'clean_cache', + GetCookies = "get_cookies", // 以下为go-cqhttp api GoCQHTTP_SendForwardMsg = 'send_forward_msg', GoCQHTTP_SendGroupForwardMsg = 'send_group_forward_msg', diff --git a/src/onebot11/action/user/GetCookies.ts b/src/onebot11/action/user/GetCookies.ts new file mode 100644 index 00000000..0eddc801 --- /dev/null +++ b/src/onebot11/action/user/GetCookies.ts @@ -0,0 +1,38 @@ +import { OB11User } from '../../types'; +import { OB11Constructor } from '../../constructor'; +import { friends } from '../../../common/data'; +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; + + +export class GetCookies extends BaseAction { + actionName = ActionName.GetCookies; + + protected async _handle(payload: null) { + // 取Skey + // 先NodeIKernelTicketService.forceFetchClientKey('') + // 返回值 + // { + // result: 0, + // errMsg: '', + // url: '', + // keyIndex: '19', + // clientKey: 'clientKey', + // expireTime: '7200' + // } + // request https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=1627126029&clientkey=key + // &u1=https%3A%2F%2Fh5.qzone.qq.com%2Fqqnt%2Fqzoneinpcqq%2Ffriend%3Frefresh%3D0%26clientuin%3D0%26darkMode%3D0&keyindex=keyIndex + // 取Location + // onBeforeSendHeaders info {"sec-ch-ua":"\\"Not_A Brand\\";v=\\"8\\", \\"Chromium\\";v=\\"120\\"","Accept":"application/json, text/plain, */*","sec-ch-ua-mobile":"?0","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QQ/9.9.9-23159 Chrome/120.0.6099.56 Electron/28.0.0 Safari/537.36 OS/win32,x64,10.0.26100,Windows 10 Pro","sec-ch-ua-platform":"\\"Windows\\"","Origin":"https://h5.qzone.qq.com","Sec-Fetch-Site":"cross-site","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Accept-Encoding":"gzip, deflate, br","Accept-Language":"zh-CN","referer":"https://h5.qzone.qq.com","Referer":"https://h5.qzone.qq.com","origin":"https://h5.qzone.qq.com"} + // 取Pskey + // NodeIKernelTipOffService.getPskey([ 'qun.qq.com' ], true ) + // { + // result: 0, + // errMsg: 'success', + // domainPskeyMap: Map(1) { + // 'qun.qq.com' => 'pskey' + // } + // } + return null; + } +}