tweak: add custom user agent.

This commit is contained in:
NunoSempere 2023-02-15 20:34:17 +01:00
parent bcaad22c17
commit 53cc700748

5
rose.c
View File

@ -24,6 +24,7 @@
int LIBRE_REDIRECT_ENABLED = true; int LIBRE_REDIRECT_ENABLED = true;
int READABILITY_ENABLED = true; int READABILITY_ENABLED = true;
int CUSTOM_STYLE_ENABLED = true; int CUSTOM_STYLE_ENABLED = true;
int CUSTOM_USER_AGENT = true;
// to enable plugins, // to enable plugins,
// 1. Enable them: // 1. Enable them:
@ -63,6 +64,10 @@ WebKitWebView *webview_new()
WebKitUserContentManager *contentmanager; WebKitUserContentManager *contentmanager;
settings = webkit_settings_new_with_settings(WEBKIT, NULL); settings = webkit_settings_new_with_settings(WEBKIT, NULL);
if(CUSTOM_USER_AGENT){
webkit_settings_set_user_agent (settings, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36");
// See: <https://www.useragents.me/> for some common user agents
}
web_context = webkit_web_context_new_with_website_data_manager( web_context = webkit_web_context_new_with_website_data_manager(
webkit_website_data_manager_new(CACHE, NULL)); webkit_website_data_manager_new(CACHE, NULL));
contentmanager = webkit_user_content_manager_new(); contentmanager = webkit_user_content_manager_new();