mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 11:00:51 +08:00
兼容v2sk绑定
This commit is contained in:
parent
0f8b38338b
commit
d001517b06
@ -23,9 +23,6 @@ import {
|
||||
sysCfg,updateTemp,
|
||||
updateMiaoPlugin
|
||||
} from "./admin.js";
|
||||
import {
|
||||
currentVersion
|
||||
} from "../components/Changelog.js";
|
||||
import {
|
||||
rule as userRule,
|
||||
delSign,
|
||||
@ -74,7 +71,6 @@ export {
|
||||
Note,
|
||||
};
|
||||
import gsCfg from '../model/gsCfg.js';
|
||||
import Data from "../components/Data.js";
|
||||
const _path = process.cwd();
|
||||
|
||||
let rule = {
|
||||
|
10
apps/user.js
10
apps/user.js
@ -184,11 +184,11 @@ export async function gclog(e) {
|
||||
return true;
|
||||
}
|
||||
async function getAuthKey(e, user) {
|
||||
if(!e.uid){
|
||||
e.uid=e?.runtime?.user?._regUid
|
||||
if (!e.uid) {
|
||||
e.uid = e?.runtime?.user?._regUid
|
||||
}
|
||||
e.region = getServer(e.uid)
|
||||
let authkeyrow = await user.getData("authKey",{});
|
||||
let authkeyrow = await user.getData("authKey", {});
|
||||
if (!authkeyrow?.data) {
|
||||
e.reply(`uid:${e.uid},authkey获取失败:` + (authkeyrow.message.includes("登录失效") ? "请重新绑定stoken" : authkeyrow.message))
|
||||
return false;
|
||||
@ -323,7 +323,9 @@ export async function updCookie(e) {
|
||||
for (let item of Object.keys(stoken)) {
|
||||
e.region = getServer(stoken[item].uid)
|
||||
e.uid = stoken[item].uid
|
||||
let res = await user.getData("bbsGetCookie", { cookies: `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}` }, false)
|
||||
let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}`
|
||||
if (stoken[item]?.mid) cookies += `&mid=${stoken[item]?.mid}`
|
||||
let res = await user.getData("bbsGetCookie", { cookies: cookies }, false)
|
||||
if (!res?.data) {
|
||||
e.reply(`uid:${stoken[item].uid},请求异常:${res.message}`)
|
||||
continue;
|
||||
|
@ -190,6 +190,9 @@ class GsCfg {
|
||||
if(!ck[Object.keys(data)[0]]){
|
||||
ck = YAML.stringify(ck)
|
||||
fs.writeFileSync(file, yaml + ck, 'utf8')
|
||||
}else{
|
||||
ck[Object.keys(data)[0]] = data[Object.keys(data)[0]]
|
||||
fs.writeFileSync(file,YAML.stringify(ck), 'utf8')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -47,6 +47,9 @@ 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){
|
||||
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};mid=${data.mid};`;
|
||||
}
|
||||
this.e.cookies = this.cookies
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ export async function getCookieMap(cookie) {
|
||||
let cookieArray = cookie.replace(/\s*/g, "").split(";");
|
||||
let cookieMap = new Map();
|
||||
for (let item of cookieArray) {
|
||||
let entry = item.split("=");
|
||||
let entry = item.replace('=','~').split("~");
|
||||
if (!entry[0]) continue;
|
||||
cookieMap.set(entry[0], entry[1]);
|
||||
}
|
||||
|
@ -133,7 +133,6 @@ export default class user {
|
||||
// break;
|
||||
// } else {
|
||||
// // await utils.sleepAsync(60000 * 6) // 由于这个方法已经无法过验证码了所以不在处理
|
||||
// //ps:你要是觉得改有加高过的概率就改吧,随便你反正到时候黑IP的不是我
|
||||
// }
|
||||
// }
|
||||
await utils.sleepAsync(2000)
|
||||
@ -241,6 +240,7 @@ export default class user {
|
||||
name: "原神"
|
||||
})
|
||||
if (!res?.data) {
|
||||
console.log(res)
|
||||
res.message = `登录Stoken失效请重新获取cookies或stoken保存~`;
|
||||
res.isOk = false;
|
||||
this.delSytk(yamlDataUrl, this.e)
|
||||
@ -753,10 +753,10 @@ export default class user {
|
||||
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
|
||||
// }
|
||||
if(this.e.sk.get('stoken').includes('v2_')){
|
||||
res=await this.getData('getLtoken',{cookies:this.e.raw_message},false)
|
||||
ltoken=res?.data?.ltoken
|
||||
}
|
||||
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')};`
|
||||
// if(this.e.sk?.get('mid')){
|
||||
|
@ -91,6 +91,8 @@
|
||||
- "#坎蒂丝图鉴"
|
||||
- "#纳西妲图鉴"
|
||||
- "#莱依拉图鉴"
|
||||
- "#艾尔海森图鉴"
|
||||
- "#瑶瑶图鉴"
|
||||
至冬角色图鉴|至冬人物图鉴|至冬英雄图鉴:
|
||||
- "#达达利亚图鉴"
|
||||
未知地区角色图鉴|未知地区人物图鉴|未知地区英雄图鉴:
|
||||
@ -234,6 +236,8 @@
|
||||
- "#柯莱图鉴"
|
||||
- "#提纳里图鉴"
|
||||
- "#纳西妲图鉴"
|
||||
- "#艾尔海森图鉴"
|
||||
- "#瑶瑶图鉴"
|
||||
单手剑角色图鉴|单手剑人物图鉴|单手剑英雄图鉴:
|
||||
- "#风主图鉴"
|
||||
- "#岩主图鉴"
|
||||
@ -338,6 +342,7 @@
|
||||
- "#纪行武器图鉴"
|
||||
- "#活动武器图鉴"
|
||||
五星武器图鉴|5星武器图鉴:
|
||||
- "#裁叶萃光图鉴"
|
||||
- "#图莱杜拉的回忆图鉴"
|
||||
- "#千夜浮梦图鉴"
|
||||
- "#圣显之钥图鉴"
|
||||
@ -493,6 +498,7 @@
|
||||
- "#猎弓图鉴"
|
||||
- "#无锋剑图鉴"
|
||||
单手剑武器图鉴|单手武器图鉴:
|
||||
- "#裁叶萃光图鉴"
|
||||
- "#圣显之钥图鉴"
|
||||
- "#西福斯的月光图鉴"
|
||||
- "#波乱月白经津图鉴"
|
||||
@ -766,6 +772,7 @@
|
||||
- "#甲级宝珏图鉴"
|
||||
- "#猎弓图鉴"
|
||||
暴击伤害武器图鉴|爆伤武器图鉴:
|
||||
- "#裁叶萃光图鉴"
|
||||
- "#图莱杜拉的回忆图鉴"
|
||||
- "#若水图鉴"
|
||||
- "#神乐之真意图鉴"
|
||||
|
@ -155,9 +155,16 @@
|
||||
图莱杜拉的回忆:
|
||||
- 图莱杜拉的回忆
|
||||
- 图莱杜拉
|
||||
- 图莱
|
||||
- 流浪者
|
||||
- 散兵
|
||||
- 铃铛
|
||||
裁叶萃光:
|
||||
- 草剑
|
||||
- 萃光
|
||||
- 裁叶
|
||||
- 白月枝芒
|
||||
- 艾尔海森
|
||||
昭心:
|
||||
- 糟心
|
||||
幽夜华尔兹:
|
||||
|
Loading…
Reference in New Issue
Block a user