// ==UserScript== // @name XLM Cloud 每日自动签到 // @namespace https://bbs.tampermonkey.net.cn/ // @version 1.0.4 // @description XLM Cloud自动签到 - 定时后台版 // @author Gemini // @match https://v2.ixlmo.com/* // @match https://docs.scriptcat.org/dev/background.html#promise // @connect v2.ixlmo.com // @icon https://v2.ixlmo.com/assets/images/logo-dark.png // @grant GM_xmlhttpRequest // @grant GM_notification // @grant GM_log // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @crontab 0 11 * * * // 备用🔗 一元机场.cn 稳定机场.com // ==/UserScript== return new Promise((resolve, reject) => { GM_registerMenuCommand("⚙️ 设置账号(Email)", () => { const email = prompt("请输入你的登录邮箱:", GM_getValue("email", "")); if (email) { GM_setValue("email", email); GM_notification({ title: "XLM配置", text: "邮箱已保存" }); } }); GM_registerMenuCommand("🔑 设置密码", () => { const pwd = prompt("请输入你的登录密码:", ""); if (pwd) { GM_setValue("password", pwd); GM_notification({ title: "XLM配置", text: "密码已保存" }); } }); GM_registerMenuCommand("▶️ 手动执行一次签到", () => { runCheckinProcess(); }); function runCheckinProcess() { const email = GM_getValue("email"); const password = GM_getValue("password"); if (!email || !password) { GM_notification({ title: "❌ 签到停止", text: "未配置账号或密码,请先在脚本菜单中配置。" }); reject("未配置账号密码"); return; } GM_log("开始执行 XLM Cloud 签到流程..."); GM_xmlhttpRequest({ method: "POST", url: "https://v2.ixlmo.net/api/v1/passport/auth/login", headers: { "Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" }, data: JSON.stringify({ email: email, password: password, captchaData: "" }), onload: (xhr) => { if (xhr.status !== 200) { GM_log(`登录请求失败: ${xhr.status}`); reject(`登录请求网络异常: ${xhr.status}`); return; } try { const res = JSON.parse(xhr.responseText); if (res.data && res.data.auth_data) { GM_log("登录成功,准备签到..."); doDailySign(res.data.auth_data); } else { const errorMsg = res.message || "未知错误"; GM_log(`登录失败: ${errorMsg}`); GM_notification({ title: "❌ XLM 登录失败", text: `${errorMsg}` }); reject(`登录失败: ${errorMsg}`); } } catch (e) { GM_log("JSON解析失败"); reject("JSON解析失败"); } }, onerror: (err) => { GM_log("网络请求错误"); reject("网络请求错误"); } }); } function doDailySign(token) { GM_xmlhttpRequest({ method: "GET", url: "https://v2.ixlmo.net/api/v1/user/DailySign", headers: { "Authorization": token, "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" }, onload: (xhr) => { try { const res = JSON.parse(xhr.responseText); const msg = res.message || "签到操作完成"; GM_log(`签到结果: ${msg}`); GM_notification({ title: "✅ XLM 签到成功", text: msg, timeout: 5000 }); resolve(msg); } catch (e) { GM_log("签到响应解析失败"); resolve("签到请求已发送,但解析响应失败"); } }, onerror: (err) => { GM_log("签到请求网络错误"); reject("签到请求网络错误"); } }); } runCheckinProcess(); });