Add files via upload

This commit is contained in:
NodeMixaholic 2023-03-02 18:20:58 -06:00 committed by GitHub
parent 8a7b85e562
commit 745591b7e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 375 additions and 191 deletions

6
adblock.ts Normal file
View file

@ -0,0 +1,6 @@
const fetchr = require("cross-fetch")
const { ElectronBlocker, fullLists, Requests } = require('@cliqz/adblocker-electron')
let mainWindow: BrowserWindow | null = null;
let blocker = await ElectronBlocker.fromPrebuiltAdsAndTracking(fetchr);
blocker.enableBlockingInSession(mainWindow.webContents.defaultSession);

View file

@ -9,7 +9,9 @@ function go() {
})
document.getElementById("txtUrl").value = ""
for (let i = 0; i < extensions.length; i++) {
fetch(extensions[i]).then( r => r.text() ).then( t => browserFrame.executeJavaScript(t))
fetch(extensions[i]).then( r => r.text() ).then( t => browserFrame.executeJavaScript(t)).catch(() => {
console.log("Error loading extensions! (Did you provide any?)")
})
}
}
function back() {

View file

@ -1,6 +1,9 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')
const path = require('path')
const fetchr = require("cross-fetch")
const { ElectronBlocker, fullLists, Requests } = require('@cliqz/adblocker-electron')
function createWindow () {
// Create the browser window.
@ -13,6 +16,12 @@ function createWindow () {
}
})
ElectronBlocker.fromPrebuiltAdsAndTracking(fetchr).then((blocker) => {
blocker.enableBlockingInSession(mainWindow.webContents.defaultSession).catch(() => {
console.log("Blocker reported an error while init.")
})
});
// and load the index.html of the app.
mainWindow.loadFile('index.html')

544
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,9 @@
"electron": "^23.1.0"
},
"dependencies": {
"@cliqz/adblocker": "^1.26.2",
"@cliqz/adblocker-electron": "^1.26.2",
"cross-fetch": "^3.1.5",
"electron-squirrel-startup": "^1.0.0",
"electron-tabs": "^1.0.1"
}