mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
fix:设备信息
This commit is contained in:
parent
7f27bbf332
commit
d6e52b1a24
8 changed files with 49 additions and 14 deletions
|
|
@ -69,7 +69,7 @@ git clone --depth=1 https://gitee.com/bietiaop/ZZZ-Plugin.git ./plugins/ZZZ-Plug
|
|||
|
||||
## 绑定设备
|
||||
|
||||
本插件会自带一个默认设备参数模拟真机进行请求,但是这个设备参数会被所有使用本插件的用户共同使用,因此**大概率**会遭遇账号异常,因此在遇到米游社抛出对应错误时,需要每个人绑定真实设备参数进行请求。
|
||||
本插件会自带一个默认设备参数模拟真机进行请求,但是这个设备参数会被所有使用本插件的用户共同使用,因此**大概率**会遭遇账号异常,因此在遇到米游社抛出对应错误时,需要每个人绑定登陆米游社账号的常用设备参数进行请求。
|
||||
|
||||
如果需要绑定设备,请发送 `%绑定设备帮助` 进行查看如何绑定。第一种方法就是抓包,此种方法危害性较小,技术难度相对较高,但是IOS与Android设备通用。
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ export async function toSetDefaultDevice() {
|
|||
!info?.deviceName ||
|
||||
!info?.deviceBoard ||
|
||||
!info?.deviceModel ||
|
||||
!info?.androidVersion ||
|
||||
!info?.deviceFingerprint ||
|
||||
!info?.deviceProduct
|
||||
) {
|
||||
|
|
@ -43,6 +44,7 @@ export async function toSetDefaultDevice() {
|
|||
productName: info.deviceProduct,
|
||||
productType: info.deviceName,
|
||||
modelName: info.deviceModel,
|
||||
osVersion: info.androidVersion,
|
||||
deviceInfo: info.deviceFingerprint,
|
||||
board: info.deviceBoard,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ export class Panel extends ZZZPlugin {
|
|||
async bindDevice() {
|
||||
const uid = await this.getUID();
|
||||
//先throw一步(
|
||||
const ltuid = await this.getLtuid();
|
||||
this.setContext('toBindDevice');
|
||||
await this.reply(
|
||||
`为UID ${uid}绑定设备,请发送设备信息(建议私聊发送),或者发送“取消”取消绑定`,
|
||||
|
|
@ -73,6 +72,7 @@ export class Panel extends ZZZPlugin {
|
|||
!info?.deviceBoard ||
|
||||
!info?.deviceModel ||
|
||||
!info?.oaid ||
|
||||
!info?.androidVersion ||
|
||||
!info?.deviceFingerprint ||
|
||||
!info?.deviceProduct
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
productName: J9110
|
||||
productType: J9110
|
||||
modelName: J9110
|
||||
osVersion: 11
|
||||
deviceInfo: Sony/J9110/J9110:11/55.2.A.4.332/055002A004033203408384484:user/release-keys
|
||||
board: msmnile
|
||||
|
|
@ -259,6 +259,15 @@ export function supportGuoba() {
|
|||
placeholder: '请输入modelName',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'device.osVersion',
|
||||
label: 'osVersion(androidVersion)',
|
||||
bottomHelpMessage: '设置默认设备osVersion字段',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入osVersion',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'device.deviceInfo',
|
||||
label: 'deviceInfo(deviceFingerprint)',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,10 +83,12 @@ export default class ZZZApiTool {
|
|||
deviceType = _.get(deviceCfg, 'productType') ?? _.get(defDeviceCfg, 'productType'),
|
||||
modelName = _.get(deviceCfg, 'modelName') ?? _.get(defDeviceCfg, 'modelName'),
|
||||
oaid = this.uuid,
|
||||
osVersion = _.get(deviceCfg, 'osVersion') ?? _.get(defDeviceCfg, 'osVersion'),
|
||||
deviceInfo = _.get(deviceCfg, 'deviceInfo') ?? _.get(defDeviceCfg, 'deviceInfo'),
|
||||
board = _.get(deviceCfg, 'board') ?? _.get(defDeviceCfg, 'board'),
|
||||
} = data;
|
||||
const deviceBrand = deviceInfo.split('/')[0];
|
||||
const deviceDisplay = deviceInfo.split('/')[3];
|
||||
let urlMap = {
|
||||
zzz: {
|
||||
...(['prod_gf_cn'].includes(this.server)
|
||||
|
|
@ -98,7 +100,7 @@ export default class ZZZApiTool {
|
|||
bbs_device_id: `${this.uuid}`,
|
||||
device_fp: '38d7faa51d2b6',
|
||||
device_id: '35315696b7071100',
|
||||
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"${modelName}","productName":"${productName}","romRemain":"456","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"aaid":"${this.uuid}","model":"${modelName}","brand":"${deviceBrand}","hardware":"qcom","deviceType":"${deviceType}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"96757","appUpdateTimeDiff":1722171241616,"deviceInfo":"${deviceInfo}","vaid":"${this.uuid}","buildType":"user","sdkVersion":"30","ui_mode":"UI_MODE_TYPE_NORMAL","isMockLocation":0,"cpuType":"arm64-v8a","isAirMode":0,"ringMode":2,"chargeStatus":1,"manufacturer":"${deviceBrand}","emulatorStatus":0,"appMemory":"512","osVersion":"11","vendor":"unknown","accelerometer":"-0.084346995x8.73799x4.6301117","sdRemain":96600,"buildTags":"release-keys","packageName":"com.mihoyo.hyperion","networkType":"WiFi","oaid":"${oaid}","debugStatus":1,"ramCapacity":"107433","magnetometer":"-13.9125x-17.8875x-5.4750004","display":"${modelName}","appInstallTimeDiff":1717065300325,"packageVersion":"2.20.2","gyroscope":"0.017714571x-4.5813544E-4x0.0015271181","batteryStatus":76,"hasKeyboard":0,"board":"${board}"}`,
|
||||
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"${modelName}","productName":"${productName}","romRemain":"456","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"aaid":"${this.uuid}","model":"${modelName}","brand":"${deviceBrand}","hardware":"qcom","deviceType":"${deviceType}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"96757","appUpdateTimeDiff":1722171241616,"deviceInfo":"${deviceInfo}","vaid":"${this.uuid}","buildType":"user","sdkVersion":"30","ui_mode":"UI_MODE_TYPE_NORMAL","isMockLocation":0,"cpuType":"arm64-v8a","isAirMode":0,"ringMode":2,"chargeStatus":1,"manufacturer":"${deviceBrand}","emulatorStatus":0,"appMemory":"512","osVersion":"${osVersion}","vendor":"unknown","accelerometer":"-0.084346995x8.73799x4.6301117","sdRemain":96600,"buildTags":"release-keys","packageName":"com.mihoyo.hyperion","networkType":"WiFi","oaid":"${oaid}","debugStatus":1,"ramCapacity":"107433","magnetometer":"-13.9125x-17.8875x-5.4750004","display":"${deviceDisplay}","appInstallTimeDiff":1717065300325,"packageVersion":"2.20.2","gyroscope":"0.017714571x-4.5813544E-4x0.0015271181","batteryStatus":77,"hasKeyboard":0,"board":"${board}"}`,
|
||||
platform: '2',
|
||||
seed_id: `${this.uuid}`,
|
||||
seed_time: new Date().getTime() + '',
|
||||
|
|
@ -135,7 +137,7 @@ export default class ZZZApiTool {
|
|||
app_name: 'bbs_oversea',
|
||||
device_fp: '38d7f2352506c',
|
||||
device_id: '35315696b7071100',
|
||||
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"${modelName}","productName":"${productName}","romRemain":"474","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"model":"${modelName}","brand":"${deviceBrand}","hardware":"qcom","deviceType":"${deviceType}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"96715","appUpdateTimeDiff":1722171191009,"deviceInfo":"${deviceInfo}","buildType":"user","sdkVersion":"30","ui_mode":"UI_MODE_TYPE_NORMAL","isMockLocation":0,"cpuType":"arm64-v8a","isAirMode":0,"ringMode":2,"app_set_id":"${this.uuid}","chargeStatus":1,"manufacturer":"${deviceBrand}","emulatorStatus":0,"appMemory":"512","adid":"${this.uuid}","osVersion":"11","vendor":"unknown","accelerometer":"-0.22372891x-1.5332011x9.802497","sdRemain":96571,"buildTags":"release-keys","packageName":"com.mihoyo.hoyolab","networkType":"WiFi","debugStatus":1,"ramCapacity":"107433","magnetometer":"3.73125x-10.668751x3.7687502","display":"${modelName}","appInstallTimeDiff":1716489549794,"packageVersion":"","gyroscope":"0.18386503x-0.006413896x-0.008857286","batteryStatus":77,"hasKeyboard":0,"board":"${board}"}`,
|
||||
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"${modelName}","productName":"${productName}","romRemain":"474","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"model":"${modelName}","brand":"${deviceBrand}","hardware":"qcom","deviceType":"${deviceType}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"96715","appUpdateTimeDiff":1722171191009,"deviceInfo":"${deviceInfo}","buildType":"user","sdkVersion":"30","ui_mode":"UI_MODE_TYPE_NORMAL","isMockLocation":0,"cpuType":"arm64-v8a","isAirMode":0,"ringMode":2,"app_set_id":"${this.uuid}","chargeStatus":1,"manufacturer":"${deviceBrand}","emulatorStatus":0,"appMemory":"512","adid":"${this.uuid}","osVersion":"${osVersion}","vendor":"unknown","accelerometer":"-0.22372891x-1.5332011x9.802497","sdRemain":96571,"buildTags":"release-keys","packageName":"com.mihoyo.hoyolab","networkType":"WiFi","debugStatus":1,"ramCapacity":"107433","magnetometer":"3.73125x-10.668751x3.7687502","display":"${deviceDisplay}","appInstallTimeDiff":1716489549794,"packageVersion":"2.20.2","gyroscope":"0.18386503x-0.006413896x-0.008857286","batteryStatus":77,"hasKeyboard":0,"board":"${board}"}`,
|
||||
hoyolab_device_id: `${this.uuid}`,
|
||||
platform: '2',
|
||||
seed_id: `${this.uuid}`,
|
||||
|
|
|
|||
|
|
@ -80,10 +80,7 @@ export class ZZZPlugin extends plugin {
|
|||
handler: this.e?.runtime?.handler || {},
|
||||
e: this.e,
|
||||
});
|
||||
const currentCK = Object.values(ck).find(item => {
|
||||
return item.ck && item.uid === uid;
|
||||
});
|
||||
const ltuid = currentCK?.ltuid || '';
|
||||
const ltuid = await this.getLtuid();
|
||||
if (!ltuid) {
|
||||
this.reply('ltuid为空,请重新绑定CK');
|
||||
throw new Error('ltuid为空');
|
||||
|
|
@ -103,6 +100,7 @@ export class ZZZPlugin extends plugin {
|
|||
deviceType: bindInfo?.deviceName,
|
||||
modelName: bindInfo?.deviceModel,
|
||||
oaid: bindInfo?.oaid,
|
||||
osVersion: bindInfo?.androidVersion,
|
||||
deviceInfo: bindInfo?.deviceFingerprint,
|
||||
board: bindInfo?.deviceBoard,
|
||||
};
|
||||
|
|
@ -150,7 +148,7 @@ export class ZZZPlugin extends plugin {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
deviceFp = await redis.get(`ZZZ:DEVICE_FP:${uid}`);
|
||||
deviceFp = await redis.get(`ZZZ:DEVICE_FP:${uid}:FP`);
|
||||
if (!deviceFp) {
|
||||
const sdk = api.getUrl('getFp');
|
||||
const res = await request(sdk.url, {
|
||||
|
|
@ -161,7 +159,7 @@ export class ZZZPlugin extends plugin {
|
|||
const fpRes = await res.json();
|
||||
deviceFp = fpRes?.data?.device_fp;
|
||||
if (deviceFp) {
|
||||
await redis.set(`ZZZ:DEVICE_FP:${uid}`, deviceFp, {
|
||||
await redis.set(`ZZZ:DEVICE_FP:${uid}:FP`, deviceFp, {
|
||||
EX: 86400 * 7,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue