From cd4f0ccad7144ff2b26c535caf25870be293d21f Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Sat, 1 Jun 2024 04:34:21 +0900 Subject: [PATCH] fix(adblocker): fix blank screen - fix #1942 - fix #2100 - fix #2103 --- package.json | 6 ++---- src/plugins/adblocker/blocker.ts | 12 +++++++----- src/renderer.ts | 4 +++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index c6597186e3..29410e16d2 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "engines": { - "node": ">=18.0.0" + "node": ">=18.0.0", + "pnpm": ">=8" }, "pnpm": { "overrides": { @@ -228,8 +229,5 @@ "package": true, "unreleased": true, "output": "changelog.md" - }, - "engines": { - "pnpm": ">=8" } } diff --git a/src/plugins/adblocker/blocker.ts b/src/plugins/adblocker/blocker.ts index 014f051ec0..ea1b60d001 100644 --- a/src/plugins/adblocker/blocker.ts +++ b/src/plugins/adblocker/blocker.ts @@ -8,11 +8,13 @@ import { app, net } from 'electron'; const SOURCES = [ 'https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt', // UBlock Origin - 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt', - 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2020.txt', - 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2021.txt', - 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2022.txt', - 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters-2023.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/quick-fixes.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/unbreak.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2020.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2021.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2022.txt', + 'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2023.txt', // Fanboy Annoyances 'https://secure.fanboy.co.nz/fanboy-annoyance_ubo.txt', // AdGuard diff --git a/src/renderer.ts b/src/renderer.ts index 52abd24682..3b3b743080 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -225,7 +225,9 @@ const preload = async () => { t: i18t.bind(i18next), }; defineYTMDTransElements(); - document.body.dataset.os = navigator.userAgent; + if (document.body?.dataset?.os) { + document.body.dataset.os = navigator.userAgent; + } }; const main = async () => {