diff --git a/apps/user.js b/apps/user.js index 68c8659..a2edef9 100644 --- a/apps/user.js +++ b/apps/user.js @@ -207,6 +207,7 @@ export async function mytoken(e) { await user.getCookie(e) ck = await user.getStoken(e.user_id) sendMsg = `stuid=${ck.stuid};stoken=${ck.stoken};ltoken=${ck.ltoken};`; + if (ck?.mid) sendMsg += `mid=${ck?.mid};` } else { ck = await user.getyunToken(e); sendMsg = `${ck.yuntoken}devId=${ck.devId}` diff --git a/model/mys/mihoyoApi.js b/model/mys/mihoyoApi.js index 47bb8a0..c6d813d 100644 --- a/model/mys/mihoyoApi.js +++ b/model/mys/mihoyoApi.js @@ -47,7 +47,7 @@ export default class miHoYoApi { let data = this.getStoken(this.e.user_id); if (data) { this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`; - if(data?.mid){ + if (data?.mid) { this.cookies = `stuid=${data.stuid};stoken=${data.stoken};mid=${data.mid};`; } this.e.cookies = this.cookies @@ -104,7 +104,7 @@ export default class miHoYoApi { return false } let res = await response.text(); - //Bot.logger.mark(`[接口][${type}][${this.e.uid}] ${Date.now() - start}ms\n${res}`) + // Bot.logger.mark(`[接口][${type}][${this.e.uid}] ${Date.now() - start}ms\n${res}`) if (res.startsWith('(')) { res = JSON.parse((res).replace(/\(|\)/g, "")) } else { @@ -238,6 +238,12 @@ export default class miHoYoApi { url: `${mys.pass_api}/account/auth/api/getLTokenBySToken`, query: `${data.cookies}`, }, + getByStokenV2: { + url: `${mys.pass_api}/account/ma-cn-session/app/getTokenBySToken`, + body: {}, + types: 'pass' + }, + } if (!urlMap[type]) return false let { @@ -373,6 +379,26 @@ export default class miHoYoApi { "x-rpc-channel": "appstore", } break; + case "pass": + header = { + 'x-rpc-device_id': DEVICE_ID, + 'x-rpc-app_id': "bll8iq97cem8", + 'x-rpc-device_name': DEVICE_NAME, + 'x-rpc-app_version': mys.APP_VERSION, + 'x-rpc-game_biz': 'bbs_cn', + "Content-Type": "application/json;", + "x-rpc-client_type": "2", + "DS": this.getDs2('', {}, mys.passSalt), + "x-rpc-sdk_version": '1.3.1.2', + "User-Agent": "okhttp/4.9.3", + "Referer": "cors", + 'Host': 'passport-api.mihoyo.com', + "Connection": 'Keep-Alive', + "Accept-Encoding": "gzip, deflate, br", + "x-rpc-channel": "appstore", + Cookie: this.cookies, + } + break; default: header = {} break; diff --git a/model/mys/mysTool.js b/model/mys/mysTool.js index e6ef999..03de45e 100644 --- a/model/mys/mysTool.js +++ b/model/mys/mysTool.js @@ -1,8 +1,8 @@ -const APP_VERSION = "2.38.1"; +const APP_VERSION = "2.40.1"; const mhyVersion = "2.11.1"; -const salt = "PVeGWIZACpxXZ1ibMVJPi9inCY4Nd4y2"; -const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"; -const saltWeb = "yUZ3s0Sna1IrSNfk29Vo6vRapdOyqyhB"; +const salt = "fdv0fY9My9eA7MR0NpjGP9RjueFvjUSQ"; //k2 +const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"; //x6 +const saltWeb = "jEpJb9rRARU2rXDA9qYbZ3selxkuct9a";//lk2 const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9"; const passSalt='JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS'; const osSalt= ''; //599uqkwc0dlqu3h6epzjzfhgyyrd44ae rk4xg2hakoi26nljpr099fv9fck1ah10 @@ -220,6 +220,6 @@ export default { os_hk4_api, hk4_api, bbs_api, - pass_api, + pass_api,passSalt, boards } diff --git a/model/user.js b/model/user.js index f374da1..ac06c29 100644 --- a/model/user.js +++ b/model/user.js @@ -240,7 +240,6 @@ export default class user { name: "原神" }) if (!res?.data) { - console.log(res) res.message = `登录Stoken失效请重新获取cookies或stoken保存~`; res.isOk = false; this.delSytk(yamlDataUrl, this.e) @@ -749,13 +748,15 @@ export default class user { } } async seachUid(data) { - let ltoken = '' + let ltoken = '',v2Sk; if (data?.data) { let res; if (this.e.sk) { if(this.e.sk.get('stoken').includes('v2_')){ res=await this.getData('getLtoken',{cookies:this.e.raw_message},false) ltoken=res?.data?.ltoken + }else{ + v2Sk=await this.getData('getByStokenV2',{headers:{Cookie:this.e.raw_message}},false) } this.e.cookie = `ltoken=${this.e.sk?.get('ltoken') || ltoken};ltuid=${this.e.sk?.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk?.get('stuid')};` @@ -763,6 +764,7 @@ export default class user { // this.e.cookie = // `ltoken_v2=${this.e.sk?.get('ltoken')||ltoken};cookie_token_v2=${data.data.cookie_token}; account_mid_v2=${this.e.sk.get('mid')};ltmid_v2=${this.e.sk.get('mid')}` // } + } else { this.e.cookie = this.e.original_msg } @@ -777,9 +779,9 @@ export default class user { uids.push(uid) datalist[uid] = { stuid: this.e?.sk?.get('stuid') || this.e.stuid, - stoken: this.e?.sk?.get('stoken') || data?.data?.list[0].token, + stoken:v2Sk?.data?.token?.token || this.e?.sk?.get('stoken') || data?.data?.list[0].token, ltoken: this.e?.sk?.get('ltoken') || ltoken || data?.data?.list[1].token, - mid: this.e?.sk?.get('mid'), + mid: this.e?.sk?.get('mid')||v2Sk?.data?.user_info?.mid, uid: uid, userId: this.e.user_id, is_sign: true