From b8095d68114e99244043133576b4319edf94f07f Mon Sep 17 00:00:00 2001 From: Nicolas <31620323+EinGlasVollKakao@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:09:04 +0100 Subject: [PATCH] Don't escape leaflet tile url in location edit map (#15695) * Don't escape leaflet tile url * encode config as json and get config value in controller * fixed array style --- app/Http/Controllers/LocationController.php | 2 ++ resources/views/locations.blade.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/LocationController.php b/app/Http/Controllers/LocationController.php index 1e8ea4f67f..f42f4f3611 100644 --- a/app/Http/Controllers/LocationController.php +++ b/app/Http/Controllers/LocationController.php @@ -12,9 +12,11 @@ class LocationController extends Controller public function index() { $maps_api = Config::get('geoloc.api_key'); + $maps_config = ['tile_url' => Config::get('leaflet.tile_url', '{s}.tile.openstreetmap.org')]; $data = [ 'maps_api' => $maps_api, 'maps_engine' => $maps_api ? Config::get('geoloc.engine') : '', + 'maps_config' => $maps_config, ]; $data['graph_template'] = ''; diff --git a/resources/views/locations.blade.php b/resources/views/locations.blade.php index 56f0f9e114..f1a3cdf226 100644 --- a/resources/views/locations.blade.php +++ b/resources/views/locations.blade.php @@ -148,7 +148,7 @@ locationId = $btn.data('id'); if (locationMap === null) { - config = {"tile_url": "{{ \LibreNMS\Config::get('leaflet.tile_url', '{s}.tile.openstreetmap.org') }}"}; + config = {{ Js::from($maps_config) }} locationMap = init_map('location-edit-map', '{{ $maps_engine }}', '{{ $maps_api }}', config); locationMarker = init_map_marker(locationMap, location); }