Browse Source

fix for config file in home config

master
Michaël Lemaire 10 months ago
parent
commit
0fb07099a2
  1. 2
      cli.ts
  2. 10
      ui/zenity.ts

2
cli.ts

@ -1,4 +1,4 @@
#!/usr/bin/env -S deno run --allow-run --allow-read
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-env
import { showZenityUI } from "./ui/zenity.ts";
if (import.meta.main) {

10
ui/zenity.ts

@ -32,7 +32,15 @@ async function copyToClipboard(text: string): Promise<void> {
}
async function readPrivateKey(): Promise<string> {
const content = await Deno.readTextFile(".local/config.json");
let content: string;
try {
content = await Deno.readTextFile(".local/config.json");
} catch {
content = await Deno.readTextFile(
`${Deno.env.get("HOME")}/.config/thunderk-passwordhash.json`,
);
}
const config = JSON.parse(content);
return config.privateKey;
}

Loading…
Cancel
Save