maps icon indicating copy to clipboard operation
maps copied to clipboard

using a non-default tile.

Open berlin2123 opened this issue 1 year ago • 0 comments

Issue In some countries or regions, *.openstreetmap.org is Blocked by ISP, which can prevent the map from loading.

Solution I am using in maps version 1.2.0 Just using anoter tile server, such as tile.openstreetmap.de, by changing the js file:

# Edit <nextcloud_path>/apps/maps/js/maps-main.js
# Change
......{id:"osm",name:"Street map",type:Mt,url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",......
# to
......{id:"osm",name:"Street map",type:Mt,url:"https://tile.openstreetmap.de/{z}/{x}/{y}.png",......

It works fine in 1.2.0 and nextcloud 27.

Issue in maps version 1.4.0 However after update to 1.4.0, this kind of edit js file no longer work, Refused by CSP in browser :

Refused to load the image 'https://tile.openstreetmap.de/2/1/1.png' because it violates the following Content Security Policy directive:

I tried to add tile.openstreetmap.de into csp by

# Edit <nextcloud_path>/apps/maps/lib/Controller/PublicPageController.php
# add a new line in line 217:
            $csp->addAllowedImageDomain('https://*.tile.openstreetmap.org');
            $csp->addAllowedImageDomain('https://tile.openstreetmap.de');                             # new added line
            $csp->addAllowedImageDomain('https://server.arcgisonline.com');

However it still not work.

Describe alternatives you've considered Official support for custom tile servers

Additional context Is it possible to fix the csp issue before the custom tile is officially supported?

berlin2123 avatar Sep 03 '24 01:09 berlin2123