mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
UI/Qt: Update the User-Agent to the provided UA override name
This commit is contained in:
parent
a04327a0c9
commit
0464212f82
Notes:
github-actions[bot]
2024-08-29 12:06:53 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/0464212f829 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1215 Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 8 additions and 4 deletions
|
@ -497,11 +497,15 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
|
|||
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);
|
||||
disable_spoofing->setChecked(true);
|
||||
for (auto const& user_agent : WebView::user_agents)
|
||||
add_user_agent(user_agent.key, user_agent.value.to_byte_string());
|
||||
disable_spoofing->setChecked(!user_agent_preset.has_value());
|
||||
for (auto const& user_agent : WebView::user_agents) {
|
||||
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);
|
||||
custom_user_agent_action->setCheckable(true);
|
||||
|
|
Loading…
Reference in a new issue