]> git.openstreetmap.org Git - rails.git/commitdiff
Use XHR instead of jsonp for GraphHopper
authorPeter Karich <graphhopper@gmx.de>
Thu, 17 May 2018 19:47:58 +0000 (20:47 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 17 May 2018 19:47:58 +0000 (20:47 +0100)
Closes #1872

app/assets/javascripts/index/directions/graphhopper.js
app/controllers/application_controller.rb

index f05f1ab3dfb761336a471ce49f542edd4965af60..ce568409d5052628aa8532b148ab56354ca88849 100644 (file)
@@ -27,13 +27,12 @@ function GraphHopperEngine(id, vehicleType) {
           locale: I18n.currentLocale(),
           key: "LijBPDQGfu7Iiq80w3HzwB4RUDJbMbhs6BU0dEnn",
           "ch.disable": vehicleType === "car",
-          type: "jsonp",
           elevation: false,
           instructions: true,
           point: points.map(function (p) { return p.lat + "," + p.lng; })
         },
         traditional: true,
-        dataType: "jsonp",
+        dataType: "json",
         success: function (data) {
           if (!data.paths || data.paths.length === 0)
             return callback(true);
index b8a50eb780e40b0da80a9b27c5ad1e9a29566741..1625c81c15d4d188049c7307bbbaef8e1ca15f3b 100644 (file)
@@ -411,9 +411,9 @@ class ApplicationController < ActionController::Base
     append_content_security_policy_directives(
       :child_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
       :frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112],
-      :connect_src => %w[nominatim.openstreetmap.org overpass-api.de router.project-osrm.org],
+      :connect_src => %w[nominatim.openstreetmap.org overpass-api.de router.project-osrm.org graphhopper.com],
       :form_action => %w[render.openstreetmap.org],
-      :script_src => %w[graphhopper.com open.mapquestapi.com],
+      :script_src => %w[open.mapquestapi.com],
       :img_src => %w[developer.mapquest.com]
     )