Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createAdblocker = sessionList => {
const blocklistsFolder = path.join(app.getPath("appData"), "blocklists")
// Read all filter files from the blocklists folder (including user added)
let filters = ""
try {
for (const file of fs.readdirSync(blocklistsFolder)) {
if (file.endsWith(".txt")) {
filters += loadBlocklist(file)
}
}
} catch (e) {
console.log("Failed to read the files from blocklists folder", e)
}
blocker = ElectronBlocker.parse(filters)
enableAdblocker(sessionList)
}
ipcMain.on("adblock-enable", (_, sessionList) => {