Fix: /get_cookies under the QZone domain returned bkn unexpectedly (#1762)
* Fix: QZone's g_tk(bkn) Signed-off-by: Airline233 <airline233@gmail.com> * Add getBknFromPSKey method to webapi Signed-off-by: Airline233 <airline233@gmail.com> * Fix variable declaration for BKN in GetCookies a stupid error... Signed-off-by: Airline233 <airline233@gmail.com> * Fix typo in method name for BKN retrieval Signed-off-by: Airline233 <airline233@gmail.com> * Fix getBknFromPSKey function call syntax Signed-off-by: Airline233 <airline233@gmail.com> * Update packages/napcat-core/apis/webapi.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Airline233 <airline233@gmail.com> * Update packages/napcat-onebot/action/user/GetCookies.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Airline233 <airline233@gmail.com> --------- Signed-off-by: Airline233 <airline233@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
285632f463
commit
439650cd75
2 files changed
+14
-1
No files matched your search
@@ -328,6 +328,10 @@ export class NTQQWebApi {
|
|||||||
return (hash & 0x7FFFFFFF).toString();
|
return (hash & 0x7FFFFFFF).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getBknFromPSKey (psKey: string) {
|
||||||
|
return this.getBknFromSKey(psKey);
|
||||||
|
}
|
||||||
|
|
||||||
async getAlbumListByNTQQ (gc: string, attach_info: string = '') {
|
async getAlbumListByNTQQ (gc: string, attach_info: string = '') {
|
||||||
return await this.context.session.getAlbumService().getAlbumList({
|
return await this.context.session.getAlbumService().getAlbumList({
|
||||||
qun_id: gc,
|
qun_id: gc,
|
||||||
|
|||||||
@@ -35,7 +35,16 @@ export class GetCookies extends OneBotAction<GetCookiesPayload, GetCookiesRespon
|
|||||||
const cookiesObject = await this.core.apis.UserApi.getCookies(payload.domain);
|
const cookiesObject = await this.core.apis.UserApi.getCookies(payload.domain);
|
||||||
// 把获取到的cookiesObject转换成 k=v; 格式字符串拼接在一起
|
// 把获取到的cookiesObject转换成 k=v; 格式字符串拼接在一起
|
||||||
const cookies = Object.entries(cookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
const cookies = Object.entries(cookiesObject).map(([key, value]) => `${key}=${value}`).join('; ');
|
||||||
const bkn = cookiesObject?.['skey'] ? this.core.apis.WebApi.getBknFromCookie(cookiesObject) : '';
|
let bkn = '';
|
||||||
|
if (payload.domain.includes('qzone.qq.com')) {
|
||||||
|
if (cookiesObject?.['p_skey']) {
|
||||||
|
bkn = this.core.apis.WebApi.getBknFromPSKey(cookiesObject['p_skey']);
|
||||||
|
} else {
|
||||||
|
bkn = cookiesObject?.['skey'] ? this.core.apis.WebApi.getBknFromCookie(cookiesObject) : '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bkn = cookiesObject?.['skey'] ? this.core.apis.WebApi.getBknFromCookie(cookiesObject) : '';
|
||||||
|
}
|
||||||
return { cookies, bkn };
|
return { cookies, bkn };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user