2022-08-14 13:27:41 -07:00
|
|
|
<script>
|
2022-11-27 22:03:15 -08:00
|
|
|
import { invoke } from '@tauri-apps/api/tauri';
|
|
|
|
|
2023-04-24 12:05:11 -07:00
|
|
|
import { navigate } from '../lib/routing.js';
|
2023-04-25 08:49:00 -07:00
|
|
|
import { appState } from '../lib/state.js';
|
2023-04-24 22:16:25 -07:00
|
|
|
import Link from '../ui/Link.svelte';
|
2022-12-28 15:48:25 -08:00
|
|
|
import Icon from '../ui/Icon.svelte';
|
2022-12-22 19:53:14 -08:00
|
|
|
|
2022-11-23 17:11:44 -08:00
|
|
|
|
2022-11-27 22:03:15 -08:00
|
|
|
async function approve() {
|
2022-12-13 21:50:34 -08:00
|
|
|
let status = await invoke('get_session_status');
|
2022-12-13 16:50:44 -08:00
|
|
|
if (status === 'unlocked') {
|
2023-04-24 12:05:11 -07:00
|
|
|
navigate('ShowApproved');
|
2022-11-27 22:03:15 -08:00
|
|
|
}
|
2022-12-13 16:50:44 -08:00
|
|
|
else if (status === 'locked') {
|
2023-04-24 12:05:11 -07:00
|
|
|
navigate('Unlock');
|
2022-12-13 16:50:44 -08:00
|
|
|
}
|
2022-11-27 22:03:15 -08:00
|
|
|
else {
|
2023-04-24 12:05:11 -07:00
|
|
|
navigate('EnterCredentials');
|
2022-11-27 22:03:15 -08:00
|
|
|
}
|
2022-11-23 17:11:44 -08:00
|
|
|
}
|
|
|
|
|
2023-04-23 22:29:12 -07:00
|
|
|
var appName = null;
|
2023-04-25 08:49:00 -07:00
|
|
|
if ($appState.currentRequest.clients.length === 1) {
|
|
|
|
let path = $appState.currentRequest.clients[0].exe;
|
2023-04-23 22:29:12 -07:00
|
|
|
let m = path.match(/\/([^/]+?$)|\\([^\\]+?$)/);
|
|
|
|
appName = m[1] || m[2];
|
|
|
|
}
|
|
|
|
</script>
|
2022-12-19 15:26:44 -08:00
|
|
|
|
2022-08-14 13:27:41 -07:00
|
|
|
|
2023-04-23 22:29:12 -07:00
|
|
|
<div class="flex flex-col space-y-4 p-4 m-auto max-w-max h-screen justify-center">
|
|
|
|
<!-- <div class="p-4 rounded-box border-2 border-neutral-content"> -->
|
|
|
|
<div class="space-y-1 mb-4">
|
|
|
|
<h2 class="text-xl font-bold">{appName ? `"${appName}"` : 'An appplication'} would like to access your AWS credentials.</h2>
|
2023-04-25 08:49:00 -07:00
|
|
|
{#each $appState.currentRequest.clients as client}
|
2023-04-23 22:29:12 -07:00
|
|
|
<p>Path: {client ? client.exe : 'Unknown'}</p>
|
|
|
|
<p>PID: {client ? client.pid : 'Unknown'}</p>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2022-12-21 13:42:12 -08:00
|
|
|
|
2023-04-23 22:29:12 -07:00
|
|
|
<div class="grid grid-cols-2">
|
2023-04-24 22:16:25 -07:00
|
|
|
<Link target="ShowDenied" hotkey="Escape">
|
|
|
|
<button class="btn btn-error justify-self-start">
|
|
|
|
Deny
|
|
|
|
<kbd class="ml-2 normal-case px-1 py-0.5 rounded border border-neutral">Esc</kbd>
|
|
|
|
</button>
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
<Link target="{approve}" hotkey="Enter" shift="{true}">
|
|
|
|
<button class="btn btn-success justify-self-end">
|
|
|
|
Approve
|
|
|
|
<kbd class="ml-2 normal-case px-1 py-0.5 rounded border border-neutral">Shift</kbd>
|
|
|
|
<span class="mx-0.5">+</span>
|
|
|
|
<kbd class="normal-case px-1 py-0.5 rounded border border-neutral">Enter</kbd>
|
|
|
|
</button>
|
|
|
|
</Link>
|
2023-04-23 22:29:12 -07:00
|
|
|
</div>
|
2022-12-21 13:42:12 -08:00
|
|
|
</div>
|