From d63897f8add13a71b591f31007a1e791df129ba4 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Fri, 28 Aug 2026 15:43:52 +0100 Subject: [PATCH] Provide CartoDB API key --- config-example.yml | 4 +++- core/constants.py | 2 +- pyproject.toml | 2 +- static/js/map.js | 8 ++++++-- static/vendor/js/leaflet-providers-2.0.0.js | 5 +++-- templates/add_spot.html | 2 +- templates/alerts.html | 2 +- templates/bands.html | 4 ++-- templates/base.html | 10 +++++----- templates/conditions.html | 2 +- templates/map.html | 7 +++++-- templates/spots.html | 4 ++-- templates/status.html | 2 +- 13 files changed, 32 insertions(+), 22 deletions(-) diff --git a/config-example.yml b/config-example.yml index c1aa299..4492e5c 100644 --- a/config-example.yml +++ b/config-example.yml @@ -345,4 +345,6 @@ web_ui_options: # (home) page, although being arbitrary HTML you can also use a div with absolute, relative, float placement etc. This # is designed for a "donate/support the server" type button, though you are free to do whatever you want with it. # As the server owner you are responsible for the safe usage of this option! - support_button_html: "" \ No newline at end of file + support_button_html: "" + # CartoDB API key. Required to use the CartoDB layers without watermark. Get one from https://carto.com/basemaps/apikey/. + cartodb_api_key: "" \ No newline at end of file diff --git a/core/constants.py b/core/constants.py index 7c1d40e..b1a6fdd 100644 --- a/core/constants.py +++ b/core/constants.py @@ -5,7 +5,7 @@ from data.band import Band from data.sig import SIG # General software -SOFTWARE_VERSION = "2.0-pre" +SOFTWARE_VERSION = "2.0.2-pre" # HTTP headers used for spot providers that use HTTP HTTP_HEADERS = {"User-Agent": f"Spothole v{SOFTWARE_VERSION} (operated by {SERVER_OWNER_CALLSIGN})"} diff --git a/pyproject.toml b/pyproject.toml index 0305ae0..3d3d5ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "Spothole" -version = "2.0" +version = "2.0.2" authors = [ { name="Ian Renton", email="ian@ianrenton.com" }, ] diff --git a/static/js/map.js b/static/js/map.js index 50dfc37..d534bd1 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -394,9 +394,11 @@ function setBasemap(basemapname) { } // OpenStreetMap.Mapnik.Dark is a synthetic variant that uses Mapnik tiles with a CSS filter applied const providerName = basemapname === "OpenStreetMap.Mapnik.Dark" ? "OpenStreetMap.Mapnik" : basemapname; + const isCartoDB = basemapname === "CartoDB.Voyager" || basemapname === "CartoDB.DarkMatter"; backgroundTileLayer = L.tileLayer.provider(providerName, { opacity: parseFloat($("#basemapOpacity").val()), - edgeBufferTiles: 1 + edgeBufferTiles: 1, + key: isCartoDB ? CARTODB_API_KEY : null }); backgroundTileLayer.addTo(map); backgroundTileLayer.bringToBack(); @@ -529,9 +531,11 @@ function setUpMap() { // Add basemap loadedBasemap = $("#basemap").val(); const initialProviderName = loadedBasemap === "OpenStreetMap.Mapnik.Dark" ? "OpenStreetMap.Mapnik" : loadedBasemap; + const isCartoDB = loadedBasemap === "CartoDB.Voyager" || loadedBasemap === "CartoDB.DarkMatter"; backgroundTileLayer = L.tileLayer.provider(initialProviderName, { opacity: parseFloat($("#basemapOpacity").val()), - edgeBufferTiles: 1 + edgeBufferTiles: 1, + key: isCartoDB ? CARTODB_API_KEY : null }); backgroundTileLayer.addTo(map); backgroundTileLayer.bringToBack(); diff --git a/static/vendor/js/leaflet-providers-2.0.0.js b/static/vendor/js/leaflet-providers-2.0.0.js index bcde1ed..ba69fe6 100644 --- a/static/vendor/js/leaflet-providers-2.0.0.js +++ b/static/vendor/js/leaflet-providers-2.0.0.js @@ -801,12 +801,13 @@ } }, CartoDB: { - url: 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png', + url: 'https://{s}.basemaps.cartocdn.com/{variant}/{z}/{x}/{y}{r}.png?key={key}', options: { attribution: '{attribution.OpenStreetMap} © CARTO', subdomains: 'abcd', maxZoom: 20, - variant: 'light_all' + variant: 'light_all', + key: '' }, variants: { Positron: 'light_all', diff --git a/templates/add_spot.html b/templates/add_spot.html index 77cdfbe..01129a8 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 8cad303..13c326d 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -84,7 +84,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 27a43ab..59cf682 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index e3958ab..abec8fe 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -15,10 +15,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index c8f0278..3c16c3e 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index ebc4c22..e8a06ba 100644 --- a/templates/map.html +++ b/templates/map.html @@ -109,8 +109,11 @@ - - + + + diff --git a/templates/spots.html b/templates/spots.html index 387bfea..7cc0ad0 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -113,8 +113,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index ded117c..c3d71ae 100644 --- a/templates/status.html +++ b/templates/status.html @@ -86,7 +86,7 @@ - +