Skip to content

Commit f6a602f

Browse files
author
Peter
committed
disallow specifying foreign host as it could be a security issue in combination with jsonp
1 parent 06d44ac commit f6a602f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

web/src/main/webapp/js/main.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
* to the URL or overwrite the 'host' variable.
55
*/
66
var tmpArgs = parseUrlWithHisto();
7-
var host = tmpArgs["host"];
8-
// var host = "http://graphhopper.com/api/1";
9-
if (!host) {
10-
if (location.port === '') {
11-
host = location.protocol + '//' + location.hostname;
12-
} else {
13-
host = location.protocol + '//' + location.hostname + ":" + location.port;
14-
}
7+
var host;
8+
9+
if (location.port === '') {
10+
host = location.protocol + '//' + location.hostname;
11+
} else {
12+
host = location.protocol + '//' + location.hostname + ":" + location.port;
1513
}
1614

1715
var ghRequest = new GHRequest(host);
@@ -116,7 +114,7 @@ $(document).ready(function(e) {
116114

117115
if (json.features) {
118116
ghRequest.features = json.features;
119-
117+
120118
var vehicles = Object.keys(json.features);
121119
if (vehicles.length > 0)
122120
ghRequest.initVehicle(vehicles[0]);
@@ -291,14 +289,14 @@ function initMap() {
291289
"OpenStreetMap": osm,
292290
"OpenStreetMap.de": osmde
293291
};
294-
292+
295293
L.control.layers(baseMaps/*, overlays*/).addTo(map);
296294

297295
L.control.scale().addTo(map);
298296

299297
map.fitBounds(new L.LatLngBounds(new L.LatLng(bounds.minLat, bounds.minLon),
300298
new L.LatLng(bounds.maxLat, bounds.maxLon)));
301-
if(isProduction())
299+
if (isProduction())
302300
map.setView(new L.LatLng(0, 0), 2);
303301

304302
map.attributionControl.setPrefix('');

0 commit comments

Comments
 (0)