From: Rob Norris Date: Sun, 12 Mar 2017 22:54:12 +0000 (+0000) Subject: Enable compile time option for Mapbox access token. X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/ad8b15937360af3292fac27904f9c1ee4b06ae92 Enable compile time option for Mapbox access token. Allows individual users or distributors to have there own access token for accessing Mapbox tile web services. --- diff --git a/configure.ac b/configure.ac index a4961ad1..c3f3a46b 100644 --- a/configure.ac +++ b/configure.ac @@ -431,6 +431,16 @@ AC_PROG_CXX m4_popdef([AC_MSG_ERROR]) ## +dnl Compile time defined access token +AC_ARG_WITH(mapbox_access_token, + [AC_HELP_STRING([--with-mapbox_access_token], + [Access token for MapBox tiles. + Please register your own if you're going to distribute the + package, as requests are limited per token.])], + [VIK_CONFIG_MAPBOX_TOKEN="\"${withval}\""], + [VIK_CONFIG_MAPBOX_TOKEN="\"pk.eyJ1Ijoicndub3JyaXMiLCJhIjoiY2lxc294anN2MDA5bWhzbWFseWsxMW1ydiJ9.HcybKtZsiG6RVuOHg481Kg\""]) +AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPBOX_TOKEN, ${VIK_CONFIG_MAPBOX_TOKEN}, [geonames username]) + AC_ARG_WITH(geonames_username, [AC_HELP_STRING([--with-geonames_username], diff --git a/src/osm.c b/src/osm.c index a9a3771d..48c5ef23 100644 --- a/src/osm.c +++ b/src/osm.c @@ -137,16 +137,15 @@ void osm_init () { "is-osm-meta-tiles", TRUE, NULL)); - // Note using a single global Viking registered key for the Mapbox Tileservice - // which is not secret since it's right here! + // Note using a registered token for the Mapbox Tileservice // Thus not only will the (free) service allocation limit be reached by normal users - // but by anymore who cares to read this source and use it themselves. + // but by anymore who cares to read these sources and use the default themselves. VikMapSource *mapbox_type = VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, "id", MAP_ID_MAPBOX_OUTDOORS, "name", "Mapbox-Outdoors", "label", _("Mapbox Outdoors"), - "url", "https://api.tiles.mapbox.com/styles/v1/mapbox/outdoors-v9/tiles/256/%d/%d/%d?access_token=pk.eyJ1Ijoicndub3JyaXMiLCJhIjoiY2lxc294anN2MDA5bWhzbWFseWsxMW1ydiJ9.HcybKtZsiG6RVuOHg481Kg", + "url", "https://api.tiles.mapbox.com/styles/v1/mapbox/outdoors-v9/tiles/256/%d/%d/%d?access_token="VIK_CONFIG_MAPBOX_TOKEN, "check-file-server-time", TRUE, "use-etag", FALSE, "zoom-min", 0,