rewrite science block, also block cloudflare nel & sentry (#317)

* rewrite science block, also block cloudflare nel

* Kill unused import
This commit is contained in:
Ven 2022-12-26 23:29:29 +01:00 committed by GitHub
parent 55fd573599
commit 7822317d3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,10 +134,12 @@ async function doAfterDefiningTheWindow() {
console.log("Starting screenshare module...");
import("./screenshare/main");
}
mainWindow.webContents.session.webRequest.onBeforeRequest((details, callback) => {
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
return callback({});
});
mainWindow.webContents.session.webRequest.onBeforeRequest(
{urls: ["https://*/api/v*/science", "https://sentry.io/*", "https://*.nel.cloudflare.com/*"]},
(_, callback) => callback({cancel: true})
);
if ((await getConfig("trayIcon")) == "default") {
mainWindow.webContents.on("page-favicon-updated", async (event) => {
var faviconBase64 = await mainWindow.webContents.executeJavaScript(`