Fix: Karte lädt wieder + safe_media_path + Foto-Löschung (SW by-v932)
- map.js: appState→_appState im Template, addEventListener mit ?. (kein Crash ohne Buttons) - media_utils.py: safe_media_path lstrip-Bug — 'dogs/' wurde zu 'ogs/' gekürzt; jetzt korrekte removeprefix-Logik → Altes Hundeprofil-Foto wird jetzt wirklich gelöscht
This commit is contained in:
parent
e7b6cb3c33
commit
781e3383bd
5 changed files with 12 additions and 7 deletions
|
|
@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request):
|
||||||
raise _HE(404, "Nicht gefunden.")
|
raise _HE(404, "Nicht gefunden.")
|
||||||
return _media_response(filepath)
|
return _media_response(filepath)
|
||||||
|
|
||||||
APP_VER = "931" # muss mit APP_VER in app.js übereinstimmen
|
APP_VER = "932" # muss mit APP_VER in app.js übereinstimmen
|
||||||
|
|
||||||
@app.get("/.well-known/assetlinks.json")
|
@app.get("/.well-known/assetlinks.json")
|
||||||
async def assetlinks():
|
async def assetlinks():
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,12 @@ def safe_media_path(media_dir: str, url: str) -> str | None:
|
||||||
Konstruiert einen sicheren Dateipfad aus einer gespeicherten URL.
|
Konstruiert einen sicheren Dateipfad aus einer gespeicherten URL.
|
||||||
Gibt None zurück wenn der Pfad außerhalb von media_dir liegt (Path-Traversal-Schutz).
|
Gibt None zurück wenn der Pfad außerhalb von media_dir liegt (Path-Traversal-Schutz).
|
||||||
"""
|
"""
|
||||||
relative = url.lstrip("/media/").lstrip("/")
|
if url.startswith("/media/"):
|
||||||
|
relative = url[len("/media/"):]
|
||||||
|
elif url.startswith("/"):
|
||||||
|
relative = url[1:]
|
||||||
|
else:
|
||||||
|
relative = url
|
||||||
candidate = os.path.realpath(os.path.join(media_dir, relative))
|
candidate = os.path.realpath(os.path.join(media_dir, relative))
|
||||||
real_base = os.path.realpath(media_dir)
|
real_base = os.path.realpath(media_dir)
|
||||||
if not candidate.startswith(real_base + os.sep) and candidate != real_base:
|
if not candidate.startswith(real_base + os.sep) and candidate != real_base:
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '931'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '932'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt
|
||||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||||
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
// Cache-Bust-Parameter nach Update-Reload sofort entfernen
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ window.Page_map = (() => {
|
||||||
|
|
||||||
<div class="map-fabs">
|
<div class="map-fabs">
|
||||||
<button class="map-fab map-fab--pin" id="map-pin-btn" title="Marker setzen"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#push-pin"></use></svg></button>
|
<button class="map-fab map-fab--pin" id="map-pin-btn" title="Marker setzen"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#push-pin"></use></svg></button>
|
||||||
${App.hasPro(appState?.user) ? `
|
${App.hasPro(_appState?.user) ? `
|
||||||
<button class="map-fab" id="map-radar-btn" title="Regenradar ein-/ausblenden"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#cloud-rain"></use></svg></button>
|
<button class="map-fab" id="map-radar-btn" title="Regenradar ein-/ausblenden"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#cloud-rain"></use></svg></button>
|
||||||
<button class="map-fab" id="map-temp-btn" title="Temperatur ein-/ausblenden"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#thermometer"></use></svg></button>
|
<button class="map-fab" id="map-temp-btn" title="Temperatur ein-/ausblenden"><svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#thermometer"></use></svg></button>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
@ -291,8 +291,8 @@ window.Page_map = (() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('map-pin-btn').addEventListener('click', _togglePlacementMode);
|
document.getElementById('map-pin-btn').addEventListener('click', _togglePlacementMode);
|
||||||
document.getElementById('map-radar-btn').addEventListener('click', _toggleRadar);
|
document.getElementById('map-radar-btn')?.addEventListener('click', _toggleRadar);
|
||||||
document.getElementById('map-temp-btn').addEventListener('click', _toggleTemp);
|
document.getElementById('map-temp-btn')?.addEventListener('click', _toggleTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v931';
|
const CACHE_VERSION = 'by-v932';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue