2022-11-23 17:11:44 -08:00
|
|
|
<script>
|
2023-04-25 08:49:00 -07:00
|
|
|
import { onMount } from 'svelte';
|
2024-06-01 20:17:50 -04:00
|
|
|
import { invoke } from '@tauri-apps/api/core';
|
2023-04-23 22:29:12 -07:00
|
|
|
|
2023-04-25 08:49:00 -07:00
|
|
|
import { appState } from '../lib/state.js';
|
2023-04-24 12:05:11 -07:00
|
|
|
import { navigate } from '../lib/routing.js';
|
2023-04-24 22:16:25 -07:00
|
|
|
import Nav from '../ui/Nav.svelte';
|
2023-04-23 22:29:12 -07:00
|
|
|
import Icon from '../ui/Icon.svelte';
|
2023-04-25 08:49:00 -07:00
|
|
|
import Link from '../ui/Link.svelte';
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2023-04-28 22:34:50 -07:00
|
|
|
|
2023-08-03 22:08:24 -07:00
|
|
|
let launchBase = false;
|
|
|
|
function launchTerminal() {
|
|
|
|
invoke('launch_terminal', {base: launchBase});
|
|
|
|
launchBase = false;
|
|
|
|
}
|
2024-06-26 11:10:50 -04:00
|
|
|
|
|
|
|
async function lock() {
|
|
|
|
try {
|
|
|
|
await invoke('lock');
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
2022-11-23 17:11:44 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-22 21:50:09 -08:00
|
|
|
|
2023-04-28 22:34:50 -07:00
|
|
|
<Nav position="fixed">
|
|
|
|
<h2 slot="title" class="text-3xl font-bold">Creddy</h2>
|
|
|
|
</Nav>
|
2022-12-22 21:50:09 -08:00
|
|
|
|
2023-04-26 17:06:37 -07:00
|
|
|
<div class="flex flex-col h-screen items-center justify-center p-4 space-y-4">
|
2023-08-03 22:08:24 -07:00
|
|
|
<div class="flex flex-col items-center space-y-4">
|
2024-06-26 11:10:50 -04:00
|
|
|
<h2 class="text-2xl font-bold">Waiting for requests</h2>
|
|
|
|
<button class="btn btn-primary w-full" on:click={launchTerminal}>
|
|
|
|
Launch Terminal
|
|
|
|
</button>
|
|
|
|
<label class="label cursor-pointer flex items-center space-x-2">
|
|
|
|
<span class="label-text">Launch with long-lived credentials</span>
|
|
|
|
<input type="checkbox" class="checkbox checkbox-sm" bind:checked={launchBase}>
|
|
|
|
</label>
|
|
|
|
<button class="btn btn-primary w-full" on:click={lock}>
|
|
|
|
Lock Creddy
|
|
|
|
</button>
|
|
|
|
<Link target="ChangePassphrase" class="w-full">
|
|
|
|
<button class="btn btn-primary w-full">Change passphrase</button>
|
|
|
|
</Link>
|
|
|
|
<Link target="ManageCredentials" class="w-full">
|
|
|
|
<button class="btn btn-primary w-full">Manage credentials</button>
|
|
|
|
</Link>
|
2023-08-03 22:08:24 -07:00
|
|
|
</div>
|
2023-09-14 15:04:25 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{#if $appState.setupErrors.some(e => e.show)}
|
|
|
|
<div class="toast">
|
|
|
|
{#each $appState.setupErrors as error}
|
|
|
|
{#if error.show}
|
|
|
|
<div class="alert alert-error shadow-lg">
|
|
|
|
{error.msg}
|
|
|
|
<button class="btn btn-sm btn-alert-error" on:click={() => error.show = false}>Ok</button>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
{/if}
|