mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
fix:设备信息
This commit is contained in:
parent
7f27bbf332
commit
d6e52b1a24
8 changed files with 49 additions and 14 deletions
|
|
@ -212,10 +212,17 @@ export default class MysZZZApi extends MysApi {
|
|||
* @returns {object}
|
||||
*/
|
||||
getHeaders(query = '', body = '') {
|
||||
const info = this.getBindInfo()
|
||||
const deviceCfg = settings.getConfig('device');
|
||||
const defDeviceCfg = settings.getdefSet('device');
|
||||
const deviceInfo = info?.deviceFingerprint ?? _.get(deviceCfg, 'deviceInfo') ?? _.get(defDeviceCfg, 'deviceInfo');
|
||||
const osVersion = info?.androidVersion ?? _.get(deviceCfg, 'osVersion') ?? _.get(defDeviceCfg, 'osVersion');
|
||||
const modelName = info?.deviceModel ?? _.get(deviceCfg, 'modelName') ?? _.get(defDeviceCfg, 'modelName');
|
||||
const deviceDisplay = deviceInfo.split('/')[3];
|
||||
const cn = {
|
||||
app_version: '2.73.1',
|
||||
User_Agent:
|
||||
'Mozilla/5.0 (Linux; Android 11; J9110 Build/55.2.A.4.332; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.179 Mobile Safari/537.36 miHoYoBBS/2.73.1',
|
||||
`Mozilla/5.0 (Linux; Android ${osVersion}; ${modelName} Build/${deviceDisplay}; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.179 Mobile Safari/537.36 miHoYoBBS/2.73.1`,
|
||||
client_type: '5',
|
||||
Origin: 'https://act.mihoyo.com',
|
||||
X_Requested_With: 'com.mihoyo.hyperion',
|
||||
|
|
@ -224,7 +231,7 @@ export default class MysZZZApi extends MysApi {
|
|||
const os = {
|
||||
app_version: '2.57.1',
|
||||
User_Agent:
|
||||
'Mozilla/5.0 (Linux; Android 11; J9110 Build/55.2.A.4.332; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.179 Mobile Safari/537.36 miHoYoBBSOversea/2.57.1',
|
||||
`Mozilla/5.0 (Linux; Android ${osVersion}; ${modelName} Build/${deviceDisplay}; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.179 Mobile Safari/537.36 miHoYoBBSOversea/2.57.1`,
|
||||
client_type: '2',
|
||||
Origin: 'https://act.hoyolab.com',
|
||||
X_Requested_With: 'com.mihoyo.hoyolab',
|
||||
|
|
@ -250,6 +257,22 @@ export default class MysZZZApi extends MysApi {
|
|||
};
|
||||
}
|
||||
|
||||
async getBindInfo() {
|
||||
// 从 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) {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
} else {
|
||||
bindInfo = null;
|
||||
}
|
||||
return { bindInfo };
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验状态码
|
||||
* @param e 消息e
|
||||
|
|
@ -310,16 +333,16 @@ export default class MysZZZApi extends MysApi {
|
|||
ltuid = ltuid[1];
|
||||
}
|
||||
if (ltuid) {
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
let bindInfo = this.getBindInfo();
|
||||
if (bindInfo) {
|
||||
try {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
data = {
|
||||
...data,
|
||||
productName: bindInfo?.deviceProduct,
|
||||
deviceType: bindInfo?.deviceName,
|
||||
modelName: bindInfo?.deviceModel,
|
||||
oaid: bindInfo?.oaid,
|
||||
osVersion: bindInfo?.androidVersion,
|
||||
deviceInfo: bindInfo?.deviceFingerprint,
|
||||
board: bindInfo?.deviceBoard,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue