mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
148 lines
7.5 KiB
JavaScript
148 lines
7.5 KiB
JavaScript
import { generateSeed, randomString } from '../../utils/data.js';
|
|
import crypto from 'crypto';
|
|
/**
|
|
* derived from miao-yunzai
|
|
*/
|
|
export default class ZZZApiTool {
|
|
/**
|
|
*
|
|
* @param {uid} uid
|
|
* @param {server} server
|
|
*/
|
|
constructor(uid, server) {
|
|
this.uid = uid;
|
|
this.isZZZ = true;
|
|
this.server = server;
|
|
this.game = 'zzz';
|
|
this.uuid = crypto.randomUUID();
|
|
if (['prod_gf_cn'].includes(this.server)) {
|
|
this.gameBiz = 'nap_cn';
|
|
this.host = 'https://api-takumi.mihoyo.com/';
|
|
this.hostRecord = 'https://api-takumi-record.mihoyo.com/';
|
|
this.hostPublicData = 'https://public-data-api.mihoyo.com/';
|
|
this.hostBbs = 'https://bbs-api.miyoushe.com/';
|
|
} else {
|
|
this.gameBiz = 'nap_global';
|
|
this.host = 'https://sg-public-api.hoyolab.com/';
|
|
this.hostRecord = 'https://sg-act-nap-api.hoyolab.com/';
|
|
this.hostPublicData = 'https://sg-public-data-api.hoyoverse.com/';
|
|
}
|
|
this.zzzUrlMap = {
|
|
zzzUser: {
|
|
url: `${this.host}binding/api/getUserGameRolesByCookie`,
|
|
query: `game_biz=${this.gameBiz}®ion=${this.server}&game_uid=${this.uid}`,
|
|
},
|
|
zzzNote: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/note`,
|
|
query: `role_id=${this.uid}&server=${this.server}`,
|
|
},
|
|
zzzIndex: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/index`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}`,
|
|
},
|
|
zzzAvatarList: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/avatar/basic`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}`,
|
|
},
|
|
zzzAvatarInfo: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/avatar/info`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}&need_wiki=false`,
|
|
},
|
|
zzzBuddyList: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/buddy/info`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}`,
|
|
},
|
|
zzzChallenge: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/challenge`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}&schedule_type=1`,
|
|
},
|
|
zzzChallengePeriod: {
|
|
url: `${this.hostRecord}event/game_record_zzz/api/zzz/challenge`,
|
|
query: `lang=zh-cn&role_id=${this.uid}&server=${this.server}&schedule_type=2`,
|
|
},
|
|
zzzAuthKey: {
|
|
url: `${this.host}binding/api/genAuthKey`,
|
|
body: {
|
|
auth_appid: 'webview_gacha',
|
|
game_biz: this.gameBiz,
|
|
game_uid: this.uid * 1,
|
|
region: this.server,
|
|
},
|
|
dsSalt: 'web',
|
|
},
|
|
};
|
|
}
|
|
|
|
getUrlMap = (data = {}) => {
|
|
const {
|
|
productName = 'J9110',
|
|
deviceType = 'J9110',
|
|
modelName = 'Sony',
|
|
oaid = 'e3ba65d61709d17074a306072a7c3a2ec70e6d374ca6d29eb6b1b965cbb68e23',
|
|
deviceInfo = `Sony\/J9110\/J9110:11\/55.2.A.4.332\/055002A004033203408384484:user\/release-keys`,
|
|
board = 'msmnile',
|
|
} = data;
|
|
const deviceBrand = deviceInfo.split('/')[0];
|
|
let urlMap = {
|
|
zzz: {
|
|
...(['prod_gf_cn'].includes(this.server)
|
|
? {
|
|
getFp: {
|
|
url: `${this.hostPublicData}device-fp/api/getFp`,
|
|
body: {
|
|
app_name: 'bbs_cn',
|
|
bbs_device_id: `${this.uuid}`,
|
|
device_fp: '38d7faa51d2b6',
|
|
device_id: '35315696b7071100',
|
|
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"Xperia 1","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}"}`,
|
|
platform: '2',
|
|
seed_id: `${this.uuid}`,
|
|
seed_time: new Date().getTime() + '',
|
|
},
|
|
noDs: true,
|
|
},
|
|
deviceLogin: {
|
|
url: `${this.hostBbs}apihub/api/deviceLogin`,
|
|
body: {
|
|
app_version: '2.73.1',
|
|
device_id: data.deviceId,
|
|
device_name: `${deviceBrand}${modelName}`,
|
|
os_version: '33',
|
|
platform: 'Android',
|
|
registration_id: generateSeed(19),
|
|
},
|
|
},
|
|
saveDevice: {
|
|
url: `${this.hostBbs}apihub/api/saveDevice`,
|
|
body: {
|
|
app_version: '2.73.1',
|
|
device_id: data.deviceId,
|
|
device_name: `${deviceBrand}${modelName}`,
|
|
os_version: '33',
|
|
platform: 'Android',
|
|
registration_id: generateSeed(19),
|
|
},
|
|
},
|
|
}
|
|
: {
|
|
getFp: {
|
|
url: `${this.hostPublicData}device-fp/api/getFp`,
|
|
body: {
|
|
seed_id: `${this.uuid}`,
|
|
device_id: '35315696b7071100',
|
|
hoyolab_device_id: `${this.uuid}`,
|
|
platform: '2',
|
|
seed_time: new Date().getTime() + '',
|
|
ext_fields: `{"proxyStatus":1,"isRoot":1,"romCapacity":"512","deviceName":"Xperia 1","productName":"${productName}","romRemain":"483","hostname":"BuildHost","screenSize":"1096x2434","isTablet":0,"model":"${modelName}","brand":"${deviceBrand}","hardware":"qcom","deviceType":"${deviceType}","oaid":"${oaid}","devId":"REL","serialNumber":"unknown","sdCapacity":107433,"buildTime":"1633631032000","buildUser":"BuildUser","simState":1,"ramRemain":"98076","appUpdateTimeDiff":1716545162858,"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.9233304x7.574181x6.472585","sdRemain":97931,"buildTags":"release-keys","packageName":"com.mihoyo.hoyolab","networkType":"WiFi","debugStatus":1,"ramCapacity":"107433","magnetometer":"-9.075001x-27.300001x-3.3000002","display":"${modelName}","appInstallTimeDiff":1716489549794,"packageVersion":"","gyroscope":"0.027029991x-0.04459185x0.032222193","batteryStatus":45,"hasKeyboard":0,"board":"${board}"}`,
|
|
app_name: 'bbs_oversea',
|
|
device_fp: '38d7f2352506c',
|
|
},
|
|
noDs: true,
|
|
},
|
|
}),
|
|
...this.zzzUrlMap,
|
|
},
|
|
};
|
|
return urlMap[this.game];
|
|
};
|
|
}
|