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

View File

@ -62,7 +62,7 @@ export const rule = {
describe: "云原神签到token获取"
},
cookiesDocHelp: {
reg: "^#*(米游社|cookies|米游币)帮助$",
reg: "^#*(米游社|cookies|米游币|stoken|Stoken)(帮助|教程|绑定)$",
describe: "cookies获取帮助"
},
yunHelp:{
@ -294,7 +294,6 @@ async function cookie(e) {
return false;
}
let stokens=miHoYoApi.getStoken(e.user_id)
console.log(stokens)
if (Object.keys(stokens).length>0) {
return true;
}
@ -337,7 +336,7 @@ async function getCookie(e) {
}
export async function cookiesDocHelp(e) {
let cookiesDoc = await getcookiesDoc()
e.reply("【cookies帮助】" + cookiesDoc + "\ncookies必须包含login_ticket获取后请私发机器人");
e.reply(`${e.msg.replace(/帮助|教程|绑定/g,"")}帮助】${cookiesDoc}\ncookies必须包含login_ticket获取后请私发机器人`);
return true
}
async function getcookiesDoc() {
@ -518,7 +517,8 @@ const getyunToken=async function(e){
try {
let ck = fs.readFileSync(file, 'utf-8')
ck = YAML.parse(ck)
e.devId=ck.devId; e.yuntoken=ck.yuntoken;
e.devId=ck.devId;
e.yuntoken=ck.yuntoken;
return ck
} catch (error) {
return ""

View File

@ -215,46 +215,26 @@ 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)
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) {
@ -268,6 +248,7 @@ export async function updCookie(e) {
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();