Update colorful.js

This commit is contained in:
smallfawn 2026-04-06 19:31:58 +08:00
parent 9c3cffc18d
commit 18aeacb80b

View File

@ -3,7 +3,7 @@
@Author: sm
@Date: 2024.06.07 19:15
@Description: 七彩虹微信小程序 签到&点赞
cron: 30 8 * * *
cron: 30 10 * * *
------------------------------------------
#Notice:
变量名colorful
@ -22,7 +22,7 @@ https://interface.skycolorful.com/api 请求头的authorization去掉Bearer
7所有直接或间接使用查看此脚本的人均应该仔细阅读此声明本人保留随时更改或补充此声明的权利一旦您使用或复制了此脚本即视为您已接受此免责声明
*/
const { Env } = require("../tools/env")
const { Env } = require("./tools/env")
const $ = new Env("colorful七彩虹");
let ckName = `colorful`;
const strSplitor = "#";
@ -31,112 +31,181 @@ const defaultUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X)
class Task {
constructor(env) {
this.index = $.userIdx++
this.user = env.split(strSplitor);
this.token = this.user[0];
this.signStatus = false;
}
constructor(env) {
this.index = $.userIdx++
this.user = env.split(strSplitor);
this.token = this.user[0];
this.signStatus = false;
this.expireFlag = false;
}
async run() {
await this.getUserInfo()
await this.getSignInfo()
if (this.signStatus) {
$.log(`账号[${this.index}]已签到`)
return
}
await this.signIn()
}
MD5(str) {
const crypto = require('crypto');
return crypto.createHash('md5').update(str).digest('hex');
}
async request(options) {
let appid = "815d8026-9a52-4445-a42c-a5443134232e"
let uuid = $.uuid()
let timestamp = Date.now()
let sign = this.MD5(appid + timestamp + uuid + '2b5c01fb-7640-401a-8188-43a13190a626')
let baseHeaders = {
"User-Agent": defaultUserAgent,
"requestid": uuid,
"appid": appid,
"ticks": "" + timestamp,
"sign": sign,
"authorization": "Bearer " + this.token,
"source": "Wx",
"ucsource": "30",
"user-from": "xcx",
async run() {
await this.getTokenExpireTime()
await this.getUserInfo()
await this.getSignInfo()
if (this.signStatus) {
$.log(`账号[${this.index}]已签到`)
return
}
await this.signIn()
}
async getTokenExpireTime() {
let options = {
method: 'POST',
url: `https://interface.skycolorful.com/api/User/RefreshLoginTime`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
},
data: { "phone": "" }
}
let { data: result } = await this.request(options);
if (result.Code != 0) {
this.expireFlag = true
}
}
async refreshToken(DATA) {
let options = {
method: 'POST',
url: `https://interface.skycolorful.com/api/User/DecryptPhoneNumber`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
},
data: DATA
}
let { data: result } = await this.request(options);
if (result.Code != 0) {
this.expireFlag = true
} else {
this.token = result.Data.Token
}
}
MD5(str) {
const crypto = require('crypto');
return crypto.createHash('md5').update(str).digest('hex');
}
async request(options) {
let appid = "815d8026-9a52-4445-a42c-a5443134232e"
let uuid = $.uuid()
let timestamp = Date.now()
let sign = this.MD5(appid + timestamp + uuid + '2b5c01fb-7640-401a-8188-43a13190a626')
let baseHeaders = {
"User-Agent": defaultUserAgent,
"requestid": uuid,
"appid": appid,
"ticks": "" + timestamp,
"sign": sign,
"authorization": "Bearer " + this.token,
"source": "Wx",
"ucsource": "30",
"user-from": "xcx",
}
options.headers = Object.assign(baseHeaders, options.headers)
return await axios.request(options)
}
async signIn() {
let options = {
method: 'POST',
url: `https://interface.skycolorful.com/api/User/SignV2`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"xweb_xhr": "1"
},
data: {
}
options.headers = Object.assign(baseHeaders, options.headers)
return await axios.request(options)
}
async signIn() {
let options = {
method: 'POST',
url: `https://interface.skycolorful.com/api/User/Sign`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"xweb_xhr": "1"
},
data: {
}
};
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
$.log(`🌸账号[${this.index}]` + `🕊签到${result.Message}🎉`);
} else {
$.log(`🌸账号[${this.index}] 签到-失败:${result.Message}`)
}
}
};
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
$.log(`🌸账号[${this.index}]` + `🕊签到${result.Message}🎉`);
} else {
$.log(`🌸账号[${this.index}] 签到-失败:${result.Message}`)
}
}
async getSignInfo() {
let options = {
method: 'GET',
url: `https://interface.skycolorful.com/api/User/IsSignV2`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
}
}
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
this.signStatus = result.Data.IsSign
} else {
}
}
async getUserInfo() {
let options = {
method: 'GET',
url: `https://interface.skycolorful.com/api/User/GetUserInfo`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
}
}
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
$.log(`🌸账号[${this.index}]` + `昵称:${result.Data.NickName}` + `积分:${result.Data.Point}`)
}
}
}
async signInV2() {
let options = {
method: 'POST',
url: `https://interface.skycolorful.com/api/User/SignV2`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"xweb_xhr": "1"
},
data: {
}
};
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
$.log(`🌸账号[${this.index}]` + `🕊签到${result.Message}🎉`);
} else {
$.log(`🌸账号[${this.index}] 签到-失败:${result.Message}`)
}
}
async getSignInfo() {
let options = {
method: 'GET',
url: `https://interface.skycolorful.com/api/User/IsSignV2`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
}
}
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
this.signStatus = result.Data.IsSign
} else {
}
}
async getUserInfo() {
let options = {
method: 'GET',
url: `https://interface.skycolorful.com/api/User/GetUserInfo`,
headers: {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
}
}
let { data: result } = await this.request(options);
if (result?.Code == '0') {
//打印签到结果
$.log(`🌸账号[${this.index}]` + `昵称:${result.Data.NickName}` + `积分:${result.Data.Point}`)
}
}
}
@ -148,24 +217,24 @@ class Task {
!(async () => {
await getNotice()
$.checkEnv(ckName);
await getNotice()
$.checkEnv(ckName);
for (let user of $.userList) {
await new Task(user).run();
}
for (let user of $.userList) {
await new Task(user).run();
}
})()
.catch((e) => console.log(e))
.finally(() => $.done());
.catch((e) => console.log(e))
.finally(() => $.done());
async function getNotice() {
let options = {
url: `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`,
headers: {
"User-Agent": defaultUserAgent,
}
}
let { data: res } = await axios.request(options);
$.log(res)
return res
let options = {
url: `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`,
headers: {
"User-Agent": defaultUserAgent,
}
}
let { data: res } = await axios.request(options);
$.log(res)
return res
}