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

修正米社米币签到

This commit is contained in:
Ctrlcv 2022-08-05 11:12:35 +08:00 committed by leiyilu
parent f3a10a3122
commit 6b8082c3c5
3 changed files with 10 additions and 7 deletions

View File

@ -166,7 +166,7 @@ export async function mysSign(e) {
return retry(e); return retry(e);
}); });
}, RETRY_OPTIONS); }, RETRY_OPTIONS);
Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`); // Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
await utils.randomSleepAsync(); await utils.randomSleepAsync();
} }

View File

@ -12,7 +12,9 @@ import {
isV3 isV3
} from '../../components/Changelog.js'; } from '../../components/Changelog.js';
import fetch from "node-fetch" import fetch from "node-fetch"
const APP_VERSION = "2.2.0"; const APP_VERSION = "2.34.1";
const salt="z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
//b253c83ab2609b1b600eddfe974df47b
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();
@ -135,7 +137,7 @@ export default class MihoYoApi {
const url = `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${forumId}`; const url = `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${forumId}`;
let res = await superagent.post(url).set(this._getHeader()).timeout(10000); let res = await superagent.post(url).set(this._getHeader()).timeout(10000);
let resObj = JSON.parse(res.text); let resObj = JSON.parse(res.text);
Bot.logger.mark(`ForumSign: ${res.text}`); // Bot.logger.mark(`ForumSign: ${res.text}`);
return resObj; return resObj;
} }
@ -229,8 +231,8 @@ export default class MihoYoApi {
for (let item of list) { for (let item of list) {
let reward_id = item.id; let reward_id = item.id;
let reward_msg = item.msg; let reward_msg = item.msg;
url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification`; url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification?id=${reward_id}`;
res = await superagent.post(url).set(this.getyunHeader()).send({"id": reward_id}).timeout(10000); res = await superagent.post(url).set(this.getyunHeader()).timeout(10000);
let log_msg=`\n领取奖励,ID:${reward_id},Msg:${reward_msg}`; let log_msg=`\n领取奖励,ID:${reward_id},Msg:${reward_msg}`;
Bot.logger.info(log_msg) Bot.logger.info(log_msg)
sendMSg+=log_msg sendMSg+=log_msg
@ -329,7 +331,7 @@ export default class MihoYoApi {
_getHeader() { _getHeader() {
const randomStr = utils.randomString(6); const randomStr = utils.randomString(6);
const timestamp = Math.floor(Date.now() / 1000) const timestamp = Math.floor(Date.now() / 1000)
let sign = md5(`salt=b253c83ab2609b1b600eddfe974df47b&t=${timestamp}&r=${randomStr}`); let sign = md5(`salt=${salt}&t=${timestamp}&r=${randomStr}`);
return { return {
'Cookie': this.cookies, 'Cookie': this.cookies,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -340,7 +342,7 @@ export default class MihoYoApi {
'x-rpc-app_version': APP_VERSION, 'x-rpc-app_version': APP_VERSION,
'x-rpc-device_model': 'iPhone11,8', 'x-rpc-device_model': 'iPhone11,8',
'x-rpc-device_name': DEVICE_NAME, 'x-rpc-device_name': DEVICE_NAME,
'x-rpc-client_type': '1', // 1 - iOS, 2 - Android, 4 - Web 'x-rpc-client_type': '2', // 1 - iOS, 2 - Android, 4 - Web
'DS': `${timestamp},${randomStr},${sign}` 'DS': `${timestamp},${randomStr},${sign}`
// 'DS': `1602569298,k0xfEh,07f4545f5d88eac59cb1257aef74a570` // 'DS': `1602569298,k0xfEh,07f4545f5d88eac59cb1257aef74a570`
} }

View File

@ -18,6 +18,7 @@ export function randomString(length){
let randomStr = ''; let randomStr = '';
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
randomStr += _.sample('abcdefghijklmnopqrstuvwxyz0123456789'); randomStr += _.sample('abcdefghijklmnopqrstuvwxyz0123456789');
// randomStr += _.sample('dWCcD2FsOUXEstC5f9xubswZxEeoBOTc');
} }
return randomStr; return randomStr;
} }