Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e80704c534 | |||
| c9c9e1171b |
14
main.js
14
main.js
@@ -6,6 +6,16 @@ const cheerio = require('cheerio');
|
||||
const { ElectronBlocker, adsAndTrackingLists } = require('@cliqz/adblocker-electron');
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
|
||||
// Disable Trusted Types CSP enforcement engine-wide.
|
||||
// YouTube sends `Content-Security-Policy: require-trusted-types-for 'script'`,
|
||||
// which blocks the cliqz adblocker's scriptlet injection (it uses plain
|
||||
// `script.text = ...`) → 52+ console errors and broken anti-adblock neutralizers.
|
||||
// Stripping the CSP header via webRequest doesn't work — the adblocker's own
|
||||
// onHeadersReceived hook overwrites ours (Electron allows only one listener
|
||||
// per session). Disabling the Blink feature is the cleanest fix; safe in a
|
||||
// kiosk single-user context.
|
||||
app.commandLine.appendSwitch('disable-blink-features', 'TrustedDOMTypes');
|
||||
|
||||
const CONFIG_PATH = path.join(os.homedir(), '.ESH-Media.json');
|
||||
const BLOCKER_CACHE_PATH = path.join(os.homedir(), '.ESH-Media-adblock-v3.bin');
|
||||
const DEFAULT_TRUSTED_DOMAINS = [
|
||||
@@ -1228,6 +1238,10 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
);
|
||||
|
||||
// (Trusted Types now handled engine-wide via --disable-blink-features
|
||||
// command-line switch at file top. webRequest.onHeadersReceived strip
|
||||
// was tried in 1.0.6 but the cliqz adblocker overwrites the listener.)
|
||||
|
||||
// Apply proxy from config before blocker tries to download filter lists
|
||||
loadTrustedDomainsFromDisk();
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ESH-Media",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.7",
|
||||
"private": true,
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user