diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-05-20 11:23:50 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-05-20 11:23:50 +0200 |
| commit | 00e400221479ce0236640f750177309097cb622b (patch) | |
| tree | a0c0b05c088a516f5f6a7b29817b4a8cc484f087 /ishtar_common/static | |
| parent | daf76f988a5327cc9ed6c9dbceb3c6886a75e93a (diff) | |
| download | Ishtar-00e400221479ce0236640f750177309097cb622b.tar.bz2 Ishtar-00e400221479ce0236640f750177309097cb622b.zip | |
🐛 force referrerPolicy for OpenStreetMap tile access
Diffstat (limited to 'ishtar_common/static')
| -rw-r--r-- | ishtar_common/static/gis/js/OLMapWidget.js | 14 | ||||
| -rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 12 |
2 files changed, 24 insertions, 2 deletions
diff --git a/ishtar_common/static/gis/js/OLMapWidget.js b/ishtar_common/static/gis/js/OLMapWidget.js index 22047b86d..bdc34593c 100644 --- a/ishtar_common/static/gis/js/OLMapWidget.js +++ b/ishtar_common/static/gis/js/OLMapWidget.js @@ -179,7 +179,19 @@ ol_ext_inherits(GeometryTypeControl, ol.control.Control); } } if (!options.base_layer) { - this.options.base_layer = new ol.layer.Tile({source: new ol.source.OSM()}); + this.options.base_layer = new ol.layer.Tile({ + source: new ol.source.OSM({ + // remove in when switching to OL>= 10.6.1 -> new ol.source.OSM() + tileLoadFunction: (imageTile, src) => { + const img = imageTile.getImage(); + // Set the per-image referrer policy before assigning the src + if (img && 'referrerPolicy' in img) { + img.referrerPolicy = 'origin-when-cross-origin'; + } + img.src = src; + } + }) + }); } this.map = this.createMap(); diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js index 46a31c28e..b28f5fe0e 100644 --- a/ishtar_common/static/js/ishtar-map.js +++ b/ishtar_common/static/js/ishtar-map.js @@ -192,7 +192,17 @@ var TrackPositionControl = (function (Control) { /* base layers */ var source_osm = function(options){ - options["source"] = new ol.source.OSM(); + options["source"] = new ol.source.OSM({ + // remove in when switching to OL>= 10.6.1 -> new ol.source.OSM() + tileLoadFunction: (imageTile, src) => { + const img = imageTile.getImage(); + // Set the per-image referrer policy before assigning the src + if (img && 'referrerPolicy' in img) { + img.referrerPolicy = 'origin-when-cross-origin'; + } + img.src = src; + } + }); return new ol.layer.Tile(options); }; |
