// ==UserScript== // @name StreamElements Redemptions Fixer // @description Remove limit from StreamElements redemptions requests // @author Lone Destroyer // @license MIT // @match https://streamelements.com/dashboard/account/redemptions* // @icon https://streamelements.com/favicon.ico // @version 1.0 // @namespace https://github.com/LoneDestroyer // @downloadURL https://raw.githubusercontent.com/LoneDestroyer/StreamElements-Redemptions-Fixer/main/StreamElements-Redemptions-Fixer.user.js // @updateURL https://raw.githubusercontent.com/LoneDestroyer/StreamElements-Redemptions-Fixer/main/StreamElements-Redemptions-Fixer.user.js // @run-at document-start // ==/UserScript== (function() { 'use strict'; const originalFetch = unsafeWindow.fetch; const originalXhrOpen = XMLHttpRequest.prototype.open; function rewriteRedemptionsUrl(rawUrl) { try { const url = new URL(rawUrl, window.location.origin); const isRedemptions = url.hostname === 'api.streamelements.com' && url.pathname.includes('/redemptions/me'); if (!isRedemptions) return rawUrl; url.searchParams.delete('limit'); return url.toString(); } catch (_) { return rawUrl; } } unsafeWindow.fetch = function(...args) { const req = args[0]; const url = typeof req === 'string' ? req : (req && req.url) || ''; const rewrittenUrl = rewriteRedemptionsUrl(url); let fetchArgs = args; if (rewrittenUrl !== url) { if (typeof req === 'string') { fetchArgs = [rewrittenUrl, args[1]]; } else if (req instanceof Request) { fetchArgs = [new Request(rewrittenUrl, req), args[1]]; } } return originalFetch.apply(this, fetchArgs); }; XMLHttpRequest.prototype.open = function(method, url, ...rest) { const rewrittenUrl = rewriteRedemptionsUrl(url); return originalXhrOpen.apply(this, [method, rewrittenUrl, ...rest]); }; })();