]> git.openstreetmap.org Git - rails.git/commitdiff
Add https support for overpass
authorTom Hughes <tom@compton.nu>
Tue, 25 Mar 2014 18:43:58 +0000 (18:43 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 25 Mar 2014 18:58:21 +0000 (18:58 +0000)
app/assets/javascripts/index/query.js
config/example.application.yml

index 01a8a1f69e2ed212d4e3383504c6a81b3fbd6669..58750d242c6f5b20f61699bc8d349a8a1dcfa648 100644 (file)
@@ -1,7 +1,9 @@
 //= require jquery.simulate
 
 OSM.Query = function(map) {
 //= require jquery.simulate
 
 OSM.Query = function(map) {
-  var queryButton = $(".control-query .control-button"),
+  var protocol = document.location.protocol === "https:" ? "https:" : "http:",
+    url = protocol + OSM.OVERPASS_URL,
+    queryButton = $(".control-query .control-button"),
     uninterestingTags = ['source', 'source_ref', 'source:ref', 'history', 'attribution', 'created_by', 'tiger:county', 'tiger:tlid', 'tiger:upload_uuid'],
     marker;
 
     uninterestingTags = ['source', 'source_ref', 'source:ref', 'history', 'attribution', 'created_by', 'tiger:county', 'tiger:tlid', 'tiger:upload_uuid'],
     marker;
 
@@ -163,7 +165,7 @@ OSM.Query = function(map) {
     }
 
     $section.data("ajax", $.ajax({
     }
 
     $section.data("ajax", $.ajax({
-      url: OSM.OVERPASS_URL,
+      url: url,
       method: "POST",
       data: {
         data: "[timeout:5][out:json];" + query,
       method: "POST",
       data: {
         data: "[timeout:5][out:json];" + query,
@@ -203,7 +205,7 @@ OSM.Query = function(map) {
         $section.find(".loader").stopTime("loading").hide();
 
         $("<li>")
         $section.find(".loader").stopTime("loading").hide();
 
         $("<li>")
-          .text(I18n.t("javascripts.query." + status, { server: OSM.OVERPASS_URL, error: error }))
+          .text(I18n.t("javascripts.query." + status, { server: url, error: error }))
           .appendTo($ul);
       }
     }));
           .appendTo($ul);
       }
     }));
index 702d411bac5e5371e934391e76118ffa8ac84b9b..7f6aaf298e5165b795a178a5fd5c405a0c05a01e 100644 (file)
@@ -85,7 +85,7 @@ defaults: &defaults
   # Whether to require users to agree to the CTs before editing
   require_terms_agreed: false
   # URL of Overpass instance to use for feature queries
   # Whether to require users to agree to the CTs before editing
   require_terms_agreed: false
   # URL of Overpass instance to use for feature queries
-  overpass_url: http://overpass-api.de/api/interpreter
+  overpass_url: "//overpass-api.de/api/interpreter"
 
 development:
   <<: *defaults
 
 development:
   <<: *defaults