auto-sync: 2026-05-03 19:20:01

This commit is contained in:
Stream
2026-05-03 19:20:01 +03:00
parent af496380bf
commit fce78dd2b5

View File

@@ -86,8 +86,10 @@ function toggleLayer(group) {
// ─── Map init ─────────────────────────────────────────────────────────────────
async function initMap() {
const tileBase = window.location.origin;
const style = await fetch('/style.json').then(r => r.json());
// Определяем base path для работы как на корне, так и под /enduro/
const basePath = window.location.pathname.replace(/\/[^/]*$/, '') || '';
const tileBase = window.location.origin + basePath;
const style = await fetch(basePath + '/style.json').then(r => r.json());
style.sources['trails-tiles'].tiles = [`${tileBase}/api/tiles/{z}/{x}/{y}.mvt`];
const map = new maplibregl.Map({
@@ -197,7 +199,7 @@ async function initMap() {
async function checkDataAvailability() {
try {
const resp = await fetch('/api/health');
const resp = await fetch(basePath + '/api/health');
const data = await resp.json();
if (!data.db_exists) {
document.getElementById('no-data-warning').classList.add('visible');