Adds a WCvar to override the CEF user-agent (#3676)

This commit is contained in:
ike709
2023-01-11 19:33:44 -07:00
committed by GitHub
parent d430df07f7
commit 4c2ea93624
2 changed files with 12 additions and 0 deletions

View File

@@ -69,6 +69,12 @@ namespace Robust.Client.WebView.Cef
CachePath = cachePath,
};
var userAgentOverride = _cfg.GetCVar(WCVars.UserAgentOverride);
if (!string.IsNullOrEmpty(userAgentOverride))
{
settings.UserAgent = userAgentOverride;
}
Logger.Info($"CEF Version: {CefRuntime.ChromeVersion}");
_app = new RobustCefApp();

View File

@@ -14,4 +14,10 @@ public static class WCVars
/// </summary>
public static readonly CVarDef<bool> WebResProtocol =
CVarDef.Create("web.res_protocol", true, CVar.CLIENTONLY);
/// <summary>
/// Overrides the default CEF user-agent when set to a non-empty string.
/// </summary>
public static readonly CVarDef<string> UserAgentOverride =
CVarDef.Create("web.user_agent", "", CVar.CLIENTONLY);
}