Maps.xdc how to change the map provider?

Because tile.openstreetmap.org is blocked here, I want to change the map provider. I cloned the code and modified one of the links. I tried several links, and they all worked fine when loading the web page, but after generating the webxdc and opening it in DeltaChat, the map does not display. Why is that ?Does anyone know how to fix this?

  1. This is where I made the changes in index.js
//L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
//L.tileLayer('http://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png', {
//L.tileLayer('https://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', {
L.tileLayer('https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
        maxZoom: 19,
        attribution: "© OpenStreetMap"
    }).addTo(map);

some of the links come from http://openwhatevermap.xyz

  1. It works in the browser.
  2. It does not work properly in DeltaChat.

some error log

Refused to load the image 'https://a.tile.openstreetmap.de/3/3/3.png' because it violates the following Content Security Policy directive: "img-src 'self' data: blob:".

normal .xdc are not allowed to access the internet at all. we consider to add an option to replace the .xdc in the near future (which is obviously a great feature!) - but we’re not there

It’s another layer of sandboxing that you need to adjust:

yes, if one wants alternative maps now, adjusting this is a way to go forward, however requires to build desktop on its own.

for the next version, things may become easier then.

Great,i will try~ many thanks

That’s great, looking forward to the next version! :star_struck:

In the desktop client successfully, thank you!

I used the domain name .de.

Now there is a question, if I compile an Android client myself, is there a similar problem to deal with? I did a simple search and found no similar code.Can you give me one more hint?

1 Like

android has less sandboxing, so changing the map.xdc should be sufficient

When I modified the maps.xdc file (replaced the map link), before running npm run build again, I executed npm run clean. However, after compiling the resulting .exe file, when I opened the map, it still showed the previous xdc effect. What’s more puzzling is that when I opened a second account, the map was still from openstreetmap.org. I find this quite strange; what could be the reason?

I encountered a similar issue on the Android client as well. Although I successfully compiled the APK, it appears that the modified maps.xdc file was not being utilized.

When I logged in with a brand new account (the phenomenon is the same on both the Android client and the desktop client), I finally used the latest modified maps.xdc file. I suspect that the maps.xdc might be cached on the mail server. Is this correct? If so, how can I clear the cache to ensure it uses the new maps.xdc file?

After deleting my Profile, I was able to use the new version of maps.xdc, as shown below. However, this also resulted in the loss of my previous keys and chat history. While the impact seems minimal at present, it would be preferable if there were a more precise way to utilize the new maps.xdc without affecting other information associated with the account.

image

I have found a solution. First, backup the current account, then replace the maps.xdc within the backed up tar file. After that, delete the account, and finally import the backup. This perfectly resolves the issue.

@r10s
It appears that this could be a viable approach for users to employ their own modified version of maps.xdc with the current DeltaChat version. On the desktop version, there may be DNS issues that require recompiling the executable file; however, on mobile devices, it seems that the changes can be implemented immediately.

1 Like

its cached in the local account data, more specifically the blobs directory

Thank you. So I realized why I had emptied all the local caches before, but it still didn’t work. Because after I emptied, I imported my backup, and there was maps. Xdc in the backup, which made me a little embarrassed, hahaha.