diff --git a/doc/todo.md b/doc/todo.md index e7a38b3..58d1d22 100644 --- a/doc/todo.md +++ b/doc/todo.md @@ -1,8 +1,9 @@ ## Definitely -* Switch to "process" provider for AWS credentials (much less hacky) +* ~~Switch to "process" provider for AWS credentials (much less hacky)~~ +* Frontend needs to react when request is cancelled from backend * Session timeout (plain duration, or activity-based?) -* ~Fix rehide behavior when new request comes in while old one is still being resolved~ +* ~~Fix rehide behavior when new request comes in while old one is still being resolved~~ * Additional hotkey configuration (approve/deny at the very least) * Logging * Icon diff --git a/package.json b/package.json index 4fb5754..edb7a27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "creddy", - "version": "0.4.2", + "version": "0.4.3", "scripts": { "dev": "vite", "build": "vite build", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2f596b8..6563432 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "creddy" -version = "0.4.1" +version = "0.4.3" dependencies = [ "argon2", "auto-launch", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 98d250a..508cd65 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "creddy" -version = "0.4.2" +version = "0.4.3" description = "A friendly AWS credentials manager" authors = ["Joseph Montanaro"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d030f56..91d11dc 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "creddy", - "version": "0.4.2" + "version": "0.4.3" }, "tauri": { "allowlist": { diff --git a/src/ui/KeyCombo.svelte b/src/ui/KeyCombo.svelte index cd331eb..34f913d 100644 --- a/src/ui/KeyCombo.svelte +++ b/src/ui/KeyCombo.svelte @@ -1,13 +1,15 @@ -
+ {#each keys as key, i} {#if i > 0} + {/if} {key} {/each} -
+ diff --git a/src/ui/Link.svelte b/src/ui/Link.svelte index 38f2da9..ce799fc 100644 --- a/src/ui/Link.svelte +++ b/src/ui/Link.svelte @@ -21,15 +21,16 @@ throw(`Link target is not a string or a function: ${target}`) } } - + function handleHotkey(event) { - if (!hotkey) return; - if (ctrl && !event.ctrlKey) return; - if (alt && !event.altKey) return; - if (shift && !event.shiftKey) return; - - if (event.key === hotkey) { + if ( + hotkey === event.key + && ctrl === event.ctrlKey + && alt === event.altKey + && shift === event.shiftKey + ) { + console.log({hotkey, ctrl, alt, shift}); click(); } } diff --git a/src/views/Approve.svelte b/src/views/Approve.svelte index 8d9a39d..a4796a2 100644 --- a/src/views/Approve.svelte +++ b/src/views/Approve.svelte @@ -11,11 +11,13 @@ // Send response to backend, display error if applicable let error, alert; - let base = $appState.currentRequest.base; async function respond() { - let {id, approval} = $appState.currentRequest; + const response = { + id: $appState.currentRequest.id, + ...$appState.currentRequest.response, + }; try { - await invoke('respond', {response: {id, approval, base}}); + await invoke('respond', {response}); navigate('ShowResponse'); } catch (e) { @@ -27,8 +29,8 @@ } // Approval has one of several outcomes depending on current credential state - async function approve() { - $appState.currentRequest.approval = 'Approved'; + async function approve(base) { + $appState.currentRequest.response = {approval: 'Approved', base}; let status = await invoke('get_session_status'); if (status === 'unlocked') { await respond(); @@ -41,9 +43,16 @@ } } + function approve_base() { + approve(true); + } + function approve_session() { + approve(false); + } + // Denial has only one async function deny() { - $appState.currentRequest.approval = 'Denied'; + $appState.currentRequest.response = {approval: 'Denied', base: false}; await respond(); } @@ -59,7 +68,7 @@ // if the request has already been approved/denied, send response immediately onMount(async () => { - if ($appState.currentRequest.approval) { + if ($appState.currentRequest.response) { await respond(); } }) @@ -67,7 +76,7 @@ -{#if error || !$appState.currentRequest.approval} +{#if error || !$appState.currentRequest.response}
{#if error} @@ -102,27 +111,42 @@
-
- - + + {/if} + +

+ + {#if $appState.currentRequest.base} + Approve + {:else} + Approve with base credentials + {/if} + +

+ approve(true)} hotkey="Enter" shift={true} ctrl={true}> + + + +

Deny - - - - - - - -

- -
- + + + +
{/if} diff --git a/src/views/ShowResponse.svelte b/src/views/ShowResponse.svelte index 4e43907..8fec450 100644 --- a/src/views/ShowResponse.svelte +++ b/src/views/ShowResponse.svelte @@ -22,7 +22,7 @@
- {#if $appState.currentRequest.approval === 'Approved'} + {#if $appState.currentRequest.response.approval === 'Approved'} @@ -33,6 +33,6 @@ {/if}
- {$appState.currentRequest.approval}! + {$appState.currentRequest.response.approval}!