Give trail pages an outdoor map
Trail maps now open on an outdoor style of our own, drawn on the same OpenFreeMap tiles: hill shading and contour lines from the public Terrain Tiles, woods, water, footpaths, and peaks with their heights. Heights and contours follow the visitor's units. A switch on the map goes back to the plain map and is remembered. The home page's overview map is unchanged. If the elevation tiles or the contour script fail, the map still loads without them. The security policy allows the one elevation-tile path. The contour add-on (maplibre-contour 0.1.1) is vendored with its licence, and the elevation data is credited on the map, under it and in the footer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
540a3220be
commit
ad2223f427
15 files changed
+994
-27
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Tests for the added pages: regions, routes, sources, logos, about, data, SEO files,
|
||||
the bulk archives and the response headers."""
|
||||
import html
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@@ -334,6 +335,20 @@ class HeadersTest(unittest.TestCase):
|
||||
self.assertEqual(font_src.strip(), "'self'")
|
||||
self.assertIn("https://tiles.openfreemap.org", re.search(r"connect-src ([^;]*)", csp).group(1))
|
||||
|
||||
def test_elevation_tiles_allowed_by_their_path_only(self):
|
||||
"""The outdoor map fetches Terrain Tiles (fetch() in the page or the
|
||||
contour add-on's blob: worker): connect-src names that one path."""
|
||||
csp = self.headers("/trails/john-muir/").get("content-security-policy", "")
|
||||
self.assertEqual(csp, self.headers("/").get("content-security-policy", ""))
|
||||
connect = re.search(r"connect-src ([^;]*)", csp).group(1).split()
|
||||
self.assertEqual(connect, ["'self'", "https://tiles.openfreemap.org",
|
||||
"https://s3.amazonaws.com/elevation-tiles-prod/terrarium/"])
|
||||
self.assertIn("worker-src 'self' blob:", csp)
|
||||
self.assertIn("img-src 'self' data: blob:;", csp)
|
||||
with open(os.path.join(WEB, "assets", "map", "outdoor.json"), encoding="utf-8") as f:
|
||||
dem = json.load(f)["sources"]["olt-dem"]["tiles"][0]
|
||||
self.assertTrue(dem.startswith(connect[2]), dem)
|
||||
|
||||
|
||||
class SeoTest(unittest.TestCase):
|
||||
def test_sitemap_absent_without_base_url(self):
|
||||
|
||||
Reference in new issue
Block a user