Add a folder button that opens the storage folder in Finder

This commit is contained in:
Justin Oros
2026-09-21 15:06:21 -07:00
parent c4395751b3
commit ff2cfa6dcf
2 changed files with 20 additions and 1 deletions
+15
View File
@@ -2032,6 +2032,21 @@ def api_clear_history():
return {"ok": True, "cleared": count} 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") @app.get("/api/trending")
def api_trending(): def api_trending():
try: try:
+5 -1
View File
@@ -175,6 +175,9 @@ input:disabled,select:disabled{opacity:.55}
#log .ERROR,#log .CRITICAL{color:var(--coral)} #log .ERROR,#log .CRITICAL{color:var(--coral)}
#log .WARNING{color:var(--amber)} #log .WARNING{color:var(--amber)}
#log .DEBUG{color:var(--faint)} #log .DEBUG{color:var(--faint)}
.storage-line{display:flex;align-items:center;gap:8px;margin-top:18px;flex-wrap:wrap}
.icon-btn.folder{width:30px;height:30px}
.icon-btn.folder:hover{color:var(--gold-text)}
.tools{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:0 0 22px} .tools{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:0 0 22px}
.tools .status{font-size:14px;color:var(--muted)} .tools .status{font-size:14px;color:var(--muted)}
#trending-panel{margin:0 0 24px} #trending-panel{margin:0 0 24px}
@@ -235,7 +238,7 @@ main{padding:20px 16px 120px}
</div> </div>
</div> </div>
<div class="table-wrap"><table id="jobs"></table></div> <div class="table-wrap"><table id="jobs"></table></div>
<p class="muted small" id="st-storage" style="margin-top:18px"></p> <p class="storage-line muted small"><span id="st-storage"></span><button class="icon-btn folder" id="open-folder" aria-label="Show the videos folder in Finder" title="Show in Finder"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg></button><span id="folder-msg"></span></p>
</section> </section>
<section id="settings" class="tab"> <section id="settings" class="tab">
<div class="settings"> <div class="settings">
@@ -498,6 +501,7 @@ if(!confirm("Unlink the YouTube channel from this profile?"))return;
await api("/auth/unlink",{method:"POST"});lastChannel="";await loadSettings();refresh()} await api("/auth/unlink",{method:"POST"});lastChannel="";await loadSettings();refresh()}
else{window.location.href="/auth/start"}} else{window.location.href="/auth/start"}}
$("#save").onclick=saveSettings; $("#save").onclick=saveSettings;
$("#open-folder").onclick=async()=>{const m=$("#folder-msg");try{await api("/api/open-storage",{method:"POST"});m.textContent=""}catch(e){m.textContent=e.message}};
$("#clear").onclick=()=>{$("#log").innerHTML=""}; $("#clear").onclick=()=>{$("#log").innerHTML=""};
$("#copy-log").onclick=async()=>{ $("#copy-log").onclick=async()=>{
const text=$("#log").innerText.trim();const m=$("#copy-msg"); const text=$("#log").innerText.trim();const m=$("#copy-msg");