mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
fix:'User-Agent'尝试写入已绑定的设备信息
This commit is contained in:
parent
c5f40f6a24
commit
ada1b9bdad
2 changed files with 11 additions and 5 deletions
|
|
@ -131,12 +131,18 @@ export default class MysZZZApi extends MysApi {
|
|||
headers['x-rpc-device_id'] = data.deviceId;
|
||||
}
|
||||
// 如果有绑定设备信息,写入绑定设备信息,否则写入默认设备信息
|
||||
if (data?.deviceInfo && data?.modelName) {
|
||||
if (data?.deviceInfo && data?.modelName && data?.osVersion) {
|
||||
const osVersion = data.osVersion;
|
||||
const modelName = data.modelName;
|
||||
const deviceBrand = data.deviceInfo?.split('/')[0];
|
||||
const deviceDisplay = data.deviceInfo?.split('/')[3];
|
||||
try {
|
||||
headers['x-rpc-device_name'] = `${deviceBrand} ${data.modelName}`;
|
||||
headers['x-rpc-device_model'] = data.modelName;
|
||||
headers['x-rpc-device_name'] = `${deviceBrand} ${modelName}`;
|
||||
headers['x-rpc-device_model'] = modelName;
|
||||
headers['x-rpc-csm_source'] = 'myself';
|
||||
// 国际服不需要绑定设备,故写入的'User-Agent'为国服
|
||||
headers['User-Agent'] =
|
||||
`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`;
|
||||
} catch (error) {
|
||||
logger.error(`[ZZZ]设备信息解析失败:${error.message}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue