Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
refactor(api-keys): hide usage:read scope from UI
Gabriel Steince9d8a8d696a
diff --git a/src/components/ApiKeysSection.tsx b/src/components/ApiKeysSection.tsxindex b30dbc463..fc0986e7f 100644--- a/src/components/ApiKeysSection.tsx+++ b/src/components/ApiKeysSection.tsx@@ -24,6 +24,7 @@ import {API_SCOPE_I18N_KEY,API_KEY_EXPIRY_OPTIONS,MAX_API_KEYS,+ buildFullScopes,type ApiScope,} from "../constants/apiKeys";@@ -142,13 +143,13 @@ export default function ApiKeysSection() {</code></div><div className="flex items-center gap-1.5 flex-wrap">- {apiKey.scopes.map((scope) => (- <Badge key={scope} variant="outline" className="text-[10px] px-1.5 py-0">- {t(- `apiKeysSection.scopes.${API_SCOPE_I18N_KEY[scope as ApiScope] ?? scope}`- )}- </Badge>- ))}+ {apiKey.scopes+ .filter((scope) => scope in API_SCOPE_I18N_KEY)+ .map((scope) => (+ <Badge key={scope} variant="outline" className="text-[10px] px-1.5 py-0">+ {t(`apiKeysSection.scopes.${API_SCOPE_I18N_KEY[scope as ApiScope]}`)}+ </Badge>+ ))}<span className="text-[10px] text-muted-foreground/50 ml-1">{apiKey.last_used_at? t("apiKeysSection.lastUsed", {@@ -246,7 +247,7 @@ function CreateKeyDialog({const expiresInDays = API_KEY_EXPIRY_OPTIONS.find((o) => o.value === expiry)?.days ?? null;const result = await ApiKeysService.create({name: name.trim(),- scopes: Array.from(scopes),+ scopes: buildFullScopes(Array.from(scopes)),expiresInDays,});setRawKey(result.key);diff --git a/src/constants/apiKeys.ts b/src/constants/apiKeys.tsindex d4553d8ac..709caa74e 100644--- a/src/constants/apiKeys.ts+++ b/src/constants/apiKeys.ts@@ -1,24 +1,25 @@// Source of truth for the desktop side of the public API key UI.// Keep API_SCOPES and MAX_API_KEYS in sync with openwhispr-api/lib/api-keys.ts.-export const API_SCOPES = [- "notes:read",- "notes:write",- "transcriptions:read",- "usage:read",-] as const;+export const API_SCOPES = ["notes:read", "notes:write", "transcriptions:read"] as const;export type ApiScope = (typeof API_SCOPES)[number];export const MAX_API_KEYS = 5;+// Scopes granted to every key but not shown in the UI+const IMPLICIT_SCOPES = ["usage:read"] as const;++export function buildFullScopes(selected: ApiScope[]): string[] {+ return [...selected, ...IMPLICIT_SCOPES];+}+// i18next reserves ":" as the namespace separator, so scope ids can't be used// as translation keys directly. This map gives each scope an i18n-safe alias.export const API_SCOPE_I18N_KEY: Record<ApiScope, string> = {"notes:read": "notesRead","notes:write": "notesWrite","transcriptions:read": "transcriptionsRead",- "usage:read": "usageRead",};export interface ApiKeyExpiryOption {diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex ef3c880cf..baa02b100 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -2238,8 +2238,7 @@"scopes": {"notesRead": "Notizen lesen","notesWrite": "Notizen erstellen und bearbeiten",- "transcriptionsRead": "Transkriptionen lesen",- "usageRead": "Nutzung anzeigen"+ "transcriptionsRead": "Transkriptionen lesen"},"revoke": {"button": "Widerrufen",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 93833d0b2..dbbcdc410 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -690,8 +690,7 @@"scopes": {"notesRead": "Read notes","notesWrite": "Create & edit notes",- "transcriptionsRead": "Read transcriptions",- "usageRead": "View usage"+ "transcriptionsRead": "Read transcriptions"},"revoke": {"button": "Revoke",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex f3c42bcf1..4251fa819 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -642,8 +642,7 @@"scopes": {"notesRead": "Leer notas","notesWrite": "Crear y editar notas",- "transcriptionsRead": "Leer transcripciones",- "usageRead": "Ver uso"+ "transcriptionsRead": "Leer transcripciones"},"revoke": {"button": "Revocar",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex fe59efc64..1e91fb543 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -642,8 +642,7 @@"scopes": {"notesRead": "Lire les notes","notesWrite": "Créer et modifier les notes",- "transcriptionsRead": "Lire les transcriptions",- "usageRead": "Voir l'utilisation"+ "transcriptionsRead": "Lire les transcriptions"},"revoke": {"button": "Révoquer",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 2715753ef..b44e8ef87 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -2238,8 +2238,7 @@"scopes": {"notesRead": "Leggi note","notesWrite": "Crea e modifica note",- "transcriptionsRead": "Leggi trascrizioni",- "usageRead": "Visualizza utilizzo"+ "transcriptionsRead": "Leggi trascrizioni"},"revoke": {"button": "Revoca",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 4b472a4e2..c7af4782a 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -2238,8 +2238,7 @@"scopes": {"notesRead": "ノートの読み取り","notesWrite": "ノートの作成と編集",- "transcriptionsRead": "文字起こしの読み取り",- "usageRead": "使用状況の表示"+ "transcriptionsRead": "文字起こしの読み取り"},"revoke": {"button": "取り消し",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 165379dfd..c541b710e 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -2238,8 +2238,7 @@"scopes": {"notesRead": "Ler notas","notesWrite": "Criar e editar notas",- "transcriptionsRead": "Ler transcrições",- "usageRead": "Ver uso"+ "transcriptionsRead": "Ler transcrições"},"revoke": {"button": "Revogar",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 39e69d593..afb9b3a57 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -2238,8 +2238,7 @@"scopes": {"notesRead": "Чтение заметок","notesWrite": "Создание и редактирование заметок",- "transcriptionsRead": "Чтение транскрипций",- "usageRead": "Просмотр использования"+ "transcriptionsRead": "Чтение транскрипций"},"revoke": {"button": "Отозвать",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 91735dda6..91b536c38 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -2233,8 +2233,7 @@"scopes": {"notesRead": "读取笔记","notesWrite": "创建和编辑笔记",- "transcriptionsRead": "读取转录",- "usageRead": "查看使用情况"+ "transcriptionsRead": "读取转录"},"revoke": {"button": "撤销",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex a814de42f..017d1dae2 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -2233,8 +2233,7 @@"scopes": {"notesRead": "讀取筆記","notesWrite": "建立與編輯筆記",- "transcriptionsRead": "讀取轉錄",- "usageRead": "檢視使用情況"+ "transcriptionsRead": "讀取轉錄"},"revoke": {"button": "撤銷",