diff options
author | Peter Hofmann <scm@uninformativ.de> | 2014-07-26 10:17:15 +0200 |
---|---|---|
committer | Peter Hofmann <scm@uninformativ.de> | 2014-07-26 10:17:15 +0200 |
commit | b3c87eae580dbd2d5437b985850a363796f372ef (patch) | |
tree | 32fc29a8a34edb553ef890cc5b996c64a1dd4d5a | |
parent | 674e1878f777657e48ba02df64030863a11a7995 (diff) | |
download | lariza-b3c87eae580dbd2d5437b985850a363796f372ef.tar.gz |
Steal surf's user agent
Ugly hackaround. Closes #6, though.
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | browser.c | 11 |
2 files changed, 15 insertions, 0 deletions
@@ -230,6 +230,10 @@ following environment variables: ("homepage" or "new window") and if no URIs are specified on the command line. Defaults to "about:blank". + LARIZA_USER_AGENT + Lariza will identify itself with this string. See source code + for the default value. + LARIZA_ZOOM Zoom level for WebKit viewports. Defaults to 1.0. @@ -83,6 +83,10 @@ static gboolean language_is_set = FALSE; static gchar *search_text = NULL; static gboolean show_all_requests = FALSE; static gboolean tabbed_automagic = TRUE; +static gchar *user_agent = "Mozilla/5.0 (X11; U; Unix; en-US) " + "AppleWebKit/537.15 (KHTML, like Gecko) " + "Chrome/24.0.1295.0 " + "Safari/537.15 "__NAME_UPPERCASE__"/git"; void @@ -263,6 +267,9 @@ client_new(const gchar *uri) language_is_set = TRUE; } + g_object_set(G_OBJECT(webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view))), + "user-agent", user_agent, NULL); + c->scroll = gtk_scrolled_window_new(NULL, NULL); gtk_container_add(GTK_CONTAINER(c->scroll), c->web_view); @@ -569,6 +576,10 @@ grab_environment_configuration(void) if (e != NULL) home_uri = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_USER_AGENT"); + if (e != NULL) + user_agent = g_strdup(e); + e = g_getenv(__NAME_UPPERCASE__"_ZOOM"); if (e != NULL) global_zoom = atof(e); |