aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2024-07-25 13:40:04 +0100
committerGitHub <noreply@github.com>2024-07-25 13:40:04 +0100
commit128891f53ecb2f78c5eb059495114a66f25a58de (patch)
treefe09bf223b17ae35c01a732965a4c16e7e59d4a8 /ui/src
parentchore(release): prepare for release v18.4.0-beta.3 (#2305) (diff)
downloadatuin-128891f53ecb2f78c5eb059495114a66f25a58de.zip
fix(gui): do not hardcode db path (#2309)
* feat(gui/backend): add cli_settings tauri command * chore(gui/backend): overdue cargo fmt * fix(gui): use configured db path, not hardcoded
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/state/models.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/ui/src/state/models.ts b/ui/src/state/models.ts
index 4ca79006..891f7a55 100644
--- a/ui/src/state/models.ts
+++ b/ui/src/state/models.ts
@@ -1,3 +1,4 @@
+import { invoke } from "@tauri-apps/api/core";
import Database from "@tauri-apps/plugin-sql";
export class User {
@@ -122,9 +123,8 @@ interface Sync {
export async function inspectCommandHistory(
h: ShellHistory,
): Promise<InspectHistory> {
- const db = await Database.load(
- "sqlite:/Users/ellie/.local/share/atuin/history.db",
- );
+ const settings: Settings = await invoke("cli_settings");
+ const db = await Database.load("sqlite:" + settings.db_path);
let other: any[] = await db.select(
"select * from history where command=?1 order by timestamp desc",
@@ -151,9 +151,8 @@ export async function inspectCommandHistory(
export async function inspectDirectoryHistory(
h: ShellHistory,
): Promise<InspectHistory> {
- const db = await Database.load(
- "sqlite:/Users/ellie/.local/share/atuin/history.db",
- );
+ const settings: Settings = await invoke("cli_settings");
+ const db = await Database.load("sqlite:" + settings.db_path);
let other: any[] = await db.select(
"select * from history where cwd=?1 order by timestamp desc",