commit 06adc7dc392b6f5120a80e3c44942086f778c5ba
parent c952cfdca2b83d86c9b441d630cf55dda1b893fb
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Tue, 10 Jan 2023 18:44:13 +0100
search: use API key and new endpoint
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lib/leaflet.control.search/providers/mapycz/index.js b/src/lib/leaflet.control.search/providers/mapycz/index.js
@@ -1,5 +1,6 @@
import L from 'leaflet';
+import config from '~/config';
import * as logging from '~/lib/logging';
import {fetch} from '~/lib/xhr-promise';
@@ -13,7 +14,7 @@ const MapyCzProvider = BaseProvider.extend({
name: 'Mapy.cz',
options: {
- apiUrl: 'https://api.mapy.cz/suggest/',
+ apiUrl: 'https://api.mapy.cz/v0/suggest/',
attribution: {
text: 'Mapy.cz',
url: 'https://mapy.cz',
@@ -31,6 +32,7 @@ const MapyCzProvider = BaseProvider.extend({
this.options.categoriesLanguages,
this.options.defaultLanguage
)[0];
+ this.apiKey = config.mapyCz;
},
search: async function (query, {latlng, zoom}) {
@@ -46,6 +48,7 @@ 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});
diff --git a/src/secrets.js.template b/src/secrets.js.template
@@ -4,7 +4,8 @@ const secrets = {
sentryDSN: 'https://00000000000000000000000000000000@sentry.io/111111',
mapillary4: 'MLY|1111111111111111|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
flickr: '00000000000000000000000000000000',
- google: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+ google: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
+ mapyCz: 'eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};
export default secrets;