mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
修改米游币签到输出日志,更新salt到2.37.1
This commit is contained in:
parent
8263b87a30
commit
aadcf2c9a2
21
apps/sign.js
21
apps/sign.js
@ -168,6 +168,10 @@ export async function mysSign(e) {
|
|||||||
}
|
}
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
}
|
}
|
||||||
|
let trueDetail=0;
|
||||||
|
let Vote=0;
|
||||||
|
let Share=0;
|
||||||
|
let sumcount=0;
|
||||||
for (let forum of ForumData) {
|
for (let forum of ForumData) {
|
||||||
resultMessage += `\n**${forum.name}**\n`
|
resultMessage += `\n**${forum.name}**\n`
|
||||||
try {
|
try {
|
||||||
@ -179,8 +183,8 @@ export async function mysSign(e) {
|
|||||||
return retry(e);
|
return retry(e);
|
||||||
});
|
});
|
||||||
}, RETRY_OPTIONS);
|
}, RETRY_OPTIONS);
|
||||||
Bot.logger.info(`${forum.name} 读取列表成功 [${resObj.message}],读取到 [${resObj.data.list.length}] 条记录`);
|
sumcount++;
|
||||||
|
// Bot.logger.info(`${forum.name} 读取列表成功 [${resObj.message}],读取到 [${resObj.data.list.length}] 条记录`);
|
||||||
let postList = resObj.data.list;
|
let postList = resObj.data.list;
|
||||||
for (let post of postList) {
|
for (let post of postList) {
|
||||||
post = post.post;
|
post = post.post;
|
||||||
@ -192,6 +196,9 @@ export async function mysSign(e) {
|
|||||||
return retry(e);
|
return retry(e);
|
||||||
});
|
});
|
||||||
}, RETRY_OPTIONS);
|
}, RETRY_OPTIONS);
|
||||||
|
if(resObj?.message){
|
||||||
|
trueDetail++;
|
||||||
|
}
|
||||||
// Bot.logger.info(`${forum.name} [${post.subject}] 读取成功 [${resObj.message}]`);
|
// Bot.logger.info(`${forum.name} [${post.subject}] 读取成功 [${resObj.message}]`);
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
// 2.2 BBS vote post
|
// 2.2 BBS vote post
|
||||||
@ -202,10 +209,12 @@ export async function mysSign(e) {
|
|||||||
return retry(e);
|
return retry(e);
|
||||||
});
|
});
|
||||||
}, RETRY_OPTIONS);
|
}, RETRY_OPTIONS);
|
||||||
|
if(resObj?.message){
|
||||||
|
Vote++;
|
||||||
|
}
|
||||||
// Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
|
// Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.3 BBS share post
|
// 2.3 BBS share post
|
||||||
let sharePost = postList[0].post;
|
let sharePost = postList[0].post;
|
||||||
resObj = await promiseRetry((retry, number) => {
|
resObj = await promiseRetry((retry, number) => {
|
||||||
@ -215,13 +224,17 @@ export async function mysSign(e) {
|
|||||||
return retry(e);
|
return retry(e);
|
||||||
});
|
});
|
||||||
}, RETRY_OPTIONS);
|
}, RETRY_OPTIONS);
|
||||||
|
if(resObj?.message){
|
||||||
|
Share++;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Bot.logger.error(`${forum.name} 读帖点赞分享失败 [${e.message}]`);
|
Bot.logger.error(`${forum.name} 读帖点赞分享失败 [${e.message}]`);
|
||||||
resultMessage += `读帖点赞分享: 失败 [${e.message}]\n`;
|
resultMessage += `读帖点赞分享: 失败 [${e.message}]\n`;
|
||||||
}
|
}
|
||||||
resultMessage += `读帖点赞分享: 成功\n`;
|
resultMessage += `共读取帖子记录${20*sumcount}\n浏览成功:${trueDetail}\n点赞成功:${Vote}\n分享成功:${Share}`;
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
}
|
}
|
||||||
|
Bot.logger.mark(`用户qq${e.user_id}${resultMessage}`);
|
||||||
await replyMsg(e, resultMessage);
|
await replyMsg(e, resultMessage);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -13,19 +13,21 @@ import {
|
|||||||
} from '../../components/Changelog.js';
|
} from '../../components/Changelog.js';
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
|
|
||||||
const APP_VERSION = "2.36.1";
|
const APP_VERSION = "2.37.1";
|
||||||
const mhyVersion = "2.11.1";
|
const mhyVersion = "2.11.1";
|
||||||
const salt = "n0KjuIrKgLHh08LWSCYP0WXlVXaYvV64";
|
const salt = "6J1hde1Wu02eF1DFlLpMjeg2dMloAytL";
|
||||||
const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v";
|
const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v";
|
||||||
const saltWeb = "YVEIkzDFNHLeKXLxzqCA9TzxCpWwbIbk";
|
const saltWeb = "Qqx8cyv7kuyD8fTw11SmvXSFHp7iZD29";
|
||||||
const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
||||||
|
|
||||||
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
||||||
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
let YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
const YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
||||||
let web_api = `https://api-takumi.mihoyo.com`
|
const web_api = `https://api-takumi.mihoyo.com`
|
||||||
let hk4_api = `https://hk4e-api.mihoyo.com`;
|
const os_web_api = `https://api-os-takumi.mihoyo.com`
|
||||||
let bbs_api=`https://bbs-api.mihoyo.com`;
|
const hk4_api = `https://hk4e-api.mihoyo.com`;
|
||||||
|
const bbs_api = `https://bbs-api.mihoyo.com`;
|
||||||
// 米游社的版块
|
// 米游社的版块
|
||||||
const boards = {
|
const boards = {
|
||||||
honkai3rd: {
|
honkai3rd: {
|
||||||
@ -216,13 +218,13 @@ export default class MihoYoApi {
|
|||||||
|
|
||||||
async forumPostShare(postId) {
|
async forumPostShare(postId) {
|
||||||
const url =
|
const url =
|
||||||
`${web_api}/apihub/api/getShareConf?entity_id=${postId}&entity_type=1`;
|
`${bbs_api}/apihub/api/getShareConf?entity_id=${postId}&entity_type=1`;
|
||||||
let res = await superagent.get(url).set(this._getHeader()).timeout(10000);
|
let res = await superagent.get(url).set(this._getHeader()).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
return resObj;
|
return resObj;
|
||||||
}
|
}
|
||||||
async forumPostVote(postId) {
|
async forumPostVote(postId) {
|
||||||
const url = `${web_api}/apihub/sapi/upvotePost`;
|
const url = `${bbs_api}/apihub/sapi/upvotePost`;
|
||||||
const upvotePostData = {
|
const upvotePostData = {
|
||||||
"post_id": postId,
|
"post_id": postId,
|
||||||
"is_cancel": false
|
"is_cancel": false
|
||||||
@ -270,13 +272,18 @@ export default class MihoYoApi {
|
|||||||
resObj.log_msg = log_msg
|
resObj.log_msg = log_msg
|
||||||
return resObj
|
return resObj
|
||||||
}
|
}
|
||||||
async updCookie(){
|
async updCookie() {
|
||||||
let url = `${web_api}/auth/api/getCookieAccountInfoBySToken?game_biz=hk4e_cn`;
|
let url = `${web_api}/auth/api/getCookieAccountInfoBySToken?game_biz=hk4e_cn`;
|
||||||
let map=this.getCookieMap(this.cookies)
|
// if(this.e.region.includes("os")){
|
||||||
url+=`&stoken=${map.get("stoken")}&uid=${map.get("stuid")}`;
|
//os接口暂时先不接入
|
||||||
|
// url=`${os_web_api}/binding/api/getUserGameRolesByCookie?game_biz=hk4e_global`;
|
||||||
|
// }
|
||||||
|
// console.log(url)
|
||||||
|
let map = this.getCookieMap(this.cookies)
|
||||||
|
url += `&stoken=${map.get("stoken")}&uid=${map.get("stuid")}`;
|
||||||
let res = await superagent.get(url);
|
let res = await superagent.get(url);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
return resObj;
|
return resObj;
|
||||||
}
|
}
|
||||||
async stoken(cookie, e) {
|
async stoken(cookie, e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
@ -340,7 +347,7 @@ export default class MihoYoApi {
|
|||||||
return {
|
return {
|
||||||
'accept-language': 'zh-CN,zh;q=0.9,ja-JP;q=0.8,ja;q=0.7,en-US;q=0.6,en;q=0.5',
|
'accept-language': 'zh-CN,zh;q=0.9,ja-JP;q=0.8,ja;q=0.7,en-US;q=0.6,en;q=0.5',
|
||||||
'x-rpc-device_id': DEVICE_ID,
|
'x-rpc-device_id': DEVICE_ID,
|
||||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.34.1',
|
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/${APP_VERSION}`,
|
||||||
Referer: board.getReferer(),
|
Referer: board.getReferer(),
|
||||||
Host: 'api-takumi.mihoyo.com',
|
Host: 'api-takumi.mihoyo.com',
|
||||||
'x-rpc-channel': 'appstore',
|
'x-rpc-channel': 'appstore',
|
||||||
@ -485,13 +492,16 @@ export default class MihoYoApi {
|
|||||||
|
|
||||||
// 获取账号信息 通用
|
// 获取账号信息 通用
|
||||||
async getUserInfo(board) {
|
async getUserInfo(board) {
|
||||||
let res = await superagent.get(
|
let url = `${web_api}/binding/api/getUserGameRolesByCookie?game_biz=${board.biz}`
|
||||||
`https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=${board.biz}`)
|
// if(this.e.region.includes("os")){
|
||||||
|
//os接口暂时先不接入
|
||||||
|
// url=`${os_web_api}/binding/api/getUserGameRolesByCookie?game_biz=hk4e_global`;
|
||||||
|
// }
|
||||||
|
let res = await superagent.get(url)
|
||||||
.set(this
|
.set(this
|
||||||
.getpubHeaders(board)).timeout(10000);
|
.getpubHeaders(board)).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
let data = resObj.data
|
let data = resObj.data
|
||||||
// console.log(resObj)
|
|
||||||
if (resObj.retcode != 0) {
|
if (resObj.retcode != 0) {
|
||||||
return resObj
|
return resObj
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ export async function sleepAsync(sleepms) {
|
|||||||
|
|
||||||
|
|
||||||
export async function randomSleepAsync() {
|
export async function randomSleepAsync() {
|
||||||
let sleep = 2 * 1000 + _.random(3 * 1000);
|
let sleep = 3 * 1000 + _.random(5 * 1000);
|
||||||
await sleepAsync(sleep);
|
await sleepAsync(sleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,6 @@ export async function replyMake(e, _msg, lenght) {
|
|||||||
}else {
|
}else {
|
||||||
e.reply(await Bot.makeForwardMsg(msgList));
|
e.reply(await Bot.makeForwardMsg(msgList));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
export async function getCookieMap(cookie) {
|
export async function getCookieMap(cookie) {
|
||||||
let cookiePattern = /^(\S+)=(\S+)$/;
|
let cookiePattern = /^(\S+)=(\S+)$/;
|
||||||
|
Loading…
Reference in New Issue
Block a user