From a513e731c42786bd09d28b3973c972ff643a377f Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Fri, 2 Oct 2026 19:33:58 +0200 Subject: [PATCH] Redesign permissions page --- svelte/src/lib/NovaAPI.ts | 16 + svelte/src/user_home/APIKeys.svelte | 438 ++++++++++++++++++---------- 2 files changed, 305 insertions(+), 149 deletions(-) diff --git a/svelte/src/lib/NovaAPI.ts b/svelte/src/lib/NovaAPI.ts index 10214f3..2db0d88 100644 --- a/svelte/src/lib/NovaAPI.ts +++ b/svelte/src/lib/NovaAPI.ts @@ -95,6 +95,22 @@ export type UserSession = { creation_time: string, last_used_time: string, valid_domains: string[], + + // Whether this is the key the list of sessions was requested with + current: boolean, + + // What the key is allowed to do + filesystem_read: boolean, + filesystem_write: boolean, + account_read: boolean, + account_write: boolean, + session_read: boolean, + session_write: boolean, + billing_read: boolean, + billing_write: boolean, + + // IDs of the directories the key is limited to. Empty means no limit + filesystem_dirs: string[], } // If cached_user is undefined it means that the value is not initialized yet, diff --git a/svelte/src/user_home/APIKeys.svelte b/svelte/src/user_home/APIKeys.svelte index 9dcab33..45df620 100644 --- a/svelte/src/user_home/APIKeys.svelte +++ b/svelte/src/user_home/APIKeys.svelte @@ -1,187 +1,327 @@ -
- {#if !loaded} -
-

Warning

-

- API keys are sensitive information. They can be used to gain - full control over your account. Do not show your API keys to - someone or something you don't trust! -

- -
- {:else} -
-
- -
- {/if} -

- If you delete the API key that you are currently using you will be - logged out of your account. Keys are sorted based on how recently they - were used, so your session usually the top one. API keys expire 30 days - after the last time they're used. If you think someone is using your - account without your authorization it's probably a good idea to delete - all your keys. + API keys give apps access to your account. Whoever has a key can do + everything the key is allowed to do, so don't show them to someone or + something you don't trust. A key expires 30 days after it was last used. + If you think someone is using your account without your permission, + delete all your keys and change your password.

-
-
- - - - - - - - - - - - {#each rows as row (row.auth_key)} - - - - - - - - - - - - {/each} - -
KeyCreatedLast used ▼IP address
- Copy - {row.auth_key} - {formatDate(row.creation_time, true, true, false)}{formatDate(row.last_used_time, true, true, false)}{row.creation_ip_address} - -
- {#if row.app_name === "website login"} - - Nova website - {:else if row.app_name === "website keys page"} - vpn_key - Nova keys page - {:else if row.app_name === "sharex"} - ShareX logo - ShareX - {:else if row.app_name === "jdownloader"} - JDownloader logo - JDownloader + +
+
+ +
+ + {#each keys as key (key.auth_key)} +
+
+ + {#if key.app_name === "website login"} + Nova website + {:else if key.app_name === "website keys page"} + vpn_key Created on this page + {:else if key.app_name === "sharex"} + ShareX + {:else if key.app_name === "jdownloader"} + JDownloader + {:else} + apps {key.app_name || "Unnamed key"} + {/if} + + {#if key.current} + This session + {/if} +
+ +
+ +
+ + {shown[key.auth_key] ? key.auth_key : key.auth_key.slice(0, 8) + "-••••-••••-••••-••••••••••••"} + + + Copy +
+ +
+ {#each components as [name, icon, read, write]} + + {icon} + {name}: + {#if key[read] && key[write]} + read and write + {:else if key[read]} + read only + {:else if key[write]} + write only {:else} - Unknown app: {row.app_name} + no access {/if} -
User-Agent: {row.user_agent}
-
-
+ + {/each} + + {#if key.filesystem_dirs.length !== 0} +
+ Files access is limited to + {#each key.filesystem_dirs as id} + folder{dir_names[id] ?? id} + {/each} +
+ {/if} + +
+
+ Created + {formatDate(key.creation_time, true, true, false)} + ({ago(key.creation_time)}) +
+
+ Last used + {formatDate(key.last_used_time, true, true, false)} + ({ago(key.last_used_time)}) +
+
+ IP address + {key.creation_ip_address} +
+
+ User agent + +
+
+ + {/each} +