mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
增加失效sk拦截避免持续请求
This commit is contained in:
parent
398744f1fa
commit
e41c7fbcd9
@ -255,7 +255,8 @@ export async function bindStoken(e) {
|
||||
let user = new User(e);
|
||||
await user.cookie(e)
|
||||
e.region = getServer(e.uid)
|
||||
let res= await user.getData("bbsGetCookie",{cookies:msg.replace(/;/g,'&').replace(/stuid/,"uid")} )
|
||||
e.cks=msg.replace(/;/g,'&').replace(/stuid/,"uid")
|
||||
let res= await user.getData("bbsGetCookie",{cookies:e.cks})
|
||||
if (!res?.data) {
|
||||
await e.reply(`绑定Stoken失败,异常:${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`);
|
||||
return true;
|
||||
|
@ -143,7 +143,7 @@ export default class miHoYoApi {
|
||||
},
|
||||
bbsGetCaptcha: {
|
||||
url: `${mys.bbs_api}/misc/api/createVerification`,
|
||||
query: `is_high=true`,
|
||||
query: `is_high=false`,
|
||||
types: 'bbs'
|
||||
},
|
||||
bbsValidate: {
|
||||
@ -151,7 +151,8 @@ export default class miHoYoApi {
|
||||
query: `gt=${data.gt}&challenge=${data.challenge}&lang=zh-cn&pt=3&client_type=web_mobile`,
|
||||
},
|
||||
bbsCaptchaVerify: {
|
||||
url: `${mys.bbs_api}/misc/api/verifyVerification`
|
||||
url: `${mys.bbs_api}/misc/api/verifyVerification`,
|
||||
types:'bbs'
|
||||
},
|
||||
bbsCaptchaVerify: {
|
||||
url: `https://api.geetest.com/gettype.php`,
|
||||
@ -196,8 +197,8 @@ export default class miHoYoApi {
|
||||
types: 'stoken'
|
||||
},
|
||||
validate: {
|
||||
url: `https://api.geetest.com/ajax.php`,
|
||||
query: `gt=${data?.gt}&challenge=${data?.challenge}&lang=zh-cn&pt=3&client_type=web_mobile`
|
||||
url: ``,
|
||||
query: ``
|
||||
},
|
||||
cloudLogin: {
|
||||
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
|
||||
@ -230,6 +231,10 @@ export default class miHoYoApi {
|
||||
},
|
||||
types: 'authKey'
|
||||
},
|
||||
getLtoken: {
|
||||
url: `${mys.pass_api}/account/auth/api/getLTokenBySToken`,
|
||||
query: `${data.cookies}`,
|
||||
},
|
||||
}
|
||||
if (!urlMap[type]) return false
|
||||
let {
|
||||
|
@ -4,6 +4,7 @@ const salt = "PVeGWIZACpxXZ1ibMVJPi9inCY4Nd4y2";
|
||||
const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v";
|
||||
const saltWeb = "yUZ3s0Sna1IrSNfk29Vo6vRapdOyqyhB";
|
||||
const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
||||
const passSalt='JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS';
|
||||
const osSalt= ''; //599uqkwc0dlqu3h6epzjzfhgyyrd44ae rk4xg2hakoi26nljpr099fv9fck1ah10
|
||||
const osSaltWeb = ''; //os 浏览帖子需要用到的salt
|
||||
const web_api = `https://api-takumi.mihoyo.com`
|
||||
@ -12,6 +13,7 @@ const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`;
|
||||
const hk4_api = `https://hk4e-api.mihoyo.com`;
|
||||
const bbs_api = `https://bbs-api.mihoyo.com`;
|
||||
const cloud_api = `https://api-cloudgame.mihoyo.com`
|
||||
const pass_api=`https://passport-api.mihoyo.com`
|
||||
const boards = {
|
||||
honkai3rd: {
|
||||
forumid: 1,
|
||||
@ -218,5 +220,6 @@ export default {
|
||||
os_hk4_api,
|
||||
hk4_api,
|
||||
bbs_api,
|
||||
pass_api,
|
||||
boards
|
||||
}
|
||||
|
@ -272,6 +272,11 @@ export default class user {
|
||||
let sumcount = 0;
|
||||
message += `\n**${forum.name}**\n`
|
||||
res = await this.getData("bbsSign", forum, false)
|
||||
if (res?.retcode == -100) {
|
||||
return {
|
||||
message: '登录失效'
|
||||
}
|
||||
}
|
||||
if (res?.retcode == 1034) {
|
||||
message += `社区签到: 验证码失败\n`;
|
||||
challenge = await this.bbsGeetest()
|
||||
@ -279,13 +284,19 @@ export default class user {
|
||||
forum["headers"] = {
|
||||
"x-rpc-challenge": challenge
|
||||
}
|
||||
await this.getData("bbsSign", forum, false)
|
||||
res = await this.getData("bbsSign", forum, false)
|
||||
if (res?.retcode == 1034) {
|
||||
message += `社区签到: 验证码失败\n`;
|
||||
} else {
|
||||
message += `社区签到: 验证码成功\n`;
|
||||
}
|
||||
} else {
|
||||
message += `社区签到: 验证码失败\n`;
|
||||
}
|
||||
} else {
|
||||
message += `社区签到: ${res.message}\n`;
|
||||
}
|
||||
Bot.logger.mark(`${this.e.user_id}:${this.e.uid}:${forum.name} 社区签到结果: [${res.message}]`);
|
||||
await utils.randomSleepAsync();
|
||||
res = await this.getData("bbsPostList", forum, false)
|
||||
sumcount++;
|
||||
let postList = res.data.list;
|
||||
@ -311,7 +322,6 @@ export default class user {
|
||||
await this.getData("bbsPostFull", data, false)
|
||||
}
|
||||
}
|
||||
await utils.randomSleepAsync(10);
|
||||
res = await this.getData("bbsVotePost", {
|
||||
postId
|
||||
}, false)
|
||||
@ -601,6 +611,7 @@ export default class user {
|
||||
async bbsGeetest() {
|
||||
let res = await this.getData('bbsGetCaptcha', false)
|
||||
let challenge = res.data["challenge"]
|
||||
await this.getData("geeType", res.data, false)
|
||||
res = await this.getData("bbsValidate", res.data, false)
|
||||
if (res?.data?.validate) {
|
||||
let validate = res?.data?.validate
|
||||
@ -739,16 +750,25 @@ export default class user {
|
||||
}
|
||||
}
|
||||
async seachUid(data) {
|
||||
let ltoken = ''
|
||||
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
|
||||
// }
|
||||
this.e.cookie =
|
||||
`ltoken=${this.e.sk.get('ltoken')};ltuid=${this.e.sk.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk.get('stuid')};`
|
||||
`ltoken=${this.e.sk?.get('ltoken')||ltoken};ltuid=196576671;cookie_token=${data.data.cookie_token}; account_id=196576671;`
|
||||
// if(this.e.sk?.get('mid')){
|
||||
// this.e.cookie =
|
||||
// `ltoken_v2=${this.e.sk?.get('ltoken')||ltoken};cookie_token_v2=${data.data.cookie_token}; account_mid_v2=${this.e.sk.get('mid')};ltmid_v2=${this.e.sk.get('mid')}`
|
||||
// }
|
||||
} else {
|
||||
this.e.cookie = this.e.original_msg
|
||||
}
|
||||
res = await this.getData("userGameInfo", this.ForumData[1], false)
|
||||
let uids=[]
|
||||
let uids = []
|
||||
for (let s of res.data.list) {
|
||||
let datalist = {}
|
||||
let uid = s.game_uid
|
||||
@ -756,7 +776,8 @@ export default class user {
|
||||
datalist[uid] = {
|
||||
stuid: this.e?.sk?.get('stuid') || this.e.stuid,
|
||||
stoken: this.e?.sk?.get('stoken') || data?.data?.list[0].token,
|
||||
ltoken: this.e?.sk?.get('ltoken') || data?.data?.list[1].token,
|
||||
ltoken: this.e?.sk?.get('ltoken') || ltoken || data?.data?.list[1].token,
|
||||
mid: this.e?.sk?.get('mid'),
|
||||
uid: uid,
|
||||
userId: this.e.user_id,
|
||||
is_sign: true
|
||||
|
Loading…
Reference in New Issue
Block a user