feat: write 3 files per solo recording (index + transkript + zusammenfassung)
- pipeline: call write_solo_docs() instead of save_transcript(); broadcast paths dict - router: /open accepts paths list for Obsidian mode, copies all 3 files to vault - app.js: store _modalPaths from saved event; Obsidian button sends all paths - tests: test_write_solo_docs_creates_three_files added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+20
-12
@@ -209,28 +209,36 @@ async def put_config(body: dict, user: dict = Depends(current_user)):
|
||||
@router.post("/open")
|
||||
async def open_file(body: dict, user: dict = Depends(current_user)):
|
||||
import subprocess, shutil
|
||||
path = body.get("path", "")
|
||||
user_dir = os.path.join(user["output_dir"], user["username"])
|
||||
if not (path and os.path.exists(path) and os.path.abspath(path).startswith(os.path.abspath(user_dir))):
|
||||
abs_user_dir = os.path.abspath(user_dir)
|
||||
|
||||
# Accept either a single path or a list of paths (for 3-file recordings)
|
||||
raw_paths = body.get("paths") or ([body.get("path")] if body.get("path") else [])
|
||||
paths = [p for p in raw_paths if p and os.path.exists(p) and os.path.abspath(p).startswith(abs_user_dir)]
|
||||
if not paths:
|
||||
return {"ok": False}
|
||||
|
||||
mode = body.get("mode", "editor") # "editor" | "folder" | "obsidian"
|
||||
if mode == "obsidian":
|
||||
from urllib.parse import quote
|
||||
cfg = load_config()
|
||||
vault = cfg.get("obsidian", {}).get("vault", "").strip()
|
||||
if vault and os.path.isdir(vault):
|
||||
dest = os.path.join(vault, os.path.basename(path))
|
||||
shutil.copy2(path, dest)
|
||||
target = dest
|
||||
else:
|
||||
target = path
|
||||
subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(target, safe='/')}"])
|
||||
open_target = paths[0]
|
||||
for p in paths:
|
||||
if vault and os.path.isdir(vault):
|
||||
dest = os.path.join(vault, os.path.basename(p))
|
||||
shutil.copy2(p, dest)
|
||||
if p == paths[0]:
|
||||
open_target = dest
|
||||
else:
|
||||
open_target = p
|
||||
subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(open_target, safe='/')}"])
|
||||
elif mode == "folder" and shutil.which("dolphin"):
|
||||
subprocess.Popen(["dolphin", "--select", path])
|
||||
subprocess.Popen(["dolphin", "--select", paths[0]])
|
||||
elif mode == "folder":
|
||||
subprocess.Popen(["xdg-open", os.path.dirname(path)])
|
||||
subprocess.Popen(["xdg-open", os.path.dirname(paths[0])])
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", path])
|
||||
subprocess.Popen(["xdg-open", paths[0]])
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user