mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2025-01-22 22:11:22 +08:00
对于原神签到加入geetest绕验证码方法以及延迟修正
This commit is contained in:
parent
7118ecf5a1
commit
8b39d7e3ec
@ -191,6 +191,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'
|
||||||
},
|
},
|
||||||
|
validate: {
|
||||||
|
url: `https://api.geetest.com/ajax.php`,
|
||||||
|
query: `gt=${data?.gt}&challenge=${data?.challenge}&lang=zh-cn&pt=3&client_type=web_mobile`
|
||||||
|
},
|
||||||
cloudLogin: {
|
cloudLogin: {
|
||||||
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
|
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,
|
||||||
types: 'cloud'
|
types: 'cloud'
|
||||||
@ -202,7 +206,9 @@ export default class miHoYoApi {
|
|||||||
},
|
},
|
||||||
cloudGamer: {
|
cloudGamer: {
|
||||||
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/ackNotification`,
|
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/ackNotification`,
|
||||||
body: {id:data.reward_id},
|
body: {
|
||||||
|
id: data.reward_id
|
||||||
|
},
|
||||||
types: 'cloud'
|
types: 'cloud'
|
||||||
},
|
},
|
||||||
cloudGet: {
|
cloudGet: {
|
||||||
@ -325,12 +331,11 @@ export default class miHoYoApi {
|
|||||||
}
|
}
|
||||||
if (this.isOs) {
|
if (this.isOs) {
|
||||||
let os_Header = {
|
let os_Header = {
|
||||||
'x-rpc-app_version':'2.9.0',
|
'x-rpc-app_version': '2.18.1',
|
||||||
app_version: '2.9.0',
|
app_version: '2.18.1',
|
||||||
// User_Agent: `Mozilla/5.0 (Linux; Android 9.0; SAMSUNG SM-F900U Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36 miHoYoBBSOversea/2.9.0`,
|
|
||||||
client_type: '2',
|
client_type: '2',
|
||||||
'x-rpc-client_type': '2',
|
'x-rpc-client_type': '2',
|
||||||
Origin: 'https://webstatic-sea.hoyolab.com',
|
Origin: 'https://app.hoyolab.com',
|
||||||
X_Requested_With: 'com.mihoyo.hoyolab',
|
X_Requested_With: 'com.mihoyo.hoyolab',
|
||||||
Referer: 'https://app.hoyolab.com',
|
Referer: 'https://app.hoyolab.com',
|
||||||
Host: 'api-os-takumi.mihoyo.com',
|
Host: 'api-os-takumi.mihoyo.com',
|
||||||
|
@ -16,7 +16,8 @@ export async function randomSleepAsync(end) {
|
|||||||
export function randomString(length, os = false) {
|
export function randomString(length, os = false) {
|
||||||
let randomStr = '';
|
let randomStr = '';
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
randomStr += _.sample(os?'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz':'abcdefghijklmnopqrstuvwxyz0123456789');
|
randomStr += _.sample(os ? '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' :
|
||||||
|
'abcdefghijklmnopqrstuvwxyz0123456789');
|
||||||
}
|
}
|
||||||
return randomStr;
|
return randomStr;
|
||||||
}
|
}
|
||||||
@ -24,10 +25,15 @@ export function randomString(length,os=false) {
|
|||||||
export async function redisGet(userId, type = 'bbs') {
|
export async function redisGet(userId, type = 'bbs') {
|
||||||
await redis.get(`xiaoyao:${type}:${userId}`);
|
await redis.get(`xiaoyao:${type}:${userId}`);
|
||||||
}
|
}
|
||||||
export async function redisSet(userId,type='bbs',data){
|
export async function redisSet(userId="all", type = 'bbs', data, time=0) {
|
||||||
var time = moment(Date.now()).add('days', 1).format('YYYY-MM-DD 00:00:00')
|
var time = moment(Date.now()).add('days', 1).format('YYYY-MM-DD 00:00:00')
|
||||||
var new_date = (new Date(time).getTime() - new Date().getTime()) / 1000 //获取隔天凌晨的时间差
|
var new_date = (new Date(time).getTime() - new Date().getTime()) / 1000 //获取隔天凌晨的时间差
|
||||||
await redis.set(`xiaoyao:${type}:${userId}`,JSON.stringify(data),{EX:parseInt(new_date)});
|
if (time!==0) {
|
||||||
|
new_date = time
|
||||||
|
}
|
||||||
|
await redis.set(`xiaoyao:${type}:${userId}`, JSON.stringify(data), {
|
||||||
|
EX: parseInt(new_date)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 发送私聊消息,仅给好友发送
|
* 发送私聊消息,仅给好友发送
|
||||||
@ -97,10 +103,13 @@ export async function getCookieMap(cookie) {
|
|||||||
return cookieMap || {};
|
return cookieMap || {};
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
sleepAsync,getServer,
|
sleepAsync,
|
||||||
|
getServer,
|
||||||
randomSleepAsync,
|
randomSleepAsync,
|
||||||
replyMake,
|
replyMake,
|
||||||
randomString,redisGet,redisSet,
|
randomString,
|
||||||
|
redisGet,
|
||||||
|
redisSet,
|
||||||
relpyPrivate,
|
relpyPrivate,
|
||||||
getCookieMap
|
getCookieMap
|
||||||
}
|
}
|
||||||
|
@ -110,29 +110,46 @@ export default class user {
|
|||||||
if (res?.data?.is_sign) {
|
if (res?.data?.is_sign) {
|
||||||
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
|
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
|
||||||
} else {
|
} else {
|
||||||
|
for (let i = 0; i < 2; i++) { //循环请求
|
||||||
|
let signTime = await redis.get(`xiaoyao:sign`)
|
||||||
|
if (signTime) {
|
||||||
|
//有数据的时候不得行必须出去
|
||||||
|
if (!mysTask) {
|
||||||
|
message += "${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~";
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
await utils.sleepAsync(60000 * 6) //等6分钟再说
|
||||||
|
//ps:你要是觉得改有加高过的概率就改吧,随便你反正到时候黑IP的不是我
|
||||||
|
}
|
||||||
|
}
|
||||||
res = await this.getData("sign", data)
|
res = await this.getData("sign", data)
|
||||||
if (res?.data?.gt) { //去除geetest
|
await utils.sleepAsync(2000)
|
||||||
// let validate = await geetest(res.data)
|
if (res?.data?.gt) { //进行3次验证码访问签到加高通过概率
|
||||||
// if (validate) {
|
let validate = await this.geetest(res.data)
|
||||||
// let header = {}
|
if (validate) {
|
||||||
// header["x-rpc-challenge"] = res["data"]["challenge"]
|
let header = {}
|
||||||
// header["x-rpc-validate"] = validate
|
header["x-rpc-challenge"] = res["data"]["challenge"]
|
||||||
// header["x-rpc-seccode"] = `${validate}|jordan`
|
header["x-rpc-validate"] = validate
|
||||||
// data.headers = header
|
header["x-rpc-seccode"] = `${validate}|jordan`
|
||||||
// res = await this.getData("sign", data)
|
data.headers = header
|
||||||
// if (!res?.data?.gt) {
|
res = await this.getData("sign", data)
|
||||||
// message += `${item.nickname}-${item.game_uid}:验证码签到成功~`
|
if (!res?.data?.gt) {
|
||||||
// } else {
|
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
item.is_sign = false;
|
item.is_sign = false;
|
||||||
message += `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
message +=
|
||||||
// }
|
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
item.total_sign_day++;
|
item.total_sign_day++;
|
||||||
message +=
|
message +=
|
||||||
`${item.nickname}-${item.game_uid}:${res.message=="OK"?"签到成功":res.message}\n`
|
`${item.nickname}-${item.game_uid}:${res.message=="OK"?"签到成功":res.message}\n`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await utils.sleepAsync(2000)
|
||||||
|
}
|
||||||
//获取签到信息和奖励信息
|
//获取签到信息和奖励信息
|
||||||
const SignInfo = await this.getData("home", data)
|
const SignInfo = await this.getData("home", data)
|
||||||
if (SignInfo) {
|
if (SignInfo) {
|
||||||
@ -344,7 +361,6 @@ export default class user {
|
|||||||
// let ck=`${dir}${qq*1}.yaml`
|
// let ck=`${dir}${qq*1}.yaml`
|
||||||
// let cklis=fs.readFileSync(ck, 'utf-8')
|
// let cklis=fs.readFileSync(ck, 'utf-8')
|
||||||
// cklist=YAML.parse(cklis)
|
// cklist=YAML.parse(cklis)
|
||||||
// console.log(cklist)
|
|
||||||
// }else{
|
// }else{
|
||||||
// cklist=NoteCookie[qq*1]
|
// cklist=NoteCookie[qq*1]
|
||||||
// }
|
// }
|
||||||
@ -539,6 +555,10 @@ export default class user {
|
|||||||
if (res?.data?.validate) {
|
if (res?.data?.validate) {
|
||||||
let validate = res?.data?.validate
|
let validate = res?.data?.validate
|
||||||
return validate
|
return validate
|
||||||
|
} else if (res?.data?.result !== "slide") {
|
||||||
|
await redis.set(`xiaoyao:sign`, 1, { //写入缓存 过不了了
|
||||||
|
EX: 60 * 6 //等6分钟后再给用指令 避免ddos
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -623,10 +643,6 @@ export default class user {
|
|||||||
loginUid,
|
loginUid,
|
||||||
loginTicket
|
loginTicket
|
||||||
})
|
})
|
||||||
// this.getData("bbsStoken", {
|
|
||||||
// loginUid,
|
|
||||||
// loginTicket
|
|
||||||
// })
|
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
datalist[e.uid] = {
|
datalist[e.uid] = {
|
||||||
stuid: map?.get("account_id"),
|
stuid: map?.get("account_id"),
|
||||||
|
Loading…
Reference in New Issue
Block a user