From: Tom Hughes Date: Thu, 13 Oct 2022 18:12:07 +0000 (+0100) Subject: Allow credentials to be sent with overpass calls X-Git-Tag: live~1465 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a9063f8369c7beba85bfe376912bfd965888f290 Allow credentials to be sent with overpass calls --- diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 4b58e6f93..d1668f247 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -3,6 +3,7 @@ OSM.Query = function (map) { var url = OSM.OVERPASS_URL, + credentials = OSM.OVERPASS_CREDENTIALS, queryButton = $(".control-query .control-button"), uninterestingTags = ["source", "source_ref", "source:ref", "history", "attribution", "created_by", "tiger:county", "tiger:tlid", "tiger:upload_uuid", "KSJ2:curve_id", "KSJ2:lat", "KSJ2:lon", "KSJ2:coordinate", "KSJ2:filename", "note:ja"], marker; @@ -181,6 +182,9 @@ OSM.Query = function (map) { data: { data: "[timeout:10][out:json];" + query }, + xhrFields: { + withCredentials: credentials + }, success: function (results) { var elements; diff --git a/app/assets/javascripts/osm.js.erb b/app/assets/javascripts/osm.js.erb index 3290b5e2c..352f5d48c 100644 --- a/app/assets/javascripts/osm.js.erb +++ b/app/assets/javascripts/osm.js.erb @@ -14,6 +14,7 @@ OSM = { STATUS: <%= Settings.status.to_json %>, MAX_NOTE_REQUEST_AREA: <%= Settings.max_note_request_area.to_json %>, OVERPASS_URL: <%= Settings.overpass_url.to_json %>, + OVERPASS_CREDENTIALS: <%= Settings.overpass_credentials.to_json %>, NOMINATIM_URL: <%= Settings.nominatim_url.to_json %>, GRAPHHOPPER_URL: <%= Settings.graphhopper_url.to_json %>, FOSSGIS_OSRM_URL: <%= Settings.fossgis_osrm_url.to_json %>, diff --git a/config/settings.yml b/config/settings.yml index 9ff8a653b..09672c2c3 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -95,6 +95,7 @@ imagery_blacklist: - ".*\\.here\\.com[/:].*" # URL of Overpass instance to use for feature queries overpass_url: "https://overpass-api.de/api/interpreter" +overpass_credentials: false # Routing endpoints graphhopper_url: "https://graphhopper.com/api/1/route" fossgis_osrm_url: "https://routing.openstreetmap.de/"