NitterCorpusStorage

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

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greatest.deepsurf.us/scripts/579922/1835585/NitterCorpusStorage.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);