diff --git a/api/router.py b/api/router.py index 7b29ae2..12d7a2d 100644 --- a/api/router.py +++ b/api/router.py @@ -216,7 +216,15 @@ async def open_file(body: dict, user: dict = Depends(current_user)): mode = body.get("mode", "editor") # "editor" | "folder" | "obsidian" if mode == "obsidian": from urllib.parse import quote - subprocess.Popen(["xdg-open", f"obsidian://open?path={quote(path, safe='/')}"]) + 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='/')}"]) elif mode == "folder" and shutil.which("dolphin"): subprocess.Popen(["dolphin", "--select", path]) elif mode == "folder": diff --git a/config.py b/config.py index 31f8af0..1a3e857 100644 --- a/config.py +++ b/config.py @@ -33,6 +33,9 @@ DEFAULTS = { "enabled": False, "hf_token": "", }, + "obsidian": { + "vault": "", + }, "pid_file": os.path.expanduser("~/.local/run/tueit-transcriber.pid"), } diff --git a/frontend/settings.html b/frontend/settings.html index f97f902..9423d91 100644 --- a/frontend/settings.html +++ b/frontend/settings.html @@ -97,6 +97,10 @@ +