Add a folder button that opens the storage folder in Finder

This commit is contained in:
justin committed 2026-09-21 15:06:21 -07:00
1 parent c4395751b3
commit ff2cfa6dcf
2 files changed
+20 -1

No files matched your search

+15
View File
@@ -2032,6 +2032,21 @@ def api_clear_history():
return {"ok": True, "cleared": count}
@app.post("/api/open-storage")
def api_open_storage():
root = resolve_storage(load_global()["storage_dir"])
if not root.exists():
return JSONResponse({"detail": f"{root} does not exist yet. It is created when the first job runs"}, status_code=400)
opener = "open" if sys.platform == "darwin" else shutil.which("xdg-open")
if not opener:
return JSONResponse({"detail": "No file browser is available on this machine"}, status_code=400)
try:
subprocess.Popen([opener, str(root)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except OSError as e:
return JSONResponse({"detail": f"Could not open the folder: {e}"}, status_code=400)
return {"ok": True}
@app.get("/api/trending")
def api_trending():
try: