1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

Browser: Add support for disabling content filtering

Just for completeness.
This commit is contained in:
Maciej 2022-02-01 11:17:37 +01:00 committed by Andreas Kling
parent 43e463748d
commit 4d1c28a23f
Notes: sideshowbarker 2024-07-17 18:35:03 +09:00
5 changed files with 26 additions and 6 deletions

View file

@ -30,6 +30,7 @@ namespace Browser {
String g_search_engine;
String g_home_url;
Vector<String> g_content_filters;
bool g_content_filters_enabled { true };
IconBag g_icon_bag;
}
@ -88,6 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Browser::g_home_url = Config::read_string("Browser", "Preferences", "Home", "file:///res/html/misc/welcome.html");
Browser::g_search_engine = Config::read_string("Browser", "Preferences", "SearchEngine", {});
Browser::g_content_filters_enabled = Config::read_bool("Browser", "Preferences", "EnableContentFilters");
Browser::g_icon_bag = TRY(Browser::IconBag::try_create());
@ -113,10 +115,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
dbgln("Reloading content filters failed: {}", error.release_error());
return;
}
window->tab_widget().for_each_child_of_type<Browser::Tab>([](auto& tab) {
tab.content_filters_changed();
return IterationDecision::Continue;
});
window->content_filters_changed();
};
TRY(content_filters_watcher->add_watch(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified));