feat: Offline-Bibliothek + Download-only-Modus

Neuer Modus in der GUI: Image nur herunterladen und dauerhaft unter
./downloads/library/ ablegen, ohne USB-Stick. Baut sich so vorab eine
komplette Offline-Sammlung aller macOS-Versionen auf (z.B. auf externe
Platte kopierbar). Stick-Jobs pruefen jetzt IMMER zuerst die lokale
Bibliothek und ueberspringen den Download bei Treffer -- jeder normale
Stick-Bau traegt so nebenbei zur Bibliothek bei.

Backend: installer.py bekommt job_type (stick|download), persistente
Downloads in library/<name>/ mit meta.json + atomarem .part-Rename,
neue /api/library. Frontend: Modus-Umschalter, Bibliotheks-Status,
Offline-Badges in der Versionsliste.

Live getestet auf aria-wohnung: Container neu gebaut, Katalog laedt 37
Installer, Download-Job End-to-End ueber die echte API (Cache-Miss dann
Cache-Hit verifiziert), Stick-Job-Validierung weiterhin intakt.
This commit is contained in:
ARIA
2026-07-18 10:58:55 +02:00
parent 40964b9130
commit 5c2cdd7543
6 changed files with 307 additions and 46 deletions
+16 -1
View File
@@ -72,20 +72,35 @@ def api_devices():
return jsonify({"items": [], "error": str(exc)}), 500
@app.get("/api/library")
def api_library():
"""Was liegt schon dauerhaft lokal (Offline-Bibliothek), fuer 'nur
herunterladen' Badges + die Groessen-Anzeige in der GUI."""
try:
return jsonify(installer.list_library())
except Exception as exc: # noqa: BLE001
log.exception("library listing failed")
return jsonify({"items": [], "total_bytes": 0, "error": str(exc)}), 500
@app.post("/api/jobs")
def api_create_job():
body = request.get_json(force=True)
product_id = body.get("product_id")
job_type = body.get("job_type", "stick")
device_path = body.get("device_path")
confirm_path = body.get("confirm_device_path")
if job_type not in ("stick", "download"):
return jsonify({"error": "Unbekannter job_type."}), 400
with _catalog_lock:
product = next((p for p in _catalog_cache["items"] if p["id"] == product_id), None)
if not product:
return jsonify({"error": "Unbekannte macOS-Version -- Katalog neu laden."}), 400
try:
job = installer.create_job(product, device_path, confirm_path)
job = installer.create_job(product, device_path, confirm_path, job_type=job_type)
except ValueError as exc:
return jsonify({"error": str(exc)}), 400