feat: add folder button to transcript modal

This commit is contained in:
2026-04-02 10:47:08 +02:00
parent 7e0851fc95
commit 348ce332c7
3 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -210,10 +210,10 @@ async def put_config(body: dict, user: dict = Depends(current_user)):
async def open_file(body: dict, user: dict = Depends(current_user)):
import subprocess
path = body.get("path", "")
# Only allow opening files within the user's own output directory
user_dir = os.path.join(user["output_dir"], user["username"])
if path and os.path.exists(path) and os.path.abspath(path).startswith(os.path.abspath(user_dir)):
subprocess.Popen(["xdg-open", path])
target = os.path.dirname(path) if body.get("folder") else path
subprocess.Popen(["xdg-open", target])
return {"ok": True}
+4
View File
@@ -8,6 +8,7 @@ const logoutBtn = document.getElementById('logout-btn');
const modal = document.getElementById('modal');
const modalTitle = document.getElementById('modal-title');
const modalBody = document.getElementById('modal-body');
const modalFolderBtn = document.getElementById('modal-folder-btn');
const modalOpenBtn = document.getElementById('modal-open-btn');
const modalCloseBtn = document.getElementById('modal-close-btn');
let _modalPath = null;
@@ -73,6 +74,9 @@ function closeModal() {
modalCloseBtn.addEventListener('click', closeModal);
modal.querySelector('.modal-backdrop').addEventListener('click', closeModal);
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeModal(); });
modalFolderBtn.addEventListener('click', () => {
if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath, folder: true }) });
});
modalOpenBtn.addEventListener('click', () => {
if (_modalPath) apiFetch('/open', { method: 'POST', body: JSON.stringify({ path: _modalPath }) });
});
+5
View File
@@ -256,6 +256,11 @@
<div class="modal-header">
<span id="modal-title" class="modal-title"></span>
<div class="modal-actions">
<button id="modal-folder-btn" class="modal-btn" title="Verzeichnis öffnen">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z"/>
</svg>
</button>
<button id="modal-open-btn" class="modal-btn" title="Im Editor öffnen">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3zm-1 2H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8h-2v8H5V7h8V5z"/>