fix: 修复原神功能1034问题

This commit is contained in:
ikechan8370 2023-10-07 19:33:25 +08:00 committed by 时雨◎星空
parent 07ef0b8c76
commit 2ce72874d3
4 changed files with 35 additions and 7 deletions

View File

@ -32,7 +32,7 @@ export default class base {
srtempFile: 'StarRail/'
}
}
let headImg = _.sample(fs.readdirSync(`${this._path}/plugins/genshin/resources/img/namecard`).filter(file => file.endsWith('.png')))
return {
saveId: this.userId,

View File

@ -113,10 +113,10 @@ export default class apiTool {
body: {
seed_id: data.seed_id,
device_id: data.deviceId,
platform: '5',
platform: '1',
seed_time: new Date().getTime() + '',
ext_fields: '{"userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.40.1","browserScreenSize":281520,"maxTouchPoints":5,"isTouchSupported":true,"browserLanguage":"zh-CN","browserPlat":"iPhone","browserTimeZone":"Asia/Shanghai","webGlRender":"Apple GPU","webGlVendor":"Apple Inc.","numOfPlugins":0,"listOfPlugins":"unknown","screenRatio":3,"deviceMemory":"unknown","hardwareConcurrency":"4","cpuClass":"unknown","ifNotTrack":"unknown","ifAdBlock":0,"hasLiedResolution":1,"hasLiedOs":0,"hasLiedBrowser":0}',
app_name: 'account_cn',
ext_fields: '{"proxyStatus":"0","accelerometer":"-0.159515x-0.830887x-0.682495","ramCapacity":"3746","IDFV":"8F4E403B-4C28-4F7F-B740-2DD317948B8A","gyroscope":"-0.191951x-0.112927x0.632637","isJailBreak":"0","model":"iPhone12,5","ramRemain":"115","chargeStatus":"1","networkType":"WIFI","vendor":"--","osVersion":"17.0.2","batteryStatus":"50","screenSize":"414×896","cpuCores":"6","appMemory":"55","romCapacity":"488153","romRemain":"157348","cpuType":"CPU_TYPE_ARM64","magnetometer":"-84.426331x-89.708435x-37.117889"}',
app_name: 'bbs_cn',
device_fp: '38d7ee834d1e9'
},
}

View File

@ -11,7 +11,7 @@ export default class MysApi {
* @param option 其他参数
* @param option.log 是否显示日志
*/
constructor (uid, cookie, option = {}, isSr = false) {
constructor (uid, cookie, option = {}, isSr = false, device = '') {
this.uid = uid
this.cookie = cookie
this.isSr = isSr
@ -20,6 +20,7 @@ export default class MysApi {
/** 5分钟缓存 */
this.cacheCd = 300
this._device = device
this.option = {
log: true,
...option
@ -66,7 +67,23 @@ export default class MysApi {
return 'cn_gf01'
}
async getData (type, data = {}, cached = false) {
async getData (type, data = {}, cached = false, isGetFP = false) {
if (!isGetFP && !data.device_fp) {
let seed_id = this.generateSeed(16)
let device_fp = await this.getData('getFp', {
seed_id
}, false, true)
if (!data) {
data = {}
}
if (data?.headers) {
data.headers['x-rpc-device_fp'] = device_fp?.data?.device_fp
} else {
data.headers = {
'x-rpc-device_fp': device_fp?.data?.device_fp
}
}
}
let { url, headers, body } = this.getUrl(type, data)
if (!url) return false
@ -210,4 +227,14 @@ export default class MysApi {
return null
}
generateSeed (length = 16) {
const characters = '0123456789abcdef'
let result = ''
for (let i = 0; i < length; i++) {
result += characters[Math.floor(Math.random() * characters.length)]
}
return result
}
}

View File

@ -158,7 +158,8 @@ export default class MysInfo {
if (!mysInfo.uid || !mysInfo.ckInfo.ck) return false
e.uid = mysInfo.uid
let mysApi = new MysApi(mysInfo.uid, mysInfo.ckInfo.ck, option, e.isSr)
let user = e.user?.getMysUser()
let mysApi = new MysApi(mysInfo.uid, mysInfo.ckInfo.ck, option, e.isSr, user.device)
let res
if (lodash.isObject(api)) {