From 3d87d9413bc46894922b0a0924fd00ff220d4c2a Mon Sep 17 00:00:00 2001 From: Sergej Orlov Date: Sat, 7 Dec 2024 23:02:59 +0100 Subject: [PATCH] search: restore mapy.cz --- src/lib/leaflet.control.search/index.js | 2 +- src/lib/leaflet.control.search/providers/mapycz/index.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/leaflet.control.search/index.js b/src/lib/leaflet.control.search/index.js index de3324e93..95e8f7c2b 100644 --- a/src/lib/leaflet.control.search/index.js +++ b/src/lib/leaflet.control.search/index.js @@ -215,7 +215,7 @@ const SearchControl = L.Control.extend({ includes: L.Mixin.Events, options: { - provider: 'photon', + provider: 'mapycz', providerOptions: { maxResponses: 5, }, diff --git a/src/lib/leaflet.control.search/providers/mapycz/index.js b/src/lib/leaflet.control.search/providers/mapycz/index.js index c356f1df2..a35c107ad 100644 --- a/src/lib/leaflet.control.search/providers/mapycz/index.js +++ b/src/lib/leaflet.control.search/providers/mapycz/index.js @@ -1,6 +1,6 @@ import L from 'leaflet'; -import config from '~/config'; +import urlViaCorsProxy from '~/lib/CORSProxy'; import * as logging from '~/lib/logging'; import {fetch} from '~/lib/xhr-promise'; @@ -14,7 +14,7 @@ const MapyCzProvider = BaseProvider.extend({ name: 'Mapy.cz', options: { - apiUrl: 'https://api.mapy.cz/v0/suggest/', + apiUrl: urlViaCorsProxy('https://pro.mapy.cz/suggest/'), attribution: { text: 'Mapy.cz', url: 'https://mapy.cz', @@ -32,7 +32,6 @@ const MapyCzProvider = BaseProvider.extend({ this.options.categoriesLanguages, this.options.defaultLanguage )[0]; - this.apiKey = config.mapyCz; }, search: async function (query, {latlng, zoom}) { @@ -48,7 +47,6 @@ const MapyCzProvider = BaseProvider.extend({ if (this.options.maxResponses) { url.searchParams.append('count', this.options.maxResponses); } - url.searchParams.append('apikey', this.apiKey); let xhr; try { xhr = await fetch(url.href, {responseType: 'json', timeout: 5000});