server sided external api calls (#697)

* server sided external api calls

* fix uploading gpx files

* rename api/v1/nominatim with api/v1/geocoding to prepare photon support

* remove NOMINATIM_MAX_RETRIES (side-kick from other PR)

* re-add nominatim url fallback

* docu, env var defaults and fallbacks, docker compose files

* refactor

* furhter refactorings and fixes

* PUBLIC_VALHALLA_ENABLED in docker compose files added

* fix env var names

---------

Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
slothful-vassal
2026-04-28 18:19:06 +02:00
committed by GitHub
parent 7bdf0d3151
commit 85e5fb6df7
21 changed files with 391 additions and 100 deletions

View File

@@ -1,5 +1,4 @@
<script lang="ts">
import { env } from "$env/dynamic/public";
import Button from "$lib/components/base/button.svelte";
import Datepicker from "$lib/components/base/datepicker.svelte";
import Select from "$lib/components/base/select.svelte";
@@ -124,6 +123,13 @@
let gpxFile: File | Blob | null = null;
let drawingActive = $state(false);
function routeCalculationErrorText(error: unknown) {
if (error instanceof Error && error.message) {
return error.message;
}
return "Error calculating route";
}
let overwriteGPX = false;
let draggingMarker = false;
@@ -660,7 +666,7 @@
} catch (e) {
console.error(e);
show_toast({
text: "Error calculating route",
text: routeCalculationErrorText(e),
icon: "close",
type: "error",
});
@@ -832,7 +838,7 @@
} catch (e) {
console.error(e);
show_toast({
text: "Error calculating route",
text: routeCalculationErrorText(e),
icon: "close",
type: "error",
});
@@ -882,7 +888,7 @@
} catch (e) {
console.error(e);
show_toast({
text: "Error calculating route",
text: routeCalculationErrorText(e),
icon: "close",
type: "error",
});
@@ -1219,32 +1225,30 @@
? $_("upload-new-file")
: $_("upload-file")}</Button
>
{#if env.PUBLIC_VALHALLA_URL}
<div class="flex gap-4 items-center w-full">
<hr class="basis-full border-input-border" />
<span class="text-gray-500 uppercase">{$_("or")}</span>
<hr class="basis-full border-input-border" />
</div>
<button
class="btn-primary"
type="button"
onclick={async () => {
if (drawingActive) {
await stopDrawing();
} else {
startDrawing();
}
}}
>
{$formData.expand?.gpx_data
? drawingActive
? $_("stop-editing")
: $_("edit-route")
: drawingActive
? $_("stop-drawing")
: $_("draw-a-route")}</button
>
{/if}
<div class="flex gap-4 items-center w-full">
<hr class="basis-full border-input-border" />
<span class="text-gray-500 uppercase">{$_("or")}</span>
<hr class="basis-full border-input-border" />
</div>
<button
class="btn-primary"
type="button"
onclick={async () => {
if (drawingActive) {
await stopDrawing();
} else {
startDrawing();
}
}}
>
{$formData.expand?.gpx_data
? drawingActive
? $_("stop-editing")
: $_("edit-route")
: drawingActive
? $_("stop-drawing")
: $_("draw-a-route")}</button
>
<input
type="file"
name="gpx"