From d001517b06d9eaabcf2a4596a59ff26b291ed0f0 Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Sat, 10 Dec 2022 15:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9v2sk=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/index.js | 4 ---- apps/user.js | 10 ++++++---- model/gsCfg.js | 3 +++ model/mys/mihoyoApi.js | 3 +++ model/mys/utils.js | 2 +- model/user.js | 10 +++++----- resources/Atlas_alias/Atlas_list.yaml | 7 +++++++ resources/Atlas_alias/wuqi_tujian.yaml | 7 +++++++ 8 files changed, 32 insertions(+), 14 deletions(-) diff --git a/apps/index.js b/apps/index.js index 9cbd18a..19a0a6a 100644 --- a/apps/index.js +++ b/apps/index.js @@ -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 = { diff --git a/apps/user.js b/apps/user.js index b6c1d91..68c8659 100644 --- a/apps/user.js +++ b/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; diff --git a/model/gsCfg.js b/model/gsCfg.js index c53f756..1b3f369 100644 --- a/model/gsCfg.js +++ b/model/gsCfg.js @@ -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') } } }) diff --git a/model/mys/mihoyoApi.js b/model/mys/mihoyoApi.js index df71b85..47bb8a0 100644 --- a/model/mys/mihoyoApi.js +++ b/model/mys/mihoyoApi.js @@ -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 } } diff --git a/model/mys/utils.js b/model/mys/utils.js index bdb4b48..7e9e38d 100644 --- a/model/mys/utils.js +++ b/model/mys/utils.js @@ -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]); } diff --git a/model/user.js b/model/user.js index 2b6cff6..f374da1 100644 --- a/model/user.js +++ b/model/user.js @@ -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')){ diff --git a/resources/Atlas_alias/Atlas_list.yaml b/resources/Atlas_alias/Atlas_list.yaml index 9b586a4..2e4cc68 100644 --- a/resources/Atlas_alias/Atlas_list.yaml +++ b/resources/Atlas_alias/Atlas_list.yaml @@ -91,6 +91,8 @@ - "#坎蒂丝图鉴" - "#纳西妲图鉴" - "#莱依拉图鉴" + - "#艾尔海森图鉴" + - "#瑶瑶图鉴" 至冬角色图鉴|至冬人物图鉴|至冬英雄图鉴: - "#达达利亚图鉴" 未知地区角色图鉴|未知地区人物图鉴|未知地区英雄图鉴: @@ -234,6 +236,8 @@ - "#柯莱图鉴" - "#提纳里图鉴" - "#纳西妲图鉴" + - "#艾尔海森图鉴" + - "#瑶瑶图鉴" 单手剑角色图鉴|单手剑人物图鉴|单手剑英雄图鉴: - "#风主图鉴" - "#岩主图鉴" @@ -338,6 +342,7 @@ - "#纪行武器图鉴" - "#活动武器图鉴" 五星武器图鉴|5星武器图鉴: + - "#裁叶萃光图鉴" - "#图莱杜拉的回忆图鉴" - "#千夜浮梦图鉴" - "#圣显之钥图鉴" @@ -493,6 +498,7 @@ - "#猎弓图鉴" - "#无锋剑图鉴" 单手剑武器图鉴|单手武器图鉴: + - "#裁叶萃光图鉴" - "#圣显之钥图鉴" - "#西福斯的月光图鉴" - "#波乱月白经津图鉴" @@ -766,6 +772,7 @@ - "#甲级宝珏图鉴" - "#猎弓图鉴" 暴击伤害武器图鉴|爆伤武器图鉴: + - "#裁叶萃光图鉴" - "#图莱杜拉的回忆图鉴" - "#若水图鉴" - "#神乐之真意图鉴" diff --git a/resources/Atlas_alias/wuqi_tujian.yaml b/resources/Atlas_alias/wuqi_tujian.yaml index 972bbec..3f2d3ca 100644 --- a/resources/Atlas_alias/wuqi_tujian.yaml +++ b/resources/Atlas_alias/wuqi_tujian.yaml @@ -155,9 +155,16 @@ 图莱杜拉的回忆: - 图莱杜拉的回忆 - 图莱杜拉 + - 图莱 - 流浪者 - 散兵 - 铃铛 +裁叶萃光: + - 草剑 + - 萃光 + - 裁叶 + - 白月枝芒 + - 艾尔海森 昭心: - 糟心 幽夜华尔兹: