diff --git a/src/bootstrap.js b/src/bootstrap.js index 681da2f..d07c7fe 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -41,7 +41,8 @@ const startCore = () => { const [ channel, hash ] = oaVersion.split('-'); // Split via - bw.webContents.executeJavaScript(readFileSync(join(__dirname, 'mainWindow.js'), 'utf8') - .replaceAll('', hash || 'custom')); + .replaceAll('', hash || 'custom')) + .replaceAll('', oaConfig.noTrack); if (oaConfig.js) bw.webContents.executeJavaScript(oaConfig.js); }); @@ -73,24 +74,7 @@ const startCore = () => { }; const startUpdate = () => { - if (oaConfig.noTrack !== false) { - const bl = { cancel: true }; // Standard block callback response - - let sentry; - session.defaultSession.webRequest.onBeforeRequest({ - urls: [ - 'https://*.discord.com/assets/*.js', - 'https://*/api/*/science' - ] - }, async ({ url }, cb) => { - if (url.endsWith('/science')) return cb(bl); - - if (!sentry && (await new Promise((res) => get(url, (e, r, b) => res(b)))).includes('RecipeWebview')) sentry = url; - if (sentry === url) return cb(bl); - - cb({}); - }); - } + if (oaConfig.noTrack !== false) session.defaultSession.webRequest.onBeforeRequest({ urls: [ 'https://*/api/v9/science' ] }, async (e, cb) => cb({ cancel: true })); const startMin = process.argv?.includes?.('--start-minimized'); diff --git a/src/mainWindow.js b/src/mainWindow.js index 1ca6f10..62088b9 100644 --- a/src/mainWindow.js +++ b/src/mainWindow.js @@ -1,3 +1,10 @@ +if ('' === 'true') { // Disable sentry + try { + window.__SENTRY__.hub.getClient().getOptions().enabled = false; + Object.keys(console).forEach(x => console[x] = console[x].__sentry_original__ ?? console[x]); + } catch { } +} + let lastBgPrimary = ''; const themesync = async () => { const getVar = (name, el = document.body) => el && (getComputedStyle(el).getPropertyValue(name) || getVar(name, el.parentElement))?.trim();