NitterCorpusStorage

拾荒小猫无限卡槽控制矩阵 - GM特权跨域网络与沙盒中枢

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/579922/1835585/NitterCorpusStorage.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         NitterCorpusStorage
// @version      1.2.5_Storage
// @description  拾荒小猫无限卡槽控制矩阵 - GM特权跨域网络与沙盒中枢
// @author       Gemini Collaborator
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function(window) {
    'use strict';
    window.NitterCorpusStorage = {
        // 利用 GM_xmlhttpRequest 强行穿透 CORS 跨域防火墙
        async cloudUpdate(url, key, value, action, callback) {
            let dataPayload = `key=${encodeURIComponent(key)}&value=`;
            if (action !== 'delete') {
                dataPayload += encodeURIComponent(value);
            }
            GM_xmlhttpRequest({
                method: 'POST',
                url: action === 'delete' ? `${url}?key=${key}&value=` : url,
                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                data: action === 'delete' ? '' : dataPayload,
                onload: (res) => {
                    try {
                        let json = JSON.parse(res.responseText);
                        callback(null, json);
                    } catch(e) { callback(new Error("回执结构断裂: " + e.message)); }
                },
                onerror: (err) => { callback(new Error("特权流道泵入遭遇阻断,请确认网络状态。")); }
            });
        },

        async remoteFetch(url, callback) {
            GM_xmlhttpRequest({
                method: 'GET',
                url: url,
                onload: (res) => { callback(null, res.responseText); },
                onerror: (err) => { callback(new Error("远端流同步路径死锁")); }
            });
        }
    };
})(window);