1
0
Fork 0

fix for config file in home config

master
Michaël Lemaire 3 years ago
parent 54fd85694d
commit 0fb07099a2
  1. 2
      cli.ts
  2. 10
      ui/zenity.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) {

@ -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