From 95c7286c3e12d69428db71cd8ded2499dbb185aa Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sat, 1 Aug 2026 06:40:37 +0200 Subject: [PATCH] Set map share link targets from the template --- app/assets/javascripts/leaflet.map.js | 12 ------------ app/views/directions/show.html.erb | 3 ++- app/views/share_panes/show.html.erb | 9 +++++---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index 17221a531..1087f20e7 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -147,8 +147,6 @@ L.OSM.Map = L.Map.extend({ } return { - protocol: location.protocol, - hostname: OSM.SERVER_URL, pathname: "/", search, hash: OSM.formatHash(this) @@ -166,8 +164,6 @@ L.OSM.Map = L.Map.extend({ // and drops the last 4 bits of the full 64 bit Morton code. c1 = interlace(x >>> 17, y >>> 17), c2 = interlace((x >>> 2) & 0x7fff, (y >>> 2) & 0x7fff); - const protocol = location.protocol, - hostname = location.hostname.replace(/^www\.openstreetmap\.org/i, "osm.org"); let pathname = "/go/"; for (let i = 0; i < Math.ceil((zoom + 8) / 3.0) && i < 5; ++i) { @@ -211,17 +207,12 @@ L.OSM.Map = L.Map.extend({ } return { - protocol, - hostname, pathname, search }; }, getEmbedUrl: function (marker) { - const protocol = OSM.SERVER_PROTOCOL + ":", - hostname = OSM.SERVER_URL, - pathname = "/export/embed.html"; const search = new URLSearchParams({ bbox: this.getBounds().toBBoxString(), layer: this.getMapBaseLayerId() @@ -233,9 +224,6 @@ L.OSM.Map = L.Map.extend({ } return { - protocol, - hostname, - pathname, search }; }, diff --git a/app/views/directions/show.html.erb b/app/views/directions/show.html.erb index a9043560c..53ea12a19 100644 --- a/app/views/directions/show.html.erb +++ b/app/views/directions/show.html.erb @@ -61,7 +61,8 @@
- <%= tag.a t(".download"), :id => "directions_route_download", :download => "#{t('.filename')}.geojson" %> + <% file_content_placeholder = 'data:application/geo+json,{"type":"FeatureCollection","features":[]}' %> + <%= tag.a t(".download"), :id => "directions_route_download", :href => file_content_placeholder, :download => "#{t('.filename')}.geojson" %>
diff --git a/app/views/share_panes/show.html.erb b/app/views/share_panes/show.html.erb index 06c530d6d..814bfee82 100644 --- a/app/views/share_panes/show.html.erb +++ b/app/views/share_panes/show.html.erb @@ -5,11 +5,12 @@ <%= label_tag "link_marker", t(".include_marker"), :class => "form-check-label" %> <%= check_box_tag "link_marker", nil, :class => "form-check-input" %> + <% short_link_origin = "#{Settings.server_protocol}://#{Settings.server_url.sub(/\Awww\.openstreetmap\.org/i, 'osm.org')}" %>