Files
TREK/client/src/repo/valhallaRelayRepo.ts
T
Maurice 091ebed8e4 feat(routing): let the admin pick FOSSGIS, the TREK services or an own Valhalla
routing_valhalla_provider (fossgis, trek or custom) sits beside the routing
URLs under Admin, Default user settings, admin only and locked on a managed
install. Without a choice an own Valhalla is custom, an own OSRM alone asks
no Valhalla, and otherwise the TREK services answer.

The planner asks them through the same-origin relay, so no connect-src
changes. A relay that answers 401 (a shared page without a sign-in), 403,
413, 429 or 5xx sends the question to FOSSGIS without a word and is left
alone for ten minutes. A long line to describe goes as a polyline.
2026-10-29 13:34:28 +01:00

15 lines
680 B
TypeScript

import { compactValhallaRequest, type ValhallaRelayAction } from '@trek/shared';
import { postValhallaRelay } from '../api/valhallaRelay';
/**
* Routing through the TREK services. **Deliberately online-only and without a
* Dexie table:** a route is asked for while planning, and the routes worth
* keeping are kept by the route cache, whichever router drew them. A line to
* describe goes as a polyline, which keeps a long one under the relay's limit.
*/
export const valhallaRelayRepo = {
ask(action: ValhallaRelayAction, body: object, signal?: AbortSignal): Promise<Response> {
return postValhallaRelay(action, compactValhallaRequest(action, body), signal);
},
};