2022-08-14 13:27:41 -07:00
|
|
|
<script>
|
|
|
|
import { createEventDispatcher } from 'svelte';
|
2022-11-27 22:03:15 -08:00
|
|
|
import { invoke } from '@tauri-apps/api/tauri';
|
|
|
|
|
|
|
|
export let appState;
|
2022-08-14 13:27:41 -07:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher();
|
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') {
|
2022-11-27 22:03:15 -08:00
|
|
|
dispatch('navigate', {target: 'ShowApproved'});
|
|
|
|
}
|
2022-12-13 16:50:44 -08:00
|
|
|
else if (status === 'locked') {
|
|
|
|
dispatch('navigate', {target: 'Unlock'})
|
|
|
|
}
|
2022-11-27 22:03:15 -08:00
|
|
|
else {
|
2022-12-13 16:50:44 -08:00
|
|
|
dispatch('navigate', {target: 'EnterCredentials'});
|
2022-11-27 22:03:15 -08:00
|
|
|
}
|
2022-11-23 17:11:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function deny() {
|
|
|
|
dispatch('navigate', {target: 'ShowDenied'});
|
|
|
|
}
|
2022-12-19 15:26:44 -08:00
|
|
|
|
|
|
|
function handleHotkey(event) {
|
|
|
|
if (event.shiftKey && (event.code === 'Enter' || event.code === 'NumpadEnter')) {
|
|
|
|
approve();
|
|
|
|
}
|
|
|
|
}
|
2022-08-14 13:27:41 -07:00
|
|
|
</script>
|
|
|
|
|
2022-12-19 15:26:44 -08:00
|
|
|
<svelte:window on:keydown={handleHotkey} />
|
|
|
|
|
2022-08-14 13:27:41 -07:00
|
|
|
<h2 class="text-3xl text-gray-200">An application would like to access your AWS credentials.</h2>
|
|
|
|
|
2022-11-23 17:11:44 -08:00
|
|
|
<button on:click={approve}>
|
2022-08-14 13:27:41 -07:00
|
|
|
<svg class="w-32 stroke-green-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
|
2022-11-23 17:11:44 -08:00
|
|
|
<button on:click={deny}>
|
2022-08-14 13:27:41 -07:00
|
|
|
<svg class="w-32 stroke-red-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
|
|
</svg>
|
|
|
|
</button>
|