mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 14:02:20 +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: 0464212f82
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;
|
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue