tazweb rev 200

Use a compatible user agent string - render gmail and others like a rockstar :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 18 13:39:20 2017 +0100 (2017-03-18)
parents 466d886e3b94
children 8bc829832719
files src/tazweb-ng.c src/tazweb.c
line diff
     1.1 --- a/src/tazweb-ng.c	Fri Mar 17 00:15:00 2017 +0100
     1.2 +++ b/src/tazweb-ng.c	Sat Mar 18 13:39:20 2017 +0100
     1.3 @@ -22,20 +22,26 @@
     1.4  #include <webkit/webkit.h>
     1.5  #include <libsoup/soup.h>
     1.6  
     1.7 +#define VERSION			"1.11"
     1.8 +#define GETTEXT_PACKAGE	"tazweb"
     1.9 +#define WEBHOME			"file:///usr/share/webhome/index.html"
    1.10 +#define SEARCH			"http://duckduckgo.com/?q=%s&t=slitaz"
    1.11  #define HOME			g_get_home_dir()
    1.12  #define CONFIG			g_strdup_printf("%s/.config/tazweb", HOME)
    1.13  #define BOOKMARKS		g_strdup_printf("%s/bookmarks.txt", CONFIG)
    1.14  #define COOKIES			g_strdup_printf("%s/cookies.txt", CONFIG)
    1.15  #define DOWNLOADS		g_strdup_printf("%s/Downloads", HOME)
    1.16 -#define WEBHOME			"file:///usr/share/webhome/index.html"
    1.17 -#define SEARCH			"http://duckduckgo.com/?q=%s&t=slitaz"
    1.18 -#define GETTEXT_PACKAGE	"tazweb"
    1.19 +
    1.20 +/* User agent string */
    1.21 +#define UA_TAZWEB		g_strdup_printf("TazWeb/%s (X11; SliTaz GNU/Linux)", VERSION)
    1.22 +#define UA_COMPAT		"Mozilla/5.0 AppleWebKit/535.22+"
    1.23 +#define UA				g_strdup_printf("%s %s", UA_TAZWEB, UA_COMPAT)
    1.24  
    1.25  int		width			= 800;
    1.26  int		height			= 600;
    1.27  int		private			= 0;
    1.28  
    1.29 -static gchar *useragent = "TazWeb (X11; SliTaz GNU/Linux; U; en_US)";
    1.30 +static gchar			*useragent;
    1.31  static gboolean		notoolbar;
    1.32  static gboolean		nomenu;
    1.33  static gboolean		kiosk;
    1.34 @@ -331,6 +337,8 @@
    1.35  	
    1.36  	/* Webkit settings */
    1.37  	settings = webkit_web_view_get_settings (ttb->webview);
    1.38 +	if (! useragent)
    1.39 +		useragent = g_strdup_printf("%s", UA);
    1.40  	g_object_set(G_OBJECT(settings), "user-agent", useragent, NULL);
    1.41  	
    1.42  	if (private)
     2.1 --- a/src/tazweb.c	Fri Mar 17 00:15:00 2017 +0100
     2.2 +++ b/src/tazweb.c	Sat Mar 18 13:39:20 2017 +0100
     2.3 @@ -17,20 +17,26 @@
     2.4  #include <webkit/webkit.h>
     2.5  #include <libsoup/soup.h>
     2.6  
     2.7 +#define VERSION			"1.11"
     2.8 +#define GETTEXT_PACKAGE	"tazweb"
     2.9 +#define WEBHOME			"file:///usr/share/webhome/index.html"
    2.10 +#define SEARCH			"http://duckduckgo.com/?q=%s&t=slitaz"
    2.11  #define HOME			g_get_home_dir()
    2.12  #define CONFIG			g_strdup_printf("%s/.config/tazweb", HOME)
    2.13  #define BOOKMARKS		g_strdup_printf("%s/bookmarks.txt", CONFIG)
    2.14  #define COOKIES			g_strdup_printf("%s/cookies.txt", CONFIG)
    2.15  #define DOWNLOADS		g_strdup_printf("%s/Downloads", HOME)
    2.16 -#define WEBHOME			"file:///usr/share/webhome/index.html"
    2.17 -#define SEARCH			"http://duckduckgo.com/?q=%s&t=slitaz"
    2.18 -#define GETTEXT_PACKAGE	"tazweb"
    2.19 +
    2.20 +/* User agent string */
    2.21 +#define UA_TAZWEB		g_strdup_printf("TazWeb/%s (X11; SliTaz GNU/Linux)", VERSION)
    2.22 +#define UA_COMPAT		"Mozilla/5.0 AppleWebKit/535.22+"
    2.23 +#define UA				g_strdup_printf("%s %s", UA_TAZWEB, UA_COMPAT)
    2.24  
    2.25  int		width			= 800;
    2.26  int		height			= 600;
    2.27  int		private			= 0;
    2.28  
    2.29 -static gchar *useragent = "TazWeb (X11; SliTaz GNU/Linux; U; en_US)";
    2.30 +static gchar			*useragent;
    2.31  static gboolean		notoolbar;
    2.32  static gboolean		nomenu;
    2.33  static gboolean		kiosk;
    2.34 @@ -405,6 +411,8 @@
    2.35  
    2.36  	/* Webkit settings */
    2.37  	settings = webkit_web_view_get_settings (webview);
    2.38 +	if (! useragent)
    2.39 +		useragent = g_strdup_printf("%s", UA);
    2.40  	g_object_set(G_OBJECT(settings), "user-agent", useragent, NULL);
    2.41  	
    2.42  	if (private)