mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
👀👀👀👀👀
This commit is contained in:
parent
6eaf8c0e90
commit
47148fea67
2 changed files with 32 additions and 5 deletions
|
|
@ -314,8 +314,14 @@ export default class MysZZZApi extends MysApi {
|
|||
if (!data.headers) data.headers = {};
|
||||
data.headers['x-rpc-device_fp'] = data.deviceFp;
|
||||
}
|
||||
const uid = this.uid;
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${uid}:BIND`);
|
||||
// 从 this.cookie 中获取ltuid
|
||||
const ck = this.cookie;
|
||||
let ltuid = ck.match(/ltuid=(\d+);/);
|
||||
if (ltuid) {
|
||||
ltuid = ltuid[1];
|
||||
}
|
||||
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
if (bindInfo) {
|
||||
try {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
|
|
|
|||
|
|
@ -88,8 +88,27 @@ export class ZZZPlugin extends plugin {
|
|||
}
|
||||
// 获取设备指纹
|
||||
let deviceFp = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:FP`);
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
let data = {
|
||||
deviceFp,
|
||||
};
|
||||
if (bindInfo) {
|
||||
try {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
data = {
|
||||
productName: bindInfo?.deviceProduct,
|
||||
deviceType: bindInfo?.deviceName,
|
||||
modelName: bindInfo?.deviceModel,
|
||||
oaid: bindInfo?.oaid,
|
||||
deviceInfo: bindInfo?.deviceFingerprint,
|
||||
board: bindInfo?.deviceBoard,
|
||||
};
|
||||
} catch (error) {
|
||||
bindInfo = null;
|
||||
}
|
||||
}
|
||||
if (!deviceFp) {
|
||||
const sdk = api.getUrl('getFp');
|
||||
const sdk = api.getUrl('getFp', data);
|
||||
const res = await request(sdk.url, {
|
||||
headers: sdk.headers,
|
||||
method: 'POST',
|
||||
|
|
@ -104,11 +123,13 @@ export class ZZZPlugin extends plugin {
|
|||
await redis.set(`ZZZ:DEVICE_FP:${ltuid}:FP`, deviceFp, {
|
||||
EX: 86400 * 7,
|
||||
});
|
||||
const deviceLogin = api.getUrl('deviceLogin');
|
||||
const saveDevice = api.getUrl('saveDevice');
|
||||
data['deviceFp'] = deviceFp;
|
||||
const deviceLogin = api.getUrl('deviceLogin', data);
|
||||
const saveDevice = api.getUrl('saveDevice', data);
|
||||
if (!!deviceLogin && !!saveDevice) {
|
||||
logger.debug(`[米游社][设备登录]保存设备信息`);
|
||||
try {
|
||||
logger.debug(`[米游社][设备登录]${JSON.stringify(deviceLogin)}`);
|
||||
const login = await request(deviceLogin.url, {
|
||||
headers: deviceLogin.headers,
|
||||
method: 'POST',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue