Rewrite server: FastAPI + auth (users/roles/tokens) + admin WebUI + server-authoritative covers/metadata
This commit is contained in:
+14
-1
@@ -19,7 +19,7 @@ import urllib.request
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from . import config, sources
|
||||
from . import config, server_client, sources
|
||||
from .db import get_connection
|
||||
|
||||
log = logging.getLogger("covers")
|
||||
@@ -1220,6 +1220,19 @@ def fetch_cover(name, release_id, system, timeout=10, quick=False):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
# Server is authoritative for covers when configured — no libretro/IGDB
|
||||
# fallback; if the server is unreachable the cover just stays empty.
|
||||
if server_client.configured():
|
||||
try:
|
||||
data = server_client.fetch_cover(system, name)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
log.warning("server cover fetch failed for %r: %s", name, exc)
|
||||
return None
|
||||
if data is not None and _is_image(data):
|
||||
_write_atomic(dest, data)
|
||||
return dest
|
||||
return None
|
||||
|
||||
key = str(release_id)
|
||||
# In-memory + persistent negative caches: skip the network for recent misses.
|
||||
last = _neg_cache.get(key)
|
||||
|
||||
Reference in New Issue
Block a user