2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

修改salt到2.36.1,修正刷新ck逻辑

This commit is contained in:
ctrlcvs 2022-09-09 09:14:16 +08:00
parent dcf3b928a1
commit c81e0518fb
3 changed files with 608 additions and 628 deletions

File diff suppressed because it is too large Load Diff

View File

@ -215,58 +215,39 @@ export async function delSign(e) {
return true;
}
export async function updCookie(e) {
let user = new User(e);
await user.getCookie(e)
if(isV3){
let {
checkAuth
} = (await import(`file:///${_path}/plugins/xiaoyao-cvs-plugin/adapter/mys.js`))
let userCk = (await checkAuth(e, "cookie"))
e.uid = userCk.uid
}else{
// let {
// MysUser
// } = (await import(`file:///${_path}/lib/components/Models.js`))
// console.log(MysUser)
// let uid =await MysUser.getUidByCookie();
// console.log(uid)
// let {
// bing
// } = (await import(`file:///${_path}/lib/app/gachaLog.js`))
// let userCk = (await checkAuth(e, "cookie"))
// e.uid = userCk.uid
e.reply("暂不支持V2")
return true;
}
let miHoYoApi = new MihoYoApi(e);
if (!e.cookies || e.cookies.includes("undefined")) {
let stoken=await gsCfg.getBingStoken();
if (Object.keys(stoken).length==0) {
e.reply("请先绑定stoken")
return true;
}
let resObj = await miHoYoApi.updCookie();
if (!resObj?.data) {
e.reply(`请求异常:${resObj.message}`)
return false;
}
let stokenData=stoken[0]
let miHoYoApi = new MihoYoApi(e);
let sendMsg = [];
e._reply = e.reply;
e.reply = (msg) => {
sendMsg.push(msg)
}
let sk = await utils.getCookieMap(e.cookies)
let ck = resObj["data"]["cookie_token"];
e.msg = `ltoken=${sk.get("ltoken")};ltuid=${sk.get("stuid")};cookie_token=${ck}; account_id=${sk.get("stuid")};`
if (isV3) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default
e.ck = e.msg;
await (new userck(e)).bing()
} else {
let {
bingCookie
} = (await import(`file:///${_path}/lib/app/dailyNote.js`))
e.isPrivate = true;
await bingCookie(e)
for(let item of Object.keys(stokenData)){
miHoYoApi.cookies= `stuid=${stokenData[item].stuid};stoken=${stokenData[item].stoken};ltoken=${stokenData[item].ltoken};`;
let resObj = await miHoYoApi.updCookie();
if (!resObj?.data) {
e._reply(`请求异常:${resObj.message}`)
return false;
}
let sk = await utils.getCookieMap(miHoYoApi.cookies)
let ck = resObj["data"]["cookie_token"];
e.msg = `ltoken=${sk.get("ltoken")};ltuid=${sk.get("stuid")};cookie_token=${ck}; account_id=${sk.get("stuid")};`
if (isV3) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default
e.ck = e.msg;
await (new userck(e)).bing()
} else {
let {
bingCookie
} = (await import(`file:///${_path}/lib/app/dailyNote.js`))
e.isPrivate = true;
await bingCookie(e)
}
}
await utils.replyMake(e, sendMsg, 0)
return true;

View File

@ -13,13 +13,12 @@ import {
} from '../../components/Changelog.js';
import fetch from "node-fetch"
const APP_VERSION = "2.35.2";
const APP_VERSION = "2.36.1";
const mhyVersion = "2.11.1";
const salt = "ZSHlXeQUBis52qD1kEgKt5lUYed4b7Bb";
const salt = "n0KjuIrKgLHh08LWSCYP0WXlVXaYvV64";
const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v";
const saltWeb = "N50pqm7FSy2AkFz2B3TqtuZMJ5TOl3Ep";
const saltWeb = "YVEIkzDFNHLeKXLxzqCA9TzxCpWwbIbk";
const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
//b253c83ab2609b1b600eddfe974df47b
const DEVICE_ID = utils.randomString(32).toUpperCase();
const DEVICE_NAME = utils.randomString(_.random(1, 10));
const _path = process.cwd();