TriX Executor

A Comprehensive Script Executor with a secure verification system, Python support, and modern UI.

目前為 2025-07-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name         TriX Executor
// @namespace    https://github.com/YourUsername/TriX-Executor
// @version      3.2.0
// @description  A Comprehensive Script Executor with a secure verification system, Python support, and modern UI.
// @author       You
// @match        *://territorial.io/*
// @match        *://www.territorial.io/*
// @match        *://*.*.*.*/*
// @icon         https://i.postimg.cc/0NkRZxDm/image.png
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js
// @require      https://gf.qytechs.cn/scripts/541461-trix-core-library/code/TriX%20Core%20Library.js
// @require      https://gf.qytechs.cn/scripts/541462-trix-ui-library/code/TriX%20UI%20Library.js
// @require      https://gf.qytechs.cn/scripts/542296-trix-addons-library/code/TriX%20Addons%20Library.js
// @run-at       document-start
// @license      MIT
// ==/UserScript==

/*
    TriX Executor - Main Loader v2.2.0
    - Added "Remember Me" functionality to the verification system, bypassing it for 24 hours.
*/

(function() {
    'use strict';

    function isTerritorialPage(){if(window.location.hostname.includes('territorial.io'))return!0;try{const e=new URLSearchParams(window.location.search).get('__cpo');if(e&&atob(e).includes('territorial.io'))return!0}catch(e){}return!1}
    if(!isTerritorialPage()){return}

    function waitForElement(e,t){if(document.querySelector(e))return void t();const o=new MutationObserver((c,r)=>{document.querySelector(e)&&(r.disconnect(),t())});o.observe(document.documentElement,{childList:!0,subtree:!0})}

    const VerificationSystem = {
        validUsers: { '795354688': 'Dr. Yes', '000000000': 'Painsel' },
        currentUserID: null,
        
        showModal(content) {
            let modal = document.getElementById('trix-verify-modal');
            if (!modal) {
                GM_addStyle(`@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&family=Fira+Code&display=swap');#trix-verify-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(26,27,38,.9);z-index:2000000;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(5px);font-family:'Poppins',sans-serif}.trix-verify-container{background:#2a2d3d;padding:30px;border-radius:10px;text-align:center;color:#e0e0e0;box-shadow:0 8px 32px rgba(0,0,0,.4);width:400px}.trix-verify-container h3{margin-top:0;color:#00bfff}.trix-captcha-code{background:#1e202b;padding:10px 20px;border-radius:5px;font-family:'Fira Code',monospace;font-size:24px;letter-spacing:10px;margin:20px 0;user-select:none}.trix-verify-input{padding:10px;font-size:16px;width:90%;text-align:center;border-radius:5px;border:1px solid #353952;background:#1e202b;color:#e0e0e0;margin-bottom:20px}.trix-verify-btn{padding:10px 20px;border:none;border-radius:5px;cursor:pointer;background:#00bfff;color:#fff;font-weight:700;transition:background-color .2s}.trix-verify-btn:hover{background-color:#00a0d8}.trix-verify-btn:disabled{background:#414868;cursor:not-allowed}.trix-progress-bar{width:100%;background:#1e202b;border-radius:5px;overflow:hidden;height:20px;margin-top:15px;border:1px solid #16161e}.trix-progress-bar-inner{height:100%;width:0;background:linear-gradient(90deg,#00bfff,#28a745);transition:width .3s ease,background-color .3s ease}.trix-remember-me{display:flex;justify-content:center;align-items:center;gap:8px;font-size:14px;color:var(--trix-text-secondary);margin-bottom:20px;}`);
                modal = document.createElement('div');
                modal.id = 'trix-verify-modal';
                document.body.appendChild(modal);
            }
            modal.innerHTML = `<div class="trix-verify-container">${content}</div>`;
        },

        async run() {
            // --- NEW: Check for remembered session first ---
            const rememberedId = await GM_getValue('trix_verified_user_id', null);
            const rememberedTs = await GM_getValue('trix_verified_timestamp', 0);
            const oneDay = 24 * 60 * 60 * 1000;

            if (rememberedId && (Date.now() - rememberedTs < oneDay) && this.validUsers[rememberedId]) {
                const welcomeName = this.validUsers[rememberedId];
                console.log(`[TriX] Welcome back, ${welcomeName}. Verification skipped.`);
                this.onVerificationSuccess(); // Bypass everything
                return;
            }
            
            // If no valid session, start the normal verification flow
            this.showIdInput();
        },
        
        showIdInput() {
            this.showModal(`
                <h3>TriX Executor Verification</h3>
                <p>Please enter your authorized User ID.</p>
                <input type="text" class="trix-verify-input" id="trix-id-input" placeholder="Enter User ID">
                <div class="trix-remember-me">
                    <input type="checkbox" id="trix-remember-checkbox">
                    <label for="trix-remember-checkbox">Remember me for 24 hours</label>
                </div>
                <button class="trix-verify-btn" id="trix-id-submit">Verify ID</button>
            `);
            const input = document.getElementById('trix-id-input');
            const submit = document.getElementById('trix-id-submit');
            input.focus();
            
            const verifyId = async () => {
                const enteredId = input.value.trim();
                const rememberMe = document.getElementById('trix-remember-checkbox').checked;

                if (this.validUsers[enteredId]) {
                    this.currentUserID = enteredId;

                    // --- NEW: Save session if checked ---
                    if (rememberMe) {
                        await GM_setValue('trix_verified_user_id', enteredId);
                        await GM_setValue('trix_verified_timestamp', Date.now());
                    }

                    this.runCaptcha();
                } else {
                    input.style.border = '1px solid #f7768e';
                    input.value = 'Invalid ID';
                    setTimeout(() => { input.style.border = '1px solid #353952'; input.value = ''; }, 1500);
                }
            };
            submit.addEventListener('click', verifyId);
            input.addEventListener('keydown', e => { if (e.key === 'Enter') verifyId(); });
        },

        // --- The rest of the verification flow is unchanged ---
        async runCaptcha(){const e=this.validUsers[this.currentUserID],t=Math.random().toString(36).substring(2,8).toUpperCase();this.showModal(`<h3>Welcome, ${e}!</h3><p>Please complete the CAPTCHA below.</p><div class="trix-captcha-code">${t}</div><input type="text" class="trix-verify-input" id="trix-captcha-input" maxlength="6" autocomplete="off"><button class="trix-verify-btn" id="trix-captcha-submit">Continue</button>`);const i=document.getElementById("trix-captcha-input"),s=document.getElementById("trix-captcha-submit");i.focus();const o=()=>{i.value.toUpperCase()===t?this.runLoader():i.style.border="1px solid #f7768e"};s.addEventListener("click",o),i.addEventListener("keydown",e=>{"Enter"===e.key&&o()})},
        runLoader(){this.showModal(`<h3>Preparing TriX Environment</h3><p id="trix-loader-status" style="height:20px; transition: color .3s;">Initializing...</p><div class="trix-progress-bar"><div id="trix-progress-bar-inner"></div></div><button class="trix-verify-btn" id="trix-loader-skip" style="margin-top:20px; background-color:#8c8c8c;">Skip Pre-load</button>`);const e=document.getElementById("trix-loader-status"),t=document.getElementById("trix-progress-bar-inner"),i=document.getElementById("trix-loader-skip");let s=!1;i.onclick=()=>{s||(s=!0,TriX_Core.PyodideManager.isSkipped=!0,this.onVerificationSuccess())};const o=TriX_Core.PyodideManager.init(!0,i=>{e.textContent=i.what,i.total&&(t.style.width=`${i.loaded/i.total*100}%`)});o.then(()=>{s||(e.textContent="Finalizing...",t.style.width="100%",setTimeout(()=>this.onVerificationSuccess(),500))}).catch(t=>{s||(e.textContent="Python failed to load. You can continue without it.",e.style.color="#f7768e",i.textContent="Continue without Python")})},
        onVerificationSuccess(){document.getElementById("trix-verify-modal")?.remove();const e=document.querySelector("#input0").value.trim()||"Guest_temp";console.log(`[TriX] Verification successful. Initializing core for user: ${e}`),TriX_Core.TabManager.init(e)}
    };
    
    console.log('[TriX Loader] Page verified. Starting verification system...');
    waitForElement("#input0", () => VerificationSystem.run());
    
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址