mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
增加指令#刷新ck
This commit is contained in:
parent
dde5ab4561
commit
57489b68c0
@ -1,6 +1,7 @@
|
|||||||
# 1.2.0
|
# 1.2.0
|
||||||
* 咕咕咕
|
* 新增指令 `#刷新ck`
|
||||||
* 努力填坑中,速度缓慢咕
|
* 需要绑定`stoken`
|
||||||
|
* 用于刷新登录失效的ck
|
||||||
* 新增指令`#我的stoken|#我的云ck`
|
* 新增指令`#我的stoken|#我的云ck`
|
||||||
* 新增操作发送`stoken`可以直接绑定
|
* 新增操作发送`stoken`可以直接绑定
|
||||||
* 具体格式 ****stuid=**********;stoken=**********;ltoken=**********;****
|
* 具体格式 ****stuid=**********;stoken=**********;ltoken=**********;****
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
currentVersion
|
currentVersion
|
||||||
} from "../components/Changelog.js";
|
} from "../components/Changelog.js";
|
||||||
import {
|
import {
|
||||||
rule as userRule,delSign,
|
rule as userRule,delSign,updCookie,
|
||||||
userInfo,gclog,mytoken,bindStoken
|
userInfo,gclog,mytoken,bindStoken
|
||||||
} from "./user.js"
|
} from "./user.js"
|
||||||
import {
|
import {
|
||||||
@ -45,7 +45,7 @@ export {
|
|||||||
pokeNote,yunSign,sendyunTime,yuntoken,
|
pokeNote,yunSign,sendyunTime,yuntoken,
|
||||||
cookiesDocHelp,yunHelp,
|
cookiesDocHelp,yunHelp,
|
||||||
sysCfg,
|
sysCfg,
|
||||||
help,
|
help,updCookie,
|
||||||
DailyNoteTask,
|
DailyNoteTask,
|
||||||
allMysSign,
|
allMysSign,
|
||||||
allSign,
|
allSign,
|
||||||
|
39
apps/user.js
39
apps/user.js
@ -39,6 +39,10 @@ export const rule = {
|
|||||||
reg: "^#*删除(我的)*(stoken|(云原神|云ck))$",
|
reg: "^#*删除(我的)*(stoken|(云原神|云ck))$",
|
||||||
describe: "删除云原神、stoken数据"
|
describe: "删除云原神、stoken数据"
|
||||||
},
|
},
|
||||||
|
updCookie:{
|
||||||
|
reg:"^#*(刷新|更新)(ck|cookie)$",
|
||||||
|
describe:"刷新cookie"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
const YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
const YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
||||||
@ -209,3 +213,38 @@ export async function delSign(e){
|
|||||||
await user.delSytk(url,e)
|
await user.delSytk(url,e)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
export async function updCookie(e){
|
||||||
|
let user = new User(e);
|
||||||
|
await user.getCookie(e)
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
if (!e.cookies || e.cookies.includes("undefined")) {
|
||||||
|
e.reply("请先绑定stoken")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let resObj=await miHoYoApi.updCookie();
|
||||||
|
if(!resObj?.data){
|
||||||
|
e.reply(`请求异常:${resObj.message}`)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let sendMsg = [];
|
||||||
|
e._reply = e.reply;
|
||||||
|
e.reply = (msg) => {
|
||||||
|
sendMsg.push(msg)
|
||||||
|
}
|
||||||
|
let sk = await utils.getCookieMap(e.cookie)
|
||||||
|
let ck=resObj["data"]["cookie_token"];
|
||||||
|
e.msg=`ltoken=${sk.get("ltoken")};ltuid=${sk.get("ltuid")};cookie_token=${ck}; account_id=${sk.get("ltuid")};`
|
||||||
|
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;
|
||||||
|
}
|
@ -270,7 +270,12 @@ export default class MihoYoApi {
|
|||||||
resObj.log_msg = log_msg
|
resObj.log_msg = log_msg
|
||||||
return resObj
|
return resObj
|
||||||
}
|
}
|
||||||
|
async updCookie(){
|
||||||
|
let url = `https://api-takumi.mihoyo.com/auth/api/getCookieAccountInfoBySToken`;
|
||||||
|
let res = await superagent.get(url).set(this._getHeader()).timeout(10000);
|
||||||
|
let resObj = JSON.parse(res.text);
|
||||||
|
return resObj;
|
||||||
|
}
|
||||||
async stoken(cookie, e) {
|
async stoken(cookie, e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
let datalist = this.getStoken(e.user_id) || {}
|
let datalist = this.getStoken(e.user_id) || {}
|
||||||
|
@ -64,7 +64,7 @@ export async function getCookieMap(cookie) {
|
|||||||
if (!entry[0]) continue;
|
if (!entry[0]) continue;
|
||||||
cookieMap.set(entry[0], entry[1]);
|
cookieMap.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
return cookieMap;
|
return cookieMap||{};
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
sleepAsync,
|
sleepAsync,
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
"冬极白星": ["冬极","冬季","公子","达达利亚","鸭鸭","达达鸭"],
|
"冬极白星": ["冬极","冬季","公子","达达利亚","鸭鸭","达达鸭"],
|
||||||
"波乱月白经津": ["波乱", "月白", "波乱月白", "经津", "波波津","凌人","神里凌人","神理凌人","啵啵剑"],
|
"波乱月白经津": ["波乱", "月白", "波乱月白", "经津", "波波津","凌人","神里凌人","神理凌人","啵啵剑"],
|
||||||
"若水": ["麒麟弓", "Aqua", "aqua","夜兰","叶兰","夜阑","夜天后"],
|
"若水": ["麒麟弓", "Aqua", "aqua","夜兰","叶兰","夜阑","夜天后"],
|
||||||
"猎人之径":["驴耳","提纳里"],
|
"流浪的晚星":["流浪的晚星"],
|
||||||
|
"圣显之钥":["圣显之钥","妮露"],
|
||||||
|
"赤沙之杖":["赤沙之杖","赛诺"],
|
||||||
|
|
||||||
"磐岩结绿": ["绿箭", "绿剑"],
|
"磐岩结绿": ["绿箭", "绿剑"],
|
||||||
"和璞鸢": ["鸟枪", "绿枪","魈","绿叉","护法夜叉"],
|
"和璞鸢": ["鸟枪", "绿枪","魈","绿叉","护法夜叉"],
|
||||||
@ -132,5 +134,6 @@
|
|||||||
|
|
||||||
"渔获": ["鱼叉","渔叉","鱼获"],
|
"渔获": ["鱼叉","渔叉","鱼获"],
|
||||||
"笼钓瓶一心":["妖刀", "红刀", "笼钓瓶", "一心传名刀","万叶外观"],
|
"笼钓瓶一心":["妖刀", "红刀", "笼钓瓶", "一心传名刀","万叶外观"],
|
||||||
"竭泽":["竭泽","咸鱼弓","鱼弓","渔弓"]
|
"竭泽":["竭泽","咸鱼弓","鱼弓","渔弓"],
|
||||||
|
"风信之锋":["风信之锋"]
|
||||||
}
|
}
|
@ -63,7 +63,6 @@ body {
|
|||||||
color: #495366;
|
color: #495366;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-radius: 0 16px 16px 0;
|
border-radius: 0 16px 16px 0;
|
||||||
font-family: Number, "微软雅黑", sans-serif;
|
|
||||||
}
|
}
|
||||||
.cfg-status.status-off {
|
.cfg-status.status-off {
|
||||||
color: #a95151;
|
color: #a95151;
|
||||||
|
@ -76,7 +76,6 @@ body {
|
|||||||
color: #495366;
|
color: #495366;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-radius: 0 16px 16px 0;
|
border-radius: 0 16px 16px 0;
|
||||||
font-family: Number, "微软雅黑", sans-serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cfg-status.status-off {
|
.cfg-status.status-off {
|
||||||
|
Loading…
Reference in New Issue
Block a user