From b93e7b7ed131785d1ac012d3847e748e01ad1704 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, 28 Sep 2024 20:16:47 +0800 Subject: [PATCH] feat: get pskey --- src/core/apis/user.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/apis/user.ts b/src/core/apis/user.ts index 8d0a4b56..f55b27c9 100644 --- a/src/core/apis/user.ts +++ b/src/core/apis/user.ts @@ -120,12 +120,20 @@ export class NTQQUserApi { return this.context.session.getProfileService().modifyDesktopMiniProfile(param); } - //需要异常处理 async getCookies(domain: string) { const ClientKeyData = await this.forceFetchClientKey(); const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + this.core.selfInfo.uin + '&clientkey=' + ClientKeyData.clientKey + '&u1=https%3A%2F%2F' + domain + '%2F' + this.core.selfInfo.uin + '%2Finfocenter&keyindex=19%27'; - return await RequestUtil.HttpsGetCookies(requestUrl); + let data = await RequestUtil.HttpsGetCookies(requestUrl); + if (!data.p_skey || data.p_skey.length == 0) { + try { + let pskey = (await this.getPSkey([domain])).domainPskeyMap.get(domain); + if (pskey) data.p_skey = pskey; + } catch { + return data; + } + } + return data; } async getPSkey(domainList: string[]) {