feat(cache): centralize absolute URL generation with PMO_SERVER_URL

Replace hardcoded relative URLs and manual base_url concatenation with a unified absolute URL API via pmocache::covers_absolute_url_for() and CacheTrait::absolute_url_for().

- Add pmocache as a required dependency to pmoparadise
- Introduce absolute_url_for() and covers_absolute_url_for() helpers using PMO_SERVER_URL env var (default: http://localhost:8080)
- Update all callers to use absolute URLs for covers and audio in streaming, playlists, Qobuz, Radio France, UPnP, and server startup
- Remove redundant route_for() usage in URL construction
- Add pmocache to Cargo.lock
This commit is contained in:
2026-03-24 12:02:53 +01:00
parent b690420550
commit 1164a11410
12 changed files with 51 additions and 41 deletions

View File

@@ -251,15 +251,13 @@ impl CachedMetadata {
// Note: add_from_url() lance le téléchargement complet en arrière-plan.
// L'URL est valide immédiatement — si le fichier n'est pas encore prêt,
// le client web doit réessayer (retry avec backoff).
let route = cache.route_for(&pk, None);
let public_url = format!("{}{}", server_base_url.trim_end_matches('/'), route);
let public_url = pmocache::covers_absolute_url_for(&pk, None);
#[cfg(feature = "logging")]
tracing::debug!(
"Cached cover - UUID: {}, PK: {}, route: {}, public_url: {}",
"Cached cover - UUID: {}, PK: {}, public_url: {}",
uuid,
pk,
route,
public_url
);