From ee8de1ee0b992eb70089f7ba33ef2296f22e755c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 28 Apr 2025 17:45:17 +0400 Subject: [PATCH] refac: disable jwt display for non-admin users --- .../components/chat/Settings/Account.svelte | 233 +++++++++--------- 1 file changed, 120 insertions(+), 113 deletions(-) diff --git a/src/lib/components/chat/Settings/Account.svelte b/src/lib/components/chat/Settings/Account.svelte index db403252f..80fc143b1 100644 --- a/src/lib/components/chat/Settings/Account.svelte +++ b/src/lib/components/chat/Settings/Account.svelte @@ -87,7 +87,7 @@
-
+
-
+
+ +
-
+ {#if ($config?.features?.enable_api_key ?? true) || $user?.role === 'admin'} +
+
{$i18n.t('API keys')}
+ +
-
-
{$i18n.t('API keys')}
- -
+ {#if showAPIKeys} +
+ {#if $user?.role === 'admin'} +
+
+
{$i18n.t('JWT Token')}
+
- {#if showAPIKeys} -
-
-
-
{$i18n.t('JWT Token')}
-
- -
- - - -
-
- {#if $config?.features?.enable_api_key ?? true} -
-
-
{$i18n.t('API Key')}
-
-
- {#if APIKey} - +
+ +
+
+ {/if} + + {#if $config?.features?.enable_api_key ?? true} +
+ {#if $user?.role === 'admin'} +
+
{$i18n.t('API Key')}
+
+ {/if} +
+ {#if APIKey} + - + + + + + {:else} + - - {:else} - - {/if} + {$i18n.t('Create new secret key')} + {/if} +
-
- {/if} -
+ {/if} +
+ {/if} {/if}