NitterCorpusStorage

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

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greatest.deepsurf.us/scripts/579922/1835585/NitterCorpusStorage.js

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

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.

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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