MTOPS Unlocked

Removes all paywalls on mtopscriterion.com, allowing the user to learn the MTOPS course content and use the trading system entirely for free

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

You will need to install an extension such as Tampermonkey to install this script.

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         MTOPS Unlocked
// @namespace    https://www.mtopscriterion.com
// @version      1.2
// @license      gpl-3.0
// @description  Removes all paywalls on mtopscriterion.com, allowing the user to learn the MTOPS course content and use the trading system entirely for free
// @author       Luculent
// @match        https://www.mtopscriterion.com/*
// @exclude      https://www.mtopscriterion.com/login
// @icon         https://www.mtopscriterion.com/images/members/header-logo-small.png
// @run-at       document-start
// @grant        unsafeWindow
// ==/UserScript==
// Yes, I know, unsafeWindow is evil but I ain't gonna try to fix this shit, it works.

(function() {
    'use strict';
    'esversion: 6';

    // Keep the original fetch instead of our override
    let original_fetch = unsafeWindow.fetch;

    // Override fetch
    unsafeWindow.fetch = async (url, init) => {

        // Get the response and define some storage variables
        let response = await original_fetch(url, init)
        let respo = response.clone();
        let newResStr;
        let newRes;
        if (url.includes("auth/session")) {
            // Enable the trading system for free by changing account types
            newResStr = await respo.json().then((info) => {
                // console.log(info)
                info["accountType"] = 3  // 0 = trial, 1 = free, 2 = student, 3 = unlimited
                info["access"] = 1  // I don't actually know what this does, I just set it to make sure but you probably don't need it.
                return JSON.stringify(info)
            });
            newRes = new Response(newResStr, {status: response.status, statusText: response.statusText, headers: response.headers})
        }
        if (url.includes("api/graphql")) {
            // Completely open the course
            newResStr = await respo.json().then((info) => {
                for (let i = 0; i < info.data.allCourses.length; i++) {
                    info.data.allCourses[i]["completed"] = true;
                    info.data.allCourses[i]["locked"] = false;
                }

                return JSON.stringify(info);
            });

            // Send the modified graphql response to the client
            newRes = new Response(newResStr, {status: response.status, statusText: response.statusText, headers: response.headers})
        }

        // Check if anything has actually been modified, if not, just return the original response
        if (newRes == undefined) newRes = response;

    return newRes;
    };
})();