new plugin WatchTogetherAdblock: block ads in youtube activity (#2021)

Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
Luna 2024-05-26 15:44:04 -04:00 committed by GitHub
parent 9ec671819d
commit 41c5bbd952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 305 additions and 3 deletions

View file

@ -0,0 +1,21 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { RendererSettings } from "@main/settings";
import { app } from "electron";
import adguard from "file://adguard.js?minify";
app.on("browser-window-created", (_, win) => {
win.webContents.on("frame-created", (_, { frame }) => {
frame.once("dom-ready", () => {
if (frame.url.includes("discordsays") && frame.url.includes("youtube.com")) {
if (!RendererSettings.store.plugins?.WatchTogetherAdblock?.enabled) return;
frame.executeJavaScript(adguard);
}
});
});
});