Skip to content

Commit

Permalink
Merge pull request #137 from seanmorley15/development
Browse files Browse the repository at this point in the history
User agent config
  • Loading branch information
seanmorley15 authored Jul 22, 2024
2 parents 58a40f1 + c8ce0e0 commit 8d61a7d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion frontend/src/lib/components/PointSelectionModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const dispatch = createEventDispatcher();
import { onMount } from 'svelte';
let modal: HTMLDialogElement;
import { appVersion } from '$lib/config';
import { DefaultMarker, MapEvents, MapLibre, Popup } from 'svelte-maplibre';
Expand Down Expand Up @@ -55,7 +56,11 @@
alert('Please enter a location');
return;
}
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
headers: {
'User-Agent': `AdventureLog / ${appVersion} `
}
});
console.log(res);
let data = (await res.json()) as OpenStreetMapPlace[];
places = data;
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/routes/search/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { onMount } from 'svelte';
import type { PageData } from './$types';
import EditAdventure from '$lib/components/EditAdventure.svelte';
import { appVersion } from '$lib/config';
export let data: PageData;
Expand All @@ -25,13 +26,21 @@
});
async function fetchData() {
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
headers: {
'User-Agent': `AdventureLog / ${appVersion} `
}
});
const data = await res.json();
osmResults = data;
}
onMount(async () => {
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
headers: {
'User-Agent': `AdventureLog / ${appVersion} `
}
});
const data = await res.json();
osmResults = data;
});
Expand Down

0 comments on commit 8d61a7d

Please sign in to comment.