yz-yuki-plugin 2.0.9-3 → 2.0.9-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -174,6 +174,13 @@ class BiliRiskCookie {
|
|
|
174
174
|
if (data?.code === 0) {
|
|
175
175
|
if (data?.data?.code === 0) {
|
|
176
176
|
// 登录成功,获取 set-cookie header 并写入 Jar
|
|
177
|
+
// 手动提取并设置 cookie,兼容某些环境下 axios-cookiejar-support 可能未正确处理 set-cookie 的情况
|
|
178
|
+
const setCookieHeaders = response.headers['set-cookie'];
|
|
179
|
+
if (setCookieHeaders) {
|
|
180
|
+
for (const cookieStr of setCookieHeaders) {
|
|
181
|
+
await jar.setCookie(cookieStr, 'https://passport.bilibili.com');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
177
184
|
const SESSDATA_expires = await this.getCookieExpiration(jar, 'SESSDATA', 'https://passport.bilibili.com');
|
|
178
185
|
try {
|
|
179
186
|
if (SESSDATA_expires != null) {
|
|
@@ -268,7 +275,7 @@ class BiliRiskCookie {
|
|
|
268
275
|
method: 'GET',
|
|
269
276
|
headers: lodash.merge(BiliApi.BIlIBILI_LOGIN_HEADERS, {
|
|
270
277
|
'User-agent': BiliApi.BILIBILI_HEADERS['User-Agent'],
|
|
271
|
-
'Cookie': SESSDATA_str ? SESSDATA_str : ''
|
|
278
|
+
'Cookie': SESSDATA_str ? `SESSDATA=${SESSDATA_str}` : ''
|
|
272
279
|
}),
|
|
273
280
|
redirect: 'follow'
|
|
274
281
|
});
|
|
@@ -282,7 +289,7 @@ class BiliRiskCookie {
|
|
|
282
289
|
const current_exp = level_info?.current_exp;
|
|
283
290
|
const next_exp = level_info?.next_exp;
|
|
284
291
|
const ttl = SESSDATA_expires;
|
|
285
|
-
const LoginCookieTTLStr = ttl === -1 ? '永久' : ttl === -2 ? '-' : `${new Date(
|
|
292
|
+
const LoginCookieTTLStr = ttl === -1 ? '永久' : ttl === -2 ? '-' : `${new Date(ttl).toLocaleString()}`;
|
|
286
293
|
e.reply(`~B站账号已登陆~\n有效期至:${LoginCookieTTLStr}。\n昵称:${uname}\nuid:${mid}\n硬币:${money}\n经验等级:${current_level}\n当前经验值exp:${current_exp}\n下一等级所需exp:${next_exp}`);
|
|
287
294
|
return true;
|
|
288
295
|
}
|