mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
UI/Qt: Update the User-Agent to the provided UA override name
This commit is contained in:
committed by
Tim Ledbetter
parent
a04327a0c9
commit
0464212f82
@@ -497,11 +497,15 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
|
|||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
||||||
set_user_agent_string(Web::default_user_agent);
|
auto const& user_agent_preset = WebView::Application::web_content_options().user_agent_preset;
|
||||||
|
set_user_agent_string(user_agent_preset.has_value() ? *WebView::user_agents.get(*user_agent_preset) : Web::default_user_agent);
|
||||||
|
|
||||||
auto* disable_spoofing = add_user_agent("Disabled"sv, Web::default_user_agent);
|
auto* disable_spoofing = add_user_agent("Disabled"sv, Web::default_user_agent);
|
||||||
disable_spoofing->setChecked(true);
|
disable_spoofing->setChecked(!user_agent_preset.has_value());
|
||||||
for (auto const& user_agent : WebView::user_agents)
|
for (auto const& user_agent : WebView::user_agents) {
|
||||||
add_user_agent(user_agent.key, user_agent.value.to_byte_string());
|
auto* spoofed_user_agent = add_user_agent(user_agent.key, user_agent.value.to_byte_string());
|
||||||
|
spoofed_user_agent->setChecked(user_agent.key == user_agent_preset);
|
||||||
|
}
|
||||||
|
|
||||||
auto* custom_user_agent_action = new QAction("Custom...", this);
|
auto* custom_user_agent_action = new QAction("Custom...", this);
|
||||||
custom_user_agent_action->setCheckable(true);
|
custom_user_agent_action->setCheckable(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user