From 471d53e0471c9b62e7c83cea93d901525f9d1d5e Mon Sep 17 00:00:00 2001 From: msojocs Date: Sun, 5 Nov 2023 15:39:53 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/area_unlimit/hook/common.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/extensions/area_unlimit/hook/common.js b/extensions/area_unlimit/hook/common.js index c601b6e..69e230a 100644 --- a/extensions/area_unlimit/hook/common.js +++ b/extensions/area_unlimit/hook/common.js @@ -388,6 +388,14 @@ class BiliBiliApi { }) } + genDeviceId(){ + let deviceId = localStorage.getItem('device_id') + if (deviceId != null) return deviceId + deviceId = hex_md5(`${Math.random()}`) + hex_md5(`${Math.random()}`) + localStorage.setItem('device_id', deviceId) + return deviceId + } + /** * 获取登录二维码 * @return {Promise} @@ -396,8 +404,7 @@ class BiliBiliApi { async HD_getLoginQrCode() { const url = 'https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code' // const url = 'https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/auth_code' - const deviceId = (await cookieStore.get('device_id')).value - const fingerprint = (await cookieStore.get('fingerprint')).value + const deviceId = this.genDeviceId() const buvid = deviceId + deviceId.substring(0, 5) const param = { bili_local_id: deviceId, @@ -411,9 +418,7 @@ class BiliBiliApi { device_name: 'OnePlus7TPro', device_platform: 'Android10OnePlusHD1910', disable_rcmd: 0, - fingerprint: fingerprint, guid: buvid, - local_fingerprint: fingerprint, local_id: buvid, mobi_app: 'android_hd', networkstate: 'wifi', @@ -447,10 +452,8 @@ class BiliBiliApi { */ async HD_pollCheckLogin(authCode) { const url = 'https://passport.bilibili.com/x/passport-tv-login/qrcode/poll' - const deviceId = (await cookieStore.get('device_id')).value - const fingerprint = (await cookieStore.get('fingerprint')).value - // const buvid = 'XU3F09733CCAC87B9FFD6CFFCA30259095661' - const buvid = fingerprint + fingerprint.substring(0, 5) + const deviceId = this.genDeviceId() + const buvid = deviceId + deviceId.substring(0, 5) const param = { auth_code: authCode, bili_local_id: deviceId,