mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
refactor: get cookies
This commit is contained in:
@@ -122,6 +122,11 @@ export class NTQQUserApi {
|
||||
|
||||
@cacheFunc(60 * 30 * 1000)
|
||||
static async getCookies(domain: string) {
|
||||
if (domain.endsWith("qzone.qq.com")) {
|
||||
let data = (await NTQQUserApi.getQzoneCookies());
|
||||
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin;
|
||||
return { bkn: NTQQUserApi.genBkn(data.p_skey), cookies: CookieValue };
|
||||
}
|
||||
const skey = await this.getSkey();
|
||||
const pskey = (await this.getPSkey([domain])).get(domain);
|
||||
if (!pskey || !skey) {
|
||||
|
@@ -12,14 +12,6 @@ export class GetCookies extends BaseAction<Payload, { cookies: string; bkn: stri
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const domain = payload.domain || 'qun.qq.com'
|
||||
if (domain.endsWith("qzone.qq.com")) {
|
||||
const _Skey = await NTQQUserApi.getSkey() as string;
|
||||
// 兼容整个 *.qzone.qq.com
|
||||
let data = (await NTQQUserApi.getQzoneCookies());
|
||||
const Bkn = WebApi.genBkn(data.p_skey);
|
||||
const CookieValue = 'p_skey=' + data.p_skey + '; skey=' + data.skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin;
|
||||
return { bkn: WebApi.genBkn(data.p_skey), cookies: CookieValue };
|
||||
}
|
||||
return NTQQUserApi.getCookies(domain);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user