"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// ../../core/quark/api.ts function createApi(http) { let driveUrl = "https://drive-m.quark.cn/1/clouddrive/capacity/growth"; return { getInfo(query) { return http.get(`${driveUrl}/info?${query}`); }, sign(query) { return http.post(`${driveUrl}/sign?${query}`, { sign_cyclic: !0 }); } }; } // ../../core/quark/index.ts function getQuery($) { return `__t=${Date.now()}&sign_cyclic=true&fr=android&kps=${$.query.kps}&sign=${$.query.sign}&vcode=${$.query.vcode}&pr=ucpro&uc_param_str=`; } async function getInfo($) { try { let { data, code, status, message } = await $.api.getInfo(getQuery($)); if (code !== 0) { $.logger.fail("获取用户信息失败", code, status, message); return; } return data.cap_sign; } catch (error) { $.logger.error("获取用户信息异常", error); } } async function signIn($) { try { let { data, code, status, message } = await $.api.sign(getQuery($)); if (code === 0) return data.sign_daily_reward; if (code === 44210) { $.logger.info("今日已签到"); return; } $.logger.fail("签到失败", code, status, message); } catch (error) { $.logger.error("签到异常", error); } } async function run($) { try { let info = await getInfo($); if (!info) { $.logger.fatal("登录失败"); return; } let { sign_progress, sign_rewards, sign_target, sign_daily } = info; if (sign_daily) { $.logger.success( `今日已签到${sign_rewards[sign_progress - 1].name},连签进度${sign_progress}/${sign_target}。` ); return; } let dailyReward = await signIn($); dailyReward && $.logger.success( `签到成功,获得${dailyReward / 1048576}M,连签进度${sign_progress + 1}/${sign_target}。` ); } catch (error) { $.logger.error("运行异常", error); } } // index.ts var _conf = require('@asunajs/conf'); var _http = require('@asunajs/http'); var _push = require('@asunajs/push'); // ../../packages/utils/index.ts function sleep(time) { return new Promise((res) => setTimeout(() => res(time), time)); } async function createLogger(options) { let { createConsola, consola } = await Promise.resolve().then(() => _interopRequireWildcard(require("./dist-WNKMRARM.cjs"))); return consola.options.level = 5, createConsola({ level: 5, reporters: [ { log: ({ type, args, level, date }) => { if (options && options.pushData) { let msg = args.reduce((str, cur) => `${str} ${cur}`, "").substring(1); options.pushData.push({ msg, type, level, date }); } consola[type].apply(consola, args); } } ] }); } async function pushMessage({ pushData, message, sendNotify: sendNotify2, createRequest: createRequest2 }) { if (pushData.length && message) { if (message.onlyError && !pushData.some((el) => el.type === "error")) return; let msg = pushData.filter((el) => el.level < 4).map((m) => `[${m.type} ${m.date.toLocaleTimeString()}]${m.msg}`).join(` `); msg && await sendNotify2( { logger: await createLogger(), http: { fetch: (op) => createRequest2().request(op) } }, message, message.title || "asign 运行推送", msg ); } } // index.ts async function main(query, option) { if (!query) return; let logger = await createLogger({ pushData: option == null ? void 0 : option.pushData }), $ = { api: createApi( _http.createRequest.call(void 0, { headers: { "content-type": "application/json", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0" } }) ), logger, query, sleep }; $.logger.start("-------------"), await run($); } async function run2(inputPath) { let { config } = await _conf.loadConfig.call(void 0, inputPath), logger = await createLogger(), quark = config.quark; if (!quark || !quark.length || !quark[0].sign) return logger.error("未找到配置文件/变量"); let pushData = []; for (let index = 0; index < quark.length; index++) { let c = quark[index]; if (c.sign) try { await main(c, { pushData }); } catch (error) { logger.error(error); } } await pushMessage({ pushData, message: config.message, sendNotify: _push.sendNotify, createRequest: _http.createRequest }); } exports.main = main; exports.run = run2;