2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +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; return true;
} }
export async function updCookie(e) { export async function updCookie(e) {
let user = new User(e); let stoken=await gsCfg.getBingStoken();
await user.getCookie(e) if (Object.keys(stoken).length==0) {
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")) {
e.reply("请先绑定stoken") e.reply("请先绑定stoken")
return true; return true;
} }
let resObj = await miHoYoApi.updCookie(); let stokenData=stoken[0]
if (!resObj?.data) { let miHoYoApi = new MihoYoApi(e);
e.reply(`请求异常:${resObj.message}`)
return false;
}
let sendMsg = []; let sendMsg = [];
e._reply = e.reply; e._reply = e.reply;
e.reply = (msg) => { e.reply = (msg) => {
sendMsg.push(msg) sendMsg.push(msg)
} }
let sk = await utils.getCookieMap(e.cookies) for(let item of Object.keys(stokenData)){
let ck = resObj["data"]["cookie_token"]; miHoYoApi.cookies= `stuid=${stokenData[item].stuid};stoken=${stokenData[item].stoken};ltoken=${stokenData[item].ltoken};`;
e.msg = `ltoken=${sk.get("ltoken")};ltuid=${sk.get("stuid")};cookie_token=${ck}; account_id=${sk.get("stuid")};` let resObj = await miHoYoApi.updCookie();
if (isV3) { if (!resObj?.data) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default e._reply(`请求异常:${resObj.message}`)
e.ck = e.msg; return false;
await (new userck(e)).bing() }
} else { let sk = await utils.getCookieMap(miHoYoApi.cookies)
let { let ck = resObj["data"]["cookie_token"];
bingCookie e.msg = `ltoken=${sk.get("ltoken")};ltuid=${sk.get("stuid")};cookie_token=${ck}; account_id=${sk.get("stuid")};`
} = (await import(`file:///${_path}/lib/app/dailyNote.js`)) if (isV3) {
e.isPrivate = true; let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default
await bingCookie(e) 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) await utils.replyMake(e, sendMsg, 0)
return true; return true;

View File

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