]> git.street.me.uk Git - andy/viking.git/commitdiff
Enable compile time option for Mapbox access token.
authorRob Norris <rw_norris@hotmail.com>
Sun, 12 Mar 2017 22:54:12 +0000 (22:54 +0000)
committerRob Norris <rw_norris@hotmail.com>
Mon, 13 Mar 2017 23:41:41 +0000 (23:41 +0000)
Allows individual users or distributors to have there own access token
for accessing Mapbox tile web services.

configure.ac
src/osm.c

index a4961ad1a6e90dbaa1da7652379e5d23645e50ad..c3f3a46b1d07ab2d6b76b6bbc3eccd59a4d79c00 100644 (file)
@@ -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],
index a9a3771daf0bf3b6e93de5d54d574abd70eb37f8..48c5ef2344e1b6c65ea34944ecef21ebf89fafa5 100644 (file)
--- 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,