mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWebView: Add a command line option to override the User-Agent
This commit just adds a command line option to case-insensitively accept a User-Agent name to use as the UA override. The UIs will individually need to make use of this option.
This commit is contained in:
parent
a6bf253602
commit
a04327a0c9
Notes:
github-actions[bot]
2024-08-29 12:06:59 +00:00
Author: https://github.com/trflynn89
Commit: a04327a0c9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1215
Reviewed-by: https://github.com/tcl3 ✅
4 changed files with 27 additions and 0 deletions
|
@ -19,4 +19,14 @@ OrderedHashMap<StringView, StringView> const user_agents = {
|
|||
{ "Safari iOS Mobile"sv, "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"sv },
|
||||
};
|
||||
|
||||
Optional<StringView> normalize_user_agent_name(StringView name)
|
||||
{
|
||||
for (auto const& user_agent : user_agents) {
|
||||
if (user_agent.key.equals_ignoring_ascii_case(name))
|
||||
return user_agent.key;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue