// ==UserScript== // @name Get Microsoft Rewards (修复/增强版) // @namespace https://github.com/Muverix/Get-Microsoft-Rewards // @version 1.4.0 // @description 微软 Rewards 页面内助手:本地搜索、活动提交、每日签到、阅读、月度/周度打卡进度查看,全部在页面里一键完成。 // @author Muverix // @license MIT // @icon https://rewards.bing.com/rewardscdn/images/rewards.png // @homepage https://scriptcat.org/zh-CN/script-show-page/7354 // @supportURL https://github.com/Muverix/Get-Microsoft-Rewards/issues // @match https://*.bing.com/* // @match https://*.microsoft.com/* // @match https://login.live.com/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_notification // @grant GM_cookie // @grant GM_registerMenuCommand // @grant GM_openInTab // @grant GM_log // @connect bing.com // @connect rewards.bing.com // @connect www.bing.com // @connect cn.bing.com // @connect login.live.com // @connect prod.rewardsplatform.microsoft.com // @connect hot.baiwumm.com // @connect hotapi.nntool.cc // @connect cnxiaobai.com // @run-at document-end // ==/UserScript== /* ========================================================================= * 📜 版权声明与免责条款 (License & Disclaimer) * ------------------------------------------------------------------------- * 1. 本脚本基于 QingJ 的开源项目《Get Microsoft Rewards》二次开发。 * 2. 借助AI,参考其他相关模块进行优化。 * 3. 本脚本遵循 MIT 开源许可协议,仅供个人学习研究与自动化测试使用。 * 4. 作者不对使用本脚本可能产生的任何风险(如账号积分变动或风控等)承担任何法律责任,请合理使用。 * ========================================================================= */ (function () { 'use strict'; // 版本号统一从脚本管理器元数据 / @version 头部提取,避免多处硬编码不同步 const APP_VERSION = (typeof GM_info !== 'undefined' && GM_info?.script?.version) || (document.currentScript?.textContent?.match(/@version\s+([\w.\-]+)/i) || [])[1] || '0.0.0'; // 但只在下列站点构建面板,其它页面直接返回 const HOST_SUPPORTED = ['rewards.bing.com', 'www.bing.com', 'cn.bing.com', 'rewards.microsoft.com', 'login.live.com']; if (!HOST_SUPPORTED.includes(window.location.hostname)) return; /* ========================================================================= * 登录页「授权码自动捕获」 * ------------------------------------------------------------------------- * 在 login.live.com / login.microsoftonline.com 上不注入 Rewards 面板, * 只负责把跳转后网址里的 code 自动存进脚本存储,并给出提示页。 * 回到 Bing / Rewards 标签页后,tryAutoFillAuthCode() 会自动回填并兑换, * 全程无需复制粘贴。 * ========================================================================= */ if (/^(login\.(live|microsoftonline)\.com|account\.live\.com)$/i.test(location.hostname)) { initOAuthCapturePage(); return; } function initOAuthCapturePage() { const href = location.href; let code = ''; const m = href.match(/[?]code=([^\s"']+)/i); if (m) { try { code = decodeURIComponent(m[1]); } catch (e) { code = m[1]; } } const errM = href.match(/[?]error=([^\s&]+)/i); const errDesc = href.match(/[?]error_description=([^]+)/i); // 普通登录/授权中间页:不弹任何东西,交给微软自己的页面 if (!code && !errM) return; try { if (code) { GM_setValue('auth_code', code); GM_setValue('auth_code_time', String(Date.now())); GM_setValue('auth_pending', ''); console.log('[Rewards] 已自动捕获授权码,长度:', code.length); } } catch (e) { } // 极简提示页(白底深字,亮色浏览器下清晰) const box = document.createElement('div'); box.style.cssText = 'position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(360px,92vw);box-sizing:border-box;background:#fff;color:#222;border:1px solid #e0e0e0;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.15);padding:20px;font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;z-index:2147483647;text-align:center;'; if (code) { box.innerHTML = `