Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
# - /mask, /mask/rename, /mask/delete : Body(...) explicite => plus de 422 silencieux
|
5 |
# - Bouton "Enregistrer masque" : erreurs visibles (alert) si l’API ne répond pas OK
|
6 |
from fastapi import FastAPI, UploadFile, File, HTTPException, Request, Body, Response
|
7 |
-
from fastapi.responses
|
8 |
-
from fastapi.staticfiles
|
9 |
from pathlib import Path
|
10 |
from typing import Optional, Dict, Any
|
11 |
import uuid, shutil, cv2, json, time, urllib.parse, sys
|
@@ -264,12 +264,12 @@ def _gen_thumbs_background(video: Path, vid_stem: str):
|
|
264 |
def root():
|
265 |
return {
|
266 |
"ok": True,
|
267 |
-
"routes": ["/", "/health", "/files", "/upload", "/meta/{vid}", "/frame_idx", "/poster/{vid}", "/window/{vid}", "/mask", "/mask/{vid}", "/mask/rename", "/mask/delete", "/progress/{vid_stem}", "/ui"
|
268 |
}
|
269 |
@app.get("/health", tags=["meta"])
|
270 |
def health():
|
271 |
return {"status": "ok"}
|
272 |
-
@app.get("/_env", tags=["meta"])
|
273 |
def env_info():
|
274 |
return {"pointer_set": bool(POINTER_URL), "resolved_base": get_backend_base()}
|
275 |
@app.get("/files", tags=["io"])
|
@@ -468,7 +468,7 @@ HTML_TEMPLATE = r"""
|
|
468 |
#tl-progress-fill{background:#2563eb;height:100%;width:0;border-radius:4px}
|
469 |
#popup {position:fixed;top:20%;left:50%;transform:translate(-50%, -50%);background:#fff;padding:20px;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000;display:none;min-width:320px}
|
470 |
#popup-progress-bar{background:#f3f4f6;border-radius:4px;height:8px;margin:10px 0}
|
471 |
-
#popup-progress-fill{background:#2563eb;height:100%;width
|
472 |
#popup-logs {max-height:200px;overflow:auto;font-size:12px;color:#6b7280}
|
473 |
.playhead{position:absolute;top:0;bottom:0;width:2px;background:var(--active-border);opacity:.9;pointer-events:none;display:block}
|
474 |
#portionBand{position:absolute;top:0;height:calc(var(--thumbH,110px) + 24px);background:rgba(37,99,235,.12);pointer-events:none;display:none}
|
@@ -848,7 +848,7 @@ function addThumb(idx, place='append'){
|
|
848 |
const label=document.createElement('span'); label.className='thumb-label'; label.textContent = `#${idx+1}`;
|
849 |
wrap.appendChild(label);
|
850 |
if(place==='append'){ tlBox.appendChild(wrap); }
|
851 |
-
else if(place
|
852 |
else{ tlBox.appendChild(wrap); }
|
853 |
thumbEls.set(idx, wrap);
|
854 |
}
|
|
|
4 |
# - /mask, /mask/rename, /mask/delete : Body(...) explicite => plus de 422 silencieux
|
5 |
# - Bouton "Enregistrer masque" : erreurs visibles (alert) si l’API ne répond pas OK
|
6 |
from fastapi import FastAPI, UploadFile, File, HTTPException, Request, Body, Response
|
7 |
+
from fastapi.responses import HTMLResponse, FileResponse, RedirectResponse # Corrigé : import au lieu de =
|
8 |
+
from fastapi.staticfiles import StaticFiles
|
9 |
from pathlib import Path
|
10 |
from typing import Optional, Dict, Any
|
11 |
import uuid, shutil, cv2, json, time, urllib.parse, sys
|
|
|
264 |
def root():
|
265 |
return {
|
266 |
"ok": True,
|
267 |
+
"routes": ["/", "/health", "/files", "/upload", "/meta/{vid}", "/frame_idx", "/poster/{vid}", "/window/{vid}", "/mask", "/mask/{vid}", "/mask/rename", "/mask/delete", "/progress/{vid_stem}", "/ui"]
|
268 |
}
|
269 |
@app.get("/health", tags=["meta"])
|
270 |
def health():
|
271 |
return {"status": "ok"}
|
272 |
+
@app.get("/_env", tags=["meta"])
|
273 |
def env_info():
|
274 |
return {"pointer_set": bool(POINTER_URL), "resolved_base": get_backend_base()}
|
275 |
@app.get("/files", tags=["io"])
|
|
|
468 |
#tl-progress-fill{background:#2563eb;height:100%;width:0;border-radius:4px}
|
469 |
#popup {position:fixed;top:20%;left:50%;transform:translate(-50%, -50%);background:#fff;padding:20px;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000;display:none;min-width:320px}
|
470 |
#popup-progress-bar{background:#f3f4f6;border-radius:4px;height:8px;margin:10px 0}
|
471 |
+
#popup-progress-fill{background:#2563eb;height:100%;width=0;border-radius:4px}
|
472 |
#popup-logs {max-height:200px;overflow:auto;font-size:12px;color:#6b7280}
|
473 |
.playhead{position:absolute;top:0;bottom:0;width:2px;background:var(--active-border);opacity:.9;pointer-events:none;display:block}
|
474 |
#portionBand{position:absolute;top:0;height:calc(var(--thumbH,110px) + 24px);background:rgba(37,99,235,.12);pointer-events:none;display:none}
|
|
|
848 |
const label=document.createElement('span'); label.className='thumb-label'; label.textContent = `#${idx+1}`;
|
849 |
wrap.appendChild(label);
|
850 |
if(place==='append'){ tlBox.appendChild(wrap); }
|
851 |
+
else if(place==='prepend'){ tlBox.insertBefore(wrap, tlBox.firstChild); }
|
852 |
else{ tlBox.appendChild(wrap); }
|
853 |
thumbEls.set(idx, wrap);
|
854 |
}
|