CoCo 作品分享审核绕过

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

当前为 2024-02-22 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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)
        }
    }
})();