summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
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:26:29 +0200
commit55006ffc3b5c66d51636853e15fa702da5185dc9 (patch)
tree58018cbd522ef311265716db4669259273a64141 /ishtar_common
parentd7d12938b8d29c1ac94aaf1f8b44b5a36f985dc1 (diff)
downloadIshtar-55006ffc3b5c66d51636853e15fa702da5185dc9.tar.bz2
Ishtar-55006ffc3b5c66d51636853e15fa702da5185dc9.zip
🐛 force referrerPolicy for OpenStreetMap tile access
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/static/gis/js/OLMapWidget.js14
-rw-r--r--ishtar_common/static/js/ishtar-map.js12
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 ec11244a0..3b2bed785 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -191,7 +191,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);
};