aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/administration/configuration.rst9
-rw-r--r--fietsboek/templates/layout.jinja28
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/administration/configuration.rst b/doc/administration/configuration.rst
index 3927540..272ac71 100644
--- a/doc/administration/configuration.rst
+++ b/doc/administration/configuration.rst
@@ -74,3 +74,12 @@ Most of the configuration is in the ``[app:main]`` category and looks like this:
* ``email.username`` and ``email.password`` can be used to set the login
information for the SMTP server.
+* ``thunderforest.api_key`` can be set to an API key of `Thunderforest
+ <https://www.thunderforest.com/>`__ to enable support for the OpenCycleMap,
+ Landscape and Outdoors maps.
+
+.. warning::
+
+ The API key will be embedded in the source of the website, therefore it is
+ possible for visitors to "steal" the API key. Keep that in mind when
+ setting an API key for a publicly accessible site!
diff --git a/fietsboek/templates/layout.jinja2 b/fietsboek/templates/layout.jinja2
index 83a8f33..984a790 100644
--- a/fietsboek/templates/layout.jinja2
+++ b/fietsboek/templates/layout.jinja2
@@ -21,6 +21,14 @@
<script>
const FRIENDS_URL = "{{ request.route_url('json-friends') }}";
const LOCALE = "{{ request.localizer.locale_name.replace('_', '-') }}";
+{% if request.registry.settings.get("thunderforest.api_key") %}
+{% set api_key = request.registry.settings.get("thunderforest.api_key") %}
+window.JB = window.JB || {};
+window.JB.GPX2GM = window.JB.GPX2GM || {};
+window.JB.GPX2GM.OSM_Cycle_Api_Key = "{{ api_key }}";
+window.JB.GPX2GM.OSM_Landscape_Api_Key = "{{ api_key }}";
+window.JB.GPX2GM.OSM_Outdoors_Api_Key = "{{ api_key }}";
+{% endif %}
</script>
</head>