mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:57:46 +00:00
Browser+LibWeb+WebContent: Implement per-URL-pattern proxies
...at least for SOCKS5.
This commit is contained in:
parent
f9fc28931f
commit
a42e03b01a
15 changed files with 155 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
|
@ -24,6 +25,7 @@
|
|||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Loader/ContentFilter.h>
|
||||
#include <LibWeb/Loader/ProxyMappings.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Painting/StackingContext.h>
|
||||
|
@ -454,6 +456,22 @@ void ConnectionFromClient::set_content_filters(Vector<String> const& filters)
|
|||
Web::ContentFilter::the().add_pattern(filter);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_proxy_mappings(Vector<String> const& proxies, HashMap<String, size_t> const& mappings)
|
||||
{
|
||||
auto keys = mappings.keys();
|
||||
quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); });
|
||||
|
||||
OrderedHashMap<String, size_t> sorted_mappings;
|
||||
for (auto& key : keys) {
|
||||
auto value = *mappings.get(key);
|
||||
if (value >= proxies.size())
|
||||
continue;
|
||||
sorted_mappings.set(key, value);
|
||||
}
|
||||
|
||||
Web::ProxyMappings::the().set_mappings(proxies, move(sorted_mappings));
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme)
|
||||
{
|
||||
m_page_host->set_preferred_color_scheme(color_scheme);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue