【已失效】CoCo 作品分享审核绕过

【已失效】绕过 CoCo 作品分享的审核机制,让他人可以看到你分享的作品,仅支持不可见控件,请低调使用

目前為 2024-02-22 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         【已失效】CoCo 作品分享审核绕过
// @namespace    https://slightning.rechen.xyz/
// @version      0.1.0
// @description  【已失效】绕过 CoCo 作品分享的审核机制,让他人可以看到你分享的作品,仅支持不可见控件,请低调使用
// @author       SLIGHTNING
// @match        http://coco.codemao.cn/editor/*
// @match        https://coco.codemao.cn/editor/*
// @icon         https://coco.codemao.cn/favicon.ico
// @grant        none
// @license      GPL
// ==/UserScript==

(function() {
    'use strict';
    var originalSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function(data) {
        if (data instanceof FormData) {
            var fileName = data.get("fname"),
                originalFile = data.get("file")
            if (fileName == "test.json") {
                var xhr = this,
                    xhrArguments = arguments
                var reader = new FileReader()
                reader.readAsText(originalFile)
                reader.onload = function() {
                    var fileContent = JSON.parse(this.result)
                    fileContent.unsafeExtensionWidgetList.forEach(function(unsafeExtension) {
                        var safeExtension = {
                            id: Math.floor(Math.random() * 1000),
                            type: unsafeExtension.type.substring(7),
                            cdnUrl: `data:text/plain;charset=UTF-8,${encodeURIComponent(unsafeExtension.code)}//`
                        }
                        fileContent.blockCode = fileContent.blockCode.replaceAll(`"${unsafeExtension.type}"`, `"${safeExtension.type}"`)
                        fileContent.extensionWidgetList.push(safeExtension)
                    })
                    fileContent.unsafeExtensionWidgetList = []
                    Object.keys(fileContent.widgetMap).forEach(function(key) {
                        if (key.startsWith("UNSAFE_")) {
                            var widget = fileContent.widgetMap[key]
                            delete fileContent.widgetMap[key]
                            var id = key.substring(7)
                            fileContent.widgetMap[id] = widget
                            fileContent.blockCode = fileContent.blockCode.replaceAll(`"${key}"`, `"${id}"`)
                            widget.id = id
                            widget.type = widget.type.substring(7)
                        }
                    })
                    delete fileContent.blockJsonMap
                    console.log(fileContent)
                    var blob = new Blob([JSON.stringify(fileContent)], { type: "text/plain" })
                    var file = new File([blob], originalFile.name, { type: originalFile.type })
                    data.set("file", file)
                    originalSend.apply(xhr, xhrArguments)
                }
            } else {
                originalSend.apply(this, arguments)
            }
        } else {
            originalSend.apply(this, arguments)
        }
    }
})();