diff --git a/LCUdebloater.js b/LCUdebloater.js index 5502e77..a14fd83 100644 --- a/LCUdebloater.js +++ b/LCUdebloater.js @@ -14,7 +14,7 @@ suppressConsoleMethods(); window.onerror = function(message, source, lineno, colno, error) { - return true; + return true; }; window.onunhandledrejection = function(event) { @@ -22,6 +22,23 @@ }; })(); +(function() { + const originalXHROpen = XMLHttpRequest.prototype.open; + + XMLHttpRequest.prototype.open = function(method, url, async, user, password) { + const blockedUrls = [ + '/lol-login/v1/session', + '/lol-league-session/v1/league-session-token' + ]; + + if (method === 'DELETE' && blockedUrls.some(blockedUrl => url.includes(blockedUrl))) { + return; + } + + return originalXHROpen.apply(this, arguments); + }; +})(); + (function blockApis() { const originalXHROpen = XMLHttpRequest.prototype.open; const blockedUrls = [ @@ -81,7 +98,7 @@ return; } - if (url === "/lol-settings/v2/config" || url === "/lol-premade-voice/v1/first-experience" || url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/PickOrderSwappingTooltipEnabled" || url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/ChampTradingTooltipEnabled" ||url === "/lol-settings/v1/account/lol-parties" || url === "/lol-lobby/v1/autofill-displayed" || url === "/lol-perks/v1/show-auto-modified-pages-notification" || url === "/lol-platform-config/v1/namespaces/LeagueConfig/RankedReferenceModalEnabled" || url === "/lol-lobby-team-builder/champ-select/v1/has-auto-assigned-smite" || url === "/lol-platform-config/v1/namespaces/LeagueConfig" || url === "/lol-client-config/v3/client-config/lol.client_settings.sentry_config") { + if (url === "/lol-settings/v2/config" || url === "/lol-premade-voice/v1/first-experience" || url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/PickOrderSwappingTooltipEnabled" || url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/ChampTradingTooltipEnabled" || url === "/lol-settings/v1/account/lol-parties" || url === "/lol-lobby/v1/autofill-displayed" || url === "/lol-perks/v1/show-auto-modified-pages-notification" || url === "/lol-platform-config/v1/namespaces/LeagueConfig/RankedReferenceModalEnabled" || url === "/lol-lobby-team-builder/champ-select/v1/has-auto-assigned-smite" || url === "/lol-platform-config/v1/namespaces/LeagueConfig" || url === "/lol-client-config/v3/client-config/lol.client_settings.sentry_config" || url === "/lol-client-config/v3/client-config/lol.client_settings.datadog_rum_config" || url === "/lol-client-config/v3/client-config/lol.client_settings.client_navigability.info_hub_disabled") { const originalSend = this.send; this.send = function(body) { let originalOnReadyStateChange = this.onreadystatechange; @@ -101,7 +118,7 @@ isTermsEnabled: false, localizedLicensesURL: "" }); - } else if (url === "/lol-lobby/v1/autofill-displayed") { + } else if (url === "/lol-lobby/v1/autofill-displayed" || url === "/lol-client-config/v3/client-config/lol.client_settings.client_navigability.info_hub_disabled") { content = JSON.stringify(true); } else if (url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/PickOrderSwappingTooltipEnabled" || url === "/lol-platform-config/v1/namespaces/LcuChampionSelect/ChampTradingTooltipEnabled" || url === "/lol-perks/v1/show-auto-modified-pages-notification" || url === "/lol-platform-config/v1/namespaces/LeagueConfig/RankedReferenceModalEnabled" || url === "/lol-lobby-team-builder/champ-select/v1/has-auto-assigned-smite") { content = JSON.stringify(false); @@ -123,12 +140,27 @@ showFirstExperienceInGame: false, showFirstExperienceInLCU: false }); - } else if (url === "/lol-client-config/v3/client-config/lol.client_settings.sentry_config") { + } else if (url === "/lol-client-config/v3/client-config/lol.client_settings.sentry_config") { content = JSON.stringify({ dsn: "", - isEnabled: false, + isEnabled: false, sampleRate: 0 }); + } else if (url === "/lol-client-config/v3/client-config/lol.client_settings.datadog_rum_config") { + content = JSON.stringify({ + applicationID: "", + clientToken: "", + isEnabled: false, + service: "", + sessionReplaySampleRate: 0, + sessionSampleRate: 0, + site: "", + telemetrySampleRate: 0, + traceSampleRate: 0, + trackLongTasks: false, + trackResources: false, + trackUserInteractions: false + }); } Object.defineProperty(this, 'responseText', { @@ -187,14 +219,14 @@ childList: true, subtree: true }); - hideElement(); + hideElement(); const greyoutObserver = new MutationObserver(greyout); greyoutObserver.observe(body, { childList: true, subtree: true }); - greyout(); + greyout(); } else { console.error('Document body is not available.'); } @@ -207,25 +239,28 @@ const firstGeneralRow = document.querySelector('.lol-settings-general-row, .lol-settings-notifications-row'); if (firstGeneralRow && !document.querySelector('.admin-warning-box')) { - var adminBox = document.createElement('div'); - adminBox.classList.add('admin-warning-box'); - adminBox.style.backgroundColor = '#1e2328'; - adminBox.style.color = '#f0e6d2'; - adminBox.style.padding = '6px'; - adminBox.style.marginBottom = '10px'; - adminBox.style.borderRadius = '0'; - adminBox.style.borderLeft = '3.5px solid #c89b3c'; - adminBox.style.fontWeight = 'bold'; - adminBox.style.fontSize = '14px'; - adminBox.style.fontFamily = 'LoL Display, Arial'; - adminBox.textContent = "Some of these settings are enforced by League Client Debloater"; + var adminBox = document.createElement('div'); + adminBox.classList.add('admin-warning-box'); + adminBox.style.backgroundColor = '#1e2328'; + adminBox.style.color = '#f0e6d2'; + adminBox.style.padding = '6px'; + adminBox.style.marginBottom = '10px'; + adminBox.style.borderRadius = '0'; + adminBox.style.borderLeft = '3.5px solid #c89b3c'; + adminBox.style.fontWeight = 'bold'; + adminBox.style.fontSize = '14px'; + adminBox.style.fontFamily = 'LoL Display, Arial'; + adminBox.textContent = "Some of these settings are enforced by League Client Debloater"; firstGeneralRow.parentNode.insertBefore(adminBox, firstGeneralRow); } }); if (document.body) { - observer.observe(document.body, { childList: true, subtree: true }); + observer.observe(document.body, { + childList: true, + subtree: true + }); } else { console.error("Document body is not available for MutationObserver."); } @@ -237,7 +272,7 @@ (function forceSettings() { window.addEventListener('load', function() { - + const lcuPreferencesPayload = { "data": { "top-nav-updates-eat-seen": true, @@ -258,9 +293,9 @@ "data": { "hasBeenPromptedForPotatoMode": true, "lastKnownMachineSpec": 3, - "motionEffectsDisabled": true, + "motionEffectsDisabled": true, "potatoModeEnabled": true, - "unloadLeagueClientUx": "never" + "closeLeagueClientDuringGame": false, }, "schemaVersion": 3 }; @@ -310,19 +345,24 @@ }, false); })(); -import { jsx, render } from 'https://cdn.jsdelivr.net/npm/nano-jsx/+esm'; +import { + jsx, + render +} from 'https://cdn.jsdelivr.net/npm/nano-jsx/+esm'; -const Version = 6; +const Version = 8; const UpdateAlert = () => { - const title = ['Update Required']; - const message = ['You must update League Client Debloater to continue. Click here to get the latest version. After replacing with the new version, click reload.']; - const refreshText = ['Reload']; - const quitText = ['Quit']; - const refresh = () => location.reload(); - const shutdown = () => fetch('/process-control/v1/process/quit', { method: 'POST' }); - - return jsx/*html*/` + const title = ['Update Required']; + const message = ['You must update League Client Debloater to continue. Click here to get the latest version. After replacing with the new version, click reload.']; + const refreshText = ['Reload']; + const quitText = ['Quit']; + const refresh = () => location.reload(); + const shutdown = () => fetch('/process-control/v1/process/quit', { + method: 'POST' + }); + + return jsx`