1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

Browser+LibWeb+WebContent: Implement per-URL-pattern proxies

...at least for SOCKS5.
This commit is contained in:
Ali Mohammad Pur 2022-04-08 01:46:47 +04:30 committed by Andreas Kling
parent f9fc28931f
commit a42e03b01a
15 changed files with 155 additions and 6 deletions

View file

@ -31,6 +31,8 @@ String g_search_engine;
String g_home_url;
Vector<String> g_content_filters;
bool g_content_filters_enabled { true };
Vector<String> g_proxies;
HashMap<String, size_t> g_proxy_mappings;
IconBag g_icon_bag;
}
@ -96,6 +98,20 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(load_content_filters());
for (auto& group : Config::list_groups("Browser")) {
if (!group.starts_with("Proxy:"))
continue;
for (auto& key : Config::list_keys("Browser", group)) {
auto proxy_spec = group.substring_view(6);
auto existing_proxy = Browser::g_proxies.find(proxy_spec);
if (existing_proxy.is_end())
Browser::g_proxies.append(proxy_spec);
Browser::g_proxy_mappings.set(key, existing_proxy.index());
}
}
URL first_url = Browser::url_from_user_input(Browser::g_home_url);
if (specified_url) {
if (Core::File::exists(specified_url)) {