2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00

修正账密登录sk问题(#46) 、去除验证码token

This commit is contained in:
ctrlcvs 2023-01-15 19:09:26 +08:00
parent 8c4d57b2f6
commit 57f4ae0835
5 changed files with 41 additions and 34 deletions

View File

@ -37,3 +37,5 @@ noteSetAuth: 2
noteTask: 0 0/10 * * * ? noteTask: 0 0/10 * * * ?
# 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭 # 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭
isNoteTask: false isNoteTask: false
# 验证码接口token
getToken:

View File

@ -81,7 +81,6 @@ export default class mysTopLogin {
Bot.logger.mark("[米哈游登录] 正在验证") Bot.logger.mark("[米哈游登录] 正在验证")
this.aigis_captcha_data = JSON.parse(res.aigis_data.data) this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
let vlData = await this.crack_geetest() let vlData = await this.crack_geetest()
console.log(vlData)
// let validate = await this.user.getData("validate", this.aigis_captcha_data, false) // let validate = await this.user.getData("validate", this.aigis_captcha_data, false)
if (vlData?.geetest_validate) { if (vlData?.geetest_validate) {
Bot.logger.mark("[米哈游登录] 验证成功") Bot.logger.mark("[米哈游登录] 验证成功")
@ -104,12 +103,12 @@ export default class mysTopLogin {
} }
if (res.retcode == 0) { if (res.retcode == 0) {
let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}` let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}`
let cookie_token = this.user.getData("bbsGetCookie", { cookies }) let cookie_token =await this.user.getData("bbsGetCookie", { cookies })
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false) let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies}` }, false)
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`)
return { return {
cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`, cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`,
stoken: `${cookies};stuid=${res.data.user_info.aid};` stoken: `${cookies.replace('&',';')};stuid=${res.data.user_info.aid};`
} }
} else { } else {
await this.e.reply(`错误:${JSON.stringify(res)}`, true) await this.e.reply(`错误:${JSON.stringify(res)}`, true)

View File

@ -209,10 +209,10 @@ export default class miHoYoApi {
query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`, query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`,
types: 'stoken' types: 'stoken'
}, },
//接口来源于外网扒来的 接口目前暂时免费后续看token是否收费祝你生活愉快 //很抱歉由于有人恶意倒卖不得已只能是关闭免费token了 开放免费供人使用还被恶意倒卖指责 开源确实不好弄捏
validate: { validate: {
url: `http://api.fuckmys.tk/geetest`, url: `http://api.fuckmys.tk/geetest`,
query: `token=fuckmys&gt=${data.gt}&challenge=${data.challenge}` query: `token=${data?.getToken}&gt=${data.gt}&challenge=${data.challenge}`
}, },
cloudLogin: { cloudLogin: {
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`, url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
@ -259,7 +259,7 @@ export default class miHoYoApi {
query: `callback=${data.challenge}` query: `callback=${data.challenge}`
}, },
loginByPassword: { loginByPassword: {
url: "https://passport-api.mihoyo.com/account/ma-cn-passport/app/loginByPassword", url: `${mys.pass_api}/account/ma-cn-passport/app/loginByPassword`,
body: { body: {
account: this.encrypt_data(data.account), account: this.encrypt_data(data.account),
password: this.encrypt_data(data.password) password: this.encrypt_data(data.password)
@ -267,14 +267,14 @@ export default class miHoYoApi {
types: 'pass' types: 'pass'
}, },
qrCodeLogin: { qrCodeLogin: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch`, url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/fetch`,
body: { body: {
app_id: mys.app_id, app_id: mys.app_id,
device: data.device device: data.device
} }
}, },
qrCodeQuery: { qrCodeQuery: {
url: `https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query`, url: `${mys.hk4_sdk}/hk4e_cn/combo/panda/qrcode/query`,
body: { body: {
app_id: mys.app_id, app_id: mys.app_id,
device: data.device, device: data.device,
@ -282,7 +282,7 @@ export default class miHoYoApi {
} }
}, },
getTokenByGameToken: { getTokenByGameToken: {
url: `https://passport-api.mihoyo.com/account/ma-cn-session/app/getTokenByGameToken`, url: `${mys.pass_api}/account/ma-cn-session/app/getTokenByGameToken`,
body: { body: {
account_id: data.uid * 1, account_id: data.uid * 1,
game_token: data.token game_token: data.token
@ -290,7 +290,7 @@ export default class miHoYoApi {
types: 'pass' types: 'pass'
}, },
getCookieAccountInfoByGameToken: { getCookieAccountInfoByGameToken: {
url: `https://api-takumi.mihoyo.com/auth/api/getCookieAccountInfoByGameToken`, url: `${mys.web_api}/auth/api/getCookieAccountInfoByGameToken`,
query: `account_id=${data.uid}&game_token=${data.token}` query: `account_id=${data.uid}&game_token=${data.token}`
}, },
GetCode:{ GetCode:{

View File

@ -11,6 +11,7 @@ const web_api = `https://api-takumi.mihoyo.com`
const os_web_api = `https://api-os-takumi.mihoyo.com` const os_web_api = `https://api-os-takumi.mihoyo.com`
const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`; const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`;
const hk4_api = `https://hk4e-api.mihoyo.com`; const hk4_api = `https://hk4e-api.mihoyo.com`;
const hk4_sdk = `https://hk4e-sdk.mihoyo.com`;
const bbs_api = `https://bbs-api.mihoyo.com`; const bbs_api = `https://bbs-api.mihoyo.com`;
const cloud_api = `https://api-cloudgame.mihoyo.com` const cloud_api = `https://api-cloudgame.mihoyo.com`
const pass_api = `https://passport-api.mihoyo.com` const pass_api = `https://passport-api.mihoyo.com`
@ -224,7 +225,7 @@ export default {
web_api, web_api,
os_web_api, os_web_api,
os_hk4_api, app_id, os_hk4_api, app_id,
hk4_api, hk4_api,hk4_sdk,
bbs_api, publicKey, bbs_api, publicKey,
pass_api, passSalt, pass_api, passSalt,
boards boards

View File

@ -30,8 +30,10 @@ export default class user {
this.ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys") this.ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
this.configSign = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config"); this.configSign = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config");
this.configSign.signlist = this.configSign.signlist || "原神|崩坏3|崩坏2|未定事件簿".split("|") this.configSign.signlist = this.configSign.signlist || "原神|崩坏3|崩坏2|未定事件簿".split("|")
this.getToken = this.configSign.getToken || ''
this.getyunToken(this.e) this.getyunToken(this.e)
} }
async getCkData() { async getCkData() {
let sumData = {}; let sumData = {};
let yunres = await this.cloudSeach(); let yunres = await this.cloudSeach();
@ -200,6 +202,7 @@ export default class user {
return this.configSign[type.includes("云") ? "cloudDoc" : "cookiesDoc"] return this.configSign[type.includes("云") ? "cloudDoc" : "cookiesDoc"]
} }
async cloudSign() { async cloudSign() {
await this.cloudSeach()
let res = await this.getData("cloudReward") let res = await this.getData("cloudReward")
if (res?.data?.list?.length == 0 || !res?.data?.list) { if (res?.data?.list?.length == 0 || !res?.data?.list) {
res.message = `您今天的奖励已经领取了~` res.message = `您今天的奖励已经领取了~`
@ -610,7 +613,8 @@ export default class user {
try { try {
let res = await this.getData('bbsGetCaptcha', false) let res = await this.getData('bbsGetCaptcha', false)
// let challenge = res.data["challenge"] // let challenge = res.data["challenge"]
// await this.getData("geeType", res.data, false) //接入别的平台请把这段代码放出来 否则会一直出现提示拼图失效的情况 // await this.getData("geeType", res.data, false)
res.data.getToken=this.getToken
res = await this.getData("validate", res.data, false) res = await this.getData("validate", res.data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
res = await this.getData("bbsCaptchaVerify", res.data, false) res = await this.getData("bbsCaptchaVerify", res.data, false)
@ -625,6 +629,7 @@ export default class user {
} }
async geetest(data) { async geetest(data) {
try { try {
data.getToken=this.getToken
let res = await this.getData("validate", data, false) let res = await this.getData("validate", data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
let validate = res?.data?.validate let validate = res?.data?.validate