From 159376e2a1c6ef96139509d75d2d88459ba18766 Mon Sep 17 00:00:00 2001 From: Guilherme Nogueira Date: Fri, 10 Apr 2026 14:40:14 -0300 Subject: [PATCH] feat: adds name field to api keys (#5366) * feat: adds name field to api keys * remove extra toasts * prune and norm translations --------- Co-authored-by: Timothy Carambat --- frontend/src/locales/ar/common.js | 40 ++++++++---- frontend/src/locales/cs/common.js | 41 ++++++++----- frontend/src/locales/da/common.js | 41 ++++++++----- frontend/src/locales/de/common.js | 41 ++++++++----- frontend/src/locales/en/common.js | 40 ++++++++---- frontend/src/locales/es/common.js | 41 ++++++++----- frontend/src/locales/et/common.js | 41 ++++++++----- frontend/src/locales/fa/common.js | 40 ++++++++---- frontend/src/locales/fr/common.js | 41 ++++++++----- frontend/src/locales/he/common.js | 38 ++++++++---- frontend/src/locales/it/common.js | 41 ++++++++----- frontend/src/locales/ja/common.js | 40 +++++++----- frontend/src/locales/ko/common.js | 40 ++++++++---- frontend/src/locales/lt/common.js | 40 ++++++++---- frontend/src/locales/lv/common.js | 40 ++++++++---- frontend/src/locales/nl/common.js | 41 ++++++++----- frontend/src/locales/pl/common.js | 41 ++++++++----- frontend/src/locales/pt_BR/common.js | 45 +++++++++----- frontend/src/locales/ro/common.js | 41 ++++++++----- frontend/src/locales/ru/common.js | 40 ++++++++---- frontend/src/locales/tr/common.js | 43 ++++++++----- frontend/src/locales/vn/common.js | 41 ++++++++----- frontend/src/locales/zh/common.js | 37 +++++++---- frontend/src/locales/zh_TW/common.js | 38 ++++++++---- frontend/src/models/admin.js | 3 +- frontend/src/models/system.js | 3 +- .../ApiKeys/ApiKeyRow/index.jsx | 61 ++++++++++--------- .../ApiKeys/NewApiKeyModal/index.jsx | 45 ++++++++++---- .../pages/GeneralSettings/ApiKeys/index.jsx | 11 ++-- server/endpoints/admin.js | 5 +- server/endpoints/system.js | 7 ++- server/models/apiKeys.js | 7 ++- .../20260406120000_init/migration.sql | 2 + server/prisma/schema.prisma | 1 + 34 files changed, 738 insertions(+), 379 deletions(-) create mode 100644 server/prisma/migrations/20260406120000_init/migration.sql diff --git a/frontend/src/locales/ar/common.js b/frontend/src/locales/ar/common.js index 540e258ea..4770984af 100644 --- a/frontend/src/locales/ar/common.js +++ b/frontend/src/locales/ar/common.js @@ -468,7 +468,34 @@ const TRANSLATIONS = { "تسمح مفاتيح واجهة برمجة التطبيقات لحامليها بالوصول إلى مثيل إني ثينك إلْلْم هذا وإدارته برمجيًا.", link: "اقرأ وثائق واجهة برمجة التطبيقات .", generate: "إنشاء مفتاح واجهة برمجة التطبيقات الجديد", + empty: "لم يتم العثور على مفاتيح API", + actions: "الإجراءات", + messages: { + error: "خطأ: {{error}}", + }, + modal: { + title: "إنشاء مفتاح API جديد", + cancel: "إلغاء", + close: "إغلاق", + create: "إنشاء مفتاح API", + helper: + "بمجرد إنشائه، يمكن استخدام مفتاح API للوصول إلى مثيل AnythingLLM هذا وإدارته برمجيًا.", + name: { + label: "الاسم", + placeholder: "تكامل الإنتاج", + helper: + "اختياري. استخدم اسمًا واضحًا حتى تتمكن من التعرف على هذا المفتاح لاحقًا.", + }, + }, + row: { + copy: "نسخ مفتاح API", + copied: "تم النسخ", + unnamed: "--", + deleteConfirm: + "هل أنت متأكد أنك تريد تعطيل مفتاح API هذا؟\nبعد القيام بذلك لن يعود قابلاً للاستخدام.\n\nهذا الإجراء لا يمكن التراجع عنه.", + }, table: { + name: "الاسم", key: "مفتاح واجهة برمجة التطبيقات", by: "تم الإنشاء بواسطة", created: "تم إنشاؤها", @@ -1110,8 +1137,6 @@ const TRANSLATIONS = { description: "الصق رمز API الذي تلقيته من @BotFather، ثم اختر مساحة عمل افتراضية لجهازك التابع للروبوت للدردشة فيها.", "bot-token": "رمز الرمز (Token)", - "default-workspace": "مساحة العمل الافتراضية", - "no-workspace": "لا توجد مساحات عمل متاحة. سيتم إنشاء مساحة عمل جديدة.", connecting: "التحميل...", "connect-bot": "روبوت الاتصال", }, @@ -1149,20 +1174,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "فشل إلغاء صلاحية المستخدم.", }, users: { - "pending-title": "معلق على الموافقة", "pending-description": "المستخدمون في انتظار التحقق. قارن رمز المطابقة المعروض هنا بالرمز المعروض في محادثتهم على تطبيق Telegram.", - "approved-title": "المستخدمون المعتمدون", - "approved-description": - "المستخدمون الذين تم منحهم الإذن للتواصل مع روبوتك.", - user: "المستخدم", - "pairing-code": "رمز التوفيق", - "no-pending": "لا توجد طلبات معلقة.", - "no-approved": "لا يوجد مستخدمون معتمدون.", unknown: "غير معروف", - approve: "الموافقة", - deny: "رفض", - revoke: "إلغاء", }, }, }; diff --git a/frontend/src/locales/cs/common.js b/frontend/src/locales/cs/common.js index 222a532b1..3016c030d 100644 --- a/frontend/src/locales/cs/common.js +++ b/frontend/src/locales/cs/common.js @@ -573,7 +573,34 @@ const TRANSLATIONS = { "API klíče umožňují držiteli programově přistupovat a spravovat tuto instanci AnythingLLM.", link: "Přečíst dokumentaci API", generate: "Generovat nový API klíč", + empty: "Nebyly nalezeny žádné API klíče", + actions: "Akce", + messages: { + error: "Chyba: {{error}}", + }, + modal: { + title: "Vytvořit nový API klíč", + cancel: "Zrušit", + close: "Zavřít", + create: "Vytvořit API klíč", + helper: + "Po vytvoření lze API klíč použít pro programový přístup k této instanci AnythingLLM a její správu.", + name: { + label: "Název", + placeholder: "Produkční integrace", + helper: + "Volitelné. Použijte přívětivý název, abyste klíč později snadno rozpoznali.", + }, + }, + row: { + copy: "Kopírovat API klíč", + copied: "Zkopírováno", + unnamed: "--", + deleteConfirm: + "Opravdu chcete deaktivovat tento API klíč?\nPoté už nebude možné jej používat.\n\nTuto akci nelze vrátit zpět.", + }, table: { + name: "Název", key: "API klíč", by: "Vytvořil", created: "Vytvořeno", @@ -1126,9 +1153,6 @@ const TRANSLATIONS = { description: "Vložte API token, který jste obdrželi od účtu @BotFather, a vyberte výchozí pracovní prostor, se kterým bude váš bot komunikovat.", "bot-token": "Token Bot", - "default-workspace": "Výchozí pracovní prostor", - "no-workspace": - "Nejsou k dispozici žádné pracovní prostory. Bude vytvořeno nové.", connecting: "Připojování...", "connect-bot": "Bot pro připojení", }, @@ -1168,20 +1192,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Nezdařilo se zrušit uživatelskou účet.", }, users: { - "pending-title": "Čeká na schválení", "pending-description": "Uživatelé, kteří čekají na ověření. Porovnejte kód pro spárování, který je zde uveden, s tím, který je zobrazen v jejich chatu na Telegramu.", - "approved-title": "Schválení uživatelů", - "approved-description": - "Uživatelé, kteří byli schváleni pro komunikaci s vaším botem.", - user: "Uživatel", - "pairing-code": "Kód pro párování", - "no-pending": "Žádné čekající požadavky", - "no-approved": "Žádní registrovaní uživatelé", unknown: "Neznámé", - approve: "Schválit", - deny: "Odmítnout", - revoke: "Zrušit", }, }, }; diff --git a/frontend/src/locales/da/common.js b/frontend/src/locales/da/common.js index d51599e5c..517123274 100644 --- a/frontend/src/locales/da/common.js +++ b/frontend/src/locales/da/common.js @@ -472,7 +472,34 @@ const TRANSLATIONS = { "API-nøgler giver indehaveren mulighed for programmatisk at få adgang til og administrere denne AnythingLLM-instans.", link: "Læs API-dokumentationen", generate: "Generér ny API-nøgle", + empty: "Ingen API-nøgler fundet", + actions: "Handlinger", + messages: { + error: "Fejl: {{error}}", + }, + modal: { + title: "Opret ny API-nøgle", + cancel: "Annuller", + close: "Luk", + create: "Opret API-nøgle", + helper: + "Når API-nøglen er oprettet, kan den bruges til programmatisk at få adgang til og konfigurere denne AnythingLLM-instans.", + name: { + label: "Navn", + placeholder: "Produktionsintegration", + helper: + "Valgfrit. Brug et sigende navn, så du nemt kan kende nøglen senere.", + }, + }, + row: { + copy: "Kopiér API-nøgle", + copied: "Kopieret", + unnamed: "--", + deleteConfirm: + "Er du sikker på, at du vil deaktivere denne API-nøgle?\nNår du gør det, kan den ikke længere bruges.\n\nDenne handling kan ikke fortrydes.", + }, table: { + name: "Navn", key: "API-nøgle", by: "Oprettet af", created: "Oprettet", @@ -1133,9 +1160,6 @@ const TRANSLATIONS = { description: "Indsæt API-tokenet, du modtog fra @BotFather, og vælg et standard-arbejdsområde, hvor din bot kan kommunikere.", "bot-token": "Bot-token", - "default-workspace": "Standardarbejdsområde", - "no-workspace": - "Ingen ledige arbejdsområder. Et nyt vil blive oprettet.", connecting: "Forbindes...", "connect-bot": "Connect Bot", }, @@ -1176,20 +1200,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Kunne ikke annullere brugerens adgang.", }, users: { - "pending-title": "Afventer godkendelse", "pending-description": "Brugere, der venter på at blive verificeret. Sammenlign den kode, der vises her, med den, der vises i deres Telegram-chat.", - "approved-title": "Godkendte brugere", - "approved-description": - "Brugere, der er blevet godkendt til at kommunikere med din bot.", - user: "Bruger", - "pairing-code": "Kombinationskode", - "no-pending": "Ingen igangværende anmodninger", - "no-approved": "Ingen godkendte brugere", unknown: "Ukendt", - approve: "Godkend", - deny: "Afvise", - revoke: "Annullere", }, }, }; diff --git a/frontend/src/locales/de/common.js b/frontend/src/locales/de/common.js index 785b6ca70..46c7b5990 100644 --- a/frontend/src/locales/de/common.js +++ b/frontend/src/locales/de/common.js @@ -570,7 +570,34 @@ const TRANSLATIONS = { "API-Schlüssel ermöglichen es dem Besitzer, programmatisch auf diese AnythingLLM-Instanz zuzugreifen und sie zu verwalten.", link: "Lesen Sie die API-Dokumentation", generate: "Neuen API-Schlüssel generieren", + empty: "Keine API-Schlüssel gefunden", + actions: "Aktionen", + messages: { + error: "Fehler: {{error}}", + }, + modal: { + title: "Neuen API-Schlüssel erstellen", + cancel: "Abbrechen", + close: "Schließen", + create: "API-Schlüssel erstellen", + helper: + "Nach der Erstellung kann der API-Schlüssel verwendet werden, um programmgesteuert auf diese AnythingLLM-Instanz zuzugreifen und sie zu konfigurieren.", + name: { + label: "Name", + placeholder: "Produktionsintegration", + helper: + "Optional. Verwenden Sie einen leicht verständlichen Namen, damit Sie diesen Schlüssel später wiedererkennen.", + }, + }, + row: { + copy: "API-Schlüssel kopieren", + copied: "Kopiert", + unnamed: "--", + deleteConfirm: + "Möchten Sie diesen API-Schlüssel wirklich deaktivieren?\nDanach kann er nicht mehr verwendet werden.\n\nDiese Aktion kann nicht rückgängig gemacht werden.", + }, table: { + name: "Name", key: "API-Schlüssel", by: "Erstellt von", created: "Erstellt", @@ -1141,9 +1168,6 @@ const TRANSLATIONS = { description: "Fügen Sie den API-Token ein, den Sie von @BotFather erhalten haben, und wählen Sie einen Standard-Arbeitsbereich für Ihren Bot aus, mit dem er kommunizieren soll.", "bot-token": "Bot-Token", - "default-workspace": "Standardarbeitsbereich", - "no-workspace": - "Keine verfügbaren Arbeitsbereiche. Ein neuer Bereich wird erstellt.", connecting: "Verbinde...", "connect-bot": "Connect-Bot", }, @@ -1190,20 +1214,9 @@ const TRANSLATIONS = { "Fehlgeschlagener Versuch, das Benutzerkonto zu deaktivieren.", }, users: { - "pending-title": "Warte auf Genehmigung", "pending-description": "Benutzer, die noch verifiziert werden müssen. Vergleichen Sie den hier angezeigten Pairing-Code mit dem, der in ihrem Telegram-Chat angezeigt wird.", - "approved-title": "Benutzer mit Genehmigung", - "approved-description": - "Nutzer, denen die Erlaubnis erteilt wurde, mit Ihrem Bot zu kommunizieren.", - user: "Benutzer", - "pairing-code": "Paarcode", - "no-pending": "Keine ausstehenden Anfragen", - "no-approved": "Keine autorisierten Benutzer", unknown: "Unbekannt", - approve: "Genehmigen", - deny: "Leugnen", - revoke: "Aufheben", }, }, }; diff --git a/frontend/src/locales/en/common.js b/frontend/src/locales/en/common.js index e1a85e5a1..26c182769 100644 --- a/frontend/src/locales/en/common.js +++ b/frontend/src/locales/en/common.js @@ -570,7 +570,34 @@ const TRANSLATIONS = { "API keys allow the holder to programmatically access and manage this AnythingLLM instance.", link: "Read the API documentation", generate: "Generate New API Key", + empty: "No API keys found", + actions: "Actions", + messages: { + error: "Error: {{error}}", + }, + modal: { + title: "Create new API key", + cancel: "Cancel", + close: "Close", + create: "Create API Key", + helper: + "Once created the API key can be used to programmatically access and configure this AnythingLLM instance.", + name: { + label: "Name", + placeholder: "Production integration", + helper: + "Optional. Use a friendly name so you can identify this key later.", + }, + }, + row: { + copy: "Copy API Key", + copied: "Copied", + unnamed: "--", + deleteConfirm: + "Are you sure you want to deactivate this api key?\nAfter you do this it will not longer be useable.\n\nThis action is irreversible.", + }, table: { + name: "Name", key: "API Key", by: "Created By", created: "Created", @@ -690,8 +717,6 @@ const TRANSLATIONS = { description: "Paste the API token you received from @BotFather to connect your bot.", "bot-token": "Bot Token", - "default-workspace": "Default Workspace", - "no-workspace": "No available workspaces. A new one will be created.", connecting: "Connecting...", "connect-bot": "Connect Bot", }, @@ -728,20 +753,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Failed to revoke user.", }, users: { - "pending-title": "Pending Approval", "pending-description": "Users waiting to be verified. Match the pairing code shown here with the one displayed in their Telegram chat.", - "approved-title": "Approved Users", - "approved-description": - "Users who have been approved to chat with your bot.", - user: "User", - "pairing-code": "Pairing Code", - "no-pending": "No pending requests", - "no-approved": "No approved users", unknown: "Unknown", - approve: "Approve", - deny: "Deny", - revoke: "Revoke", }, }, security: { diff --git a/frontend/src/locales/es/common.js b/frontend/src/locales/es/common.js index 0e7c83f7d..8d01948d2 100644 --- a/frontend/src/locales/es/common.js +++ b/frontend/src/locales/es/common.js @@ -578,7 +578,34 @@ const TRANSLATIONS = { "Las claves de API permiten al titular acceder y administrar programáticamente esta instancia de AnythingLLM.", link: "Leer la documentación de la API", generate: "Generar nueva clave de API", + empty: "No se encontraron claves API", + actions: "Acciones", + messages: { + error: "Error: {{error}}", + }, + modal: { + title: "Crear nueva clave API", + cancel: "Cancelar", + close: "Cerrar", + create: "Crear clave API", + helper: + "Una vez creada, la clave API se puede usar para acceder y configurar esta instancia de AnythingLLM mediante programación.", + name: { + label: "Nombre", + placeholder: "Integración de producción", + helper: + "Opcional. Usa un nombre descriptivo para poder identificar esta clave más adelante.", + }, + }, + row: { + copy: "Copiar clave API", + copied: "Copiada", + unnamed: "--", + deleteConfirm: + "¿Seguro que deseas desactivar esta clave API?\nDespués de hacerlo ya no se podrá usar.\n\nEsta acción es irreversible.", + }, table: { + name: "Nombre", key: "Clave de API", by: "Creado por", created: "Creado", @@ -1154,9 +1181,6 @@ const TRANSLATIONS = { description: "Copia el token de API que recibiste de @BotFather y selecciona un espacio de trabajo predeterminado para que tu bot pueda comunicarse.", "bot-token": "Token de Bot", - "default-workspace": "Espacio de trabajo predeterminado", - "no-workspace": - "No hay espacios de trabajo disponibles. Se creará uno nuevo.", connecting: "Conectando...", "connect-bot": "Bot de conexión", }, @@ -1198,20 +1222,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "No se pudo revocar el acceso del usuario.", }, users: { - "pending-title": "Sujeto a aprobación", "pending-description": "Usuarios que están esperando la verificación. Compara el código de emparejamiento que se muestra aquí con el que aparece en su conversación de Telegram.", - "approved-title": "Usuarios autorizados", - "approved-description": - "Usuarios que han sido aprobados para comunicarse con tu bot.", - user: "Usuario", - "pairing-code": "Código de combinación", - "no-pending": "No hay solicitudes pendientes.", - "no-approved": "Usuarios no autorizados", unknown: "Desconocido", - approve: "Aprobar", - deny: "Negar", - revoke: "Revocar", }, }, }; diff --git a/frontend/src/locales/et/common.js b/frontend/src/locales/et/common.js index 5ebf36664..997fa203c 100644 --- a/frontend/src/locales/et/common.js +++ b/frontend/src/locales/et/common.js @@ -550,7 +550,34 @@ const TRANSLATIONS = { "API võtmed võimaldavad programmipõhiselt hallata seda AnythingLLM instantsi.", link: "Loe API dokumentatsiooni", generate: "Genereeri uus API võti", + empty: "API võtmeid ei leitud", + actions: "Toimingud", + messages: { + error: "Viga: {{error}}", + }, + modal: { + title: "Loo uus API võti", + cancel: "Tühista", + close: "Sulge", + create: "Loo API võti", + helper: + "Pärast loomist saab API võtit kasutada sellele AnythingLLM-i instantsile programmiga ligi pääsemiseks ja selle seadistamiseks.", + name: { + label: "Nimi", + placeholder: "Tootmiskeskkonna integratsioon", + helper: + "Valikuline. Kasuta sõbralikku nime, et saaksid võtme hiljem hõlpsasti ära tunda.", + }, + }, + row: { + copy: "Kopeeri API võti", + copied: "Kopeeritud", + unnamed: "--", + deleteConfirm: + "Kas soovite selle API võtme kindlasti deaktiveerida?\nPärast seda ei saa seda enam kasutada.\n\nSeda toimingut ei saa tagasi võtta.", + }, table: { + name: "Nimi", key: "API võti", by: "Loonud", created: "Loodud", @@ -1088,9 +1115,6 @@ const TRANSLATIONS = { description: "Kleepige API-token, mis teil on saanud kasutaja @BotFatherilt, ning valige oma botile vaikimõistmine.", "bot-token": "Bot token", - "default-workspace": "Vaikimisi kasutatav tööruum", - "no-workspace": - "Praegu pole saadaval vaba töökohti. Ühe uue töökohtade loomine on plaanis.", connecting: "Ühendamine...", "connect-bot": "Ühendusrobott", }, @@ -1129,20 +1153,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Ebaõnnestuti kasutaja konto kustutamises.", }, users: { - "pending-title": "Ootea faasis, ootamas heakskiitu", "pending-description": "Kasutajad, kes ootavad kinnitamist. Võrdige siin näidatud vastuvõtusümboli koos nende Telegrami vestluses näidatud sümboliga.", - "approved-title": "Heakskiidud kasutajad", - "approved-description": - "Kasutajad, kellele on antud lubadus teie botiga vestelda.", - user: "Kasutaja", - "pairing-code": "Koosamis kood", - "no-pending": "Hetkel pole ootamisel ühtegi taotlust", - "no-approved": "Pole heakskiidud kasutajaid", unknown: "Tuntud pole", - approve: "Heakskiid", - deny: "Nõgata", - revoke: "Tingimata", }, }, }; diff --git a/frontend/src/locales/fa/common.js b/frontend/src/locales/fa/common.js index 94f0de03a..8e71828b7 100644 --- a/frontend/src/locales/fa/common.js +++ b/frontend/src/locales/fa/common.js @@ -469,7 +469,34 @@ const TRANSLATIONS = { "کلیدهای API به دارنده آن‌ها اجازه می‌دهند به صورت برنامه‌نویسی به این نمونه AnythingLLM دسترسی داشته و آن را مدیریت کنند.", link: "مطالعه مستندات API", generate: "ایجاد کلید API جدید", + empty: "هیچ کلید API یافت نشد", + actions: "اقدامات", + messages: { + error: "خطا: {{error}}", + }, + modal: { + title: "ایجاد کلید API جدید", + cancel: "لغو", + close: "بستن", + create: "ایجاد کلید API", + helper: + "پس از ایجاد، می‌توان از این کلید API برای دسترسی و پیکربندی برنامه‌نویسی‌شده این نمونه AnythingLLM استفاده کرد.", + name: { + label: "نام", + placeholder: "یکپارچه‌سازی تولید", + helper: + "اختیاری است. از یک نام قابل‌فهم استفاده کنید تا بعداً بتوانید این کلید را تشخیص دهید.", + }, + }, + row: { + copy: "کپی کلید API", + copied: "کپی شد", + unnamed: "--", + deleteConfirm: + "آیا مطمئن هستید که می‌خواهید این کلید API را غیرفعال کنید؟\nپس از این کار، دیگر قابل استفاده نخواهد بود.\n\nاین عمل غیرقابل بازگشت است.", + }, table: { + name: "نام", key: "کلید API", by: "ایجاد شده توسط", created: "تاریخ ایجاد", @@ -1123,9 +1150,6 @@ const TRANSLATIONS = { description: "توکن API را که از @BotFather دریافت کرده‌اید، کپی کنید و یک فضای کاری پیش‌فرض را برای ربات خود انتخاب کنید تا بتواند با کاربران ارتباط برقرار کند.", "bot-token": "توکن ربات", - "default-workspace": "فضای کاری پیش‌فرض", - "no-workspace": - "فضاهای کاری موجود نیست. یک فضای کاری جدید ایجاد خواهد شد.", connecting: "در حال اتصال...", "connect-bot": "اتصال ربات", }, @@ -1165,19 +1189,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "امکان لغو کردن حساب کاربری وجود نداشت.", }, users: { - "pending-title": "منتظر تایید", "pending-description": "کاربرانی که منتظر تایید هستند. کد تطبیقی که در اینجا نشان داده شده را با کد موجود در چت تلگرام خود مطابقت دهید.", - "approved-title": "کاربران تایید شده", - "approved-description": "کاربرانی که مجوز دارند با ربات شما گفتگو کنند.", - user: "کاربر", - "pairing-code": "کد جفت‌سازی", - "no-pending": "هیچ درخواست در حال انجام وجود ندارد.", - "no-approved": "کاربران تایید شده وجود ندارد", unknown: "نامشخص", - approve: "تایید", - deny: "رد", - revoke: "اعلام لغو", }, }, }; diff --git a/frontend/src/locales/fr/common.js b/frontend/src/locales/fr/common.js index 6ac9611eb..012d6f8c8 100644 --- a/frontend/src/locales/fr/common.js +++ b/frontend/src/locales/fr/common.js @@ -475,7 +475,34 @@ const TRANSLATIONS = { "Les clés API permettent au titulaire d'accéder et de gérer de manière programmatique cette instance AnythingLLM.", link: "Lisez la documentation de l'API", generate: "Générer une nouvelle clé API", + empty: "Aucune clé API trouvée", + actions: "Actions", + messages: { + error: "Erreur : {{error}}", + }, + modal: { + title: "Créer une nouvelle clé API", + cancel: "Annuler", + close: "Fermer", + create: "Créer une clé API", + helper: + "Une fois créée, la clé API peut être utilisée pour accéder à cette instance AnythingLLM et la configurer de manière programmatique.", + name: { + label: "Nom", + placeholder: "Intégration de production", + helper: + "Facultatif. Utilisez un nom explicite pour pouvoir retrouver facilement cette clé plus tard.", + }, + }, + row: { + copy: "Copier la clé API", + copied: "Copiée", + unnamed: "--", + deleteConfirm: + "Voulez-vous vraiment désactiver cette clé API ?\nAprès cela, elle ne pourra plus être utilisée.\n\nCette action est irréversible.", + }, table: { + name: "Nom", key: "Clé API", by: "Créé par", created: "Créé", @@ -1132,9 +1159,6 @@ const TRANSLATIONS = { description: "Collez le jeton API que vous avez reçu de @BotFather et sélectionnez un espace de travail par défaut pour que votre bot puisse communiquer.", "bot-token": "Token Bot", - "default-workspace": "Espace de travail par défaut", - "no-workspace": - "Il n'y a pas d'espaces de travail disponibles. Un nouvel espace sera créé.", connecting: "Connexion...", "connect-bot": "Bot de connexion", }, @@ -1175,20 +1199,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Impossible de supprimer l'utilisateur.", }, users: { - "pending-title": "En attente d'approbation", "pending-description": "Utilisateurs en attente de vérification. Correspondez le code de correspondance affiché ici avec celui qui apparaît dans leur conversation Telegram.", - "approved-title": "Utilisateurs autorisés", - "approved-description": - "Utilisateurs qui ont été autorisés à communiquer avec votre bot.", - user: "Utilisateur", - "pairing-code": "Code de correspondance", - "no-pending": "Aucune demande en cours", - "no-approved": "Aucun utilisateur autorisé", unknown: "Inconnu", - approve: "Approuver", - deny: "Rejeter", - revoke: "Annuler", }, }, }; diff --git a/frontend/src/locales/he/common.js b/frontend/src/locales/he/common.js index 83c7a9022..34bc159d9 100644 --- a/frontend/src/locales/he/common.js +++ b/frontend/src/locales/he/common.js @@ -550,7 +550,33 @@ const TRANSLATIONS = { "מפתחות API מאפשרים למחזיק בהם לגשת ולנהל באופן תכנותי את מופע AnythingLLM זה.", link: "קרא את תיעוד ה-API", generate: "צור מפתח API חדש", + empty: "לא נמצאו מפתחות API", + actions: "פעולות", + messages: { + error: "שגיאה: {{error}}", + }, + modal: { + title: "יצירת מפתח API חדש", + cancel: "ביטול", + close: "סגירה", + create: "צור מפתח API", + helper: + "לאחר יצירתו, ניתן להשתמש במפתח ה-API כדי לגשת למופע AnythingLLM זה ולהגדיר אותו באופן תכנותי.", + name: { + label: "שם", + placeholder: "אינטגרציית ייצור", + helper: "אופציונלי. השתמש בשם ברור כדי שתוכל לזהות את המפתח הזה בהמשך.", + }, + }, + row: { + copy: "העתק מפתח API", + copied: "הועתק", + unnamed: "--", + deleteConfirm: + "האם אתה בטוח שברצונך להשבית את מפתח ה-API הזה?\nלאחר מכן לא יהיה ניתן להשתמש בו יותר.\n\nלא ניתן לבטל פעולה זו.", + }, table: { + name: "שם", key: "מפתח API", by: "נוצר על ידי", created: "נוצר", @@ -1090,8 +1116,6 @@ const TRANSLATIONS = { description: "הדבק את טוקן ה-API שקיבלת מחשבון @BotFather ובחר את חלל העבודה הראשי עבור הבוט שלך, כדי שיוכל לתקשר.", "bot-token": "טוקן בוט", - "default-workspace": "סביבת עבודה ברירת מחדל", - "no-workspace": "אין מקומות עבודה זמינים. ייקבע מקום עבודה חדש.", connecting: "חיבור...", "connect-bot": "צ'אטבוט", }, @@ -1128,19 +1152,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "לא הצלחתי לבטל את החשבון של המשתמש.", }, users: { - "pending-title": "נמצא בהמתנה לאישור", "pending-description": "משתמשים הממתינים לאישור. יש להתאים את הקוד שמוצג כאן עם הקוד המוצג בשיחה שלהם ב-Telegram.", - "approved-title": "משתמשים מורשים", - "approved-description": "משתמשים שאושרו לנהל שיחה עם הבוט שלכם.", - user: "משתמש", - "pairing-code": "קוד התאמה", - "no-pending": "אין בקשות בתהליך", - "no-approved": "אין משתמשים מורשים", unknown: "לא ידוע", - approve: "אישור", - deny: "לדחות", - revoke: "בטל", }, }, }; diff --git a/frontend/src/locales/it/common.js b/frontend/src/locales/it/common.js index 76f25f05f..c50c7fe45 100644 --- a/frontend/src/locales/it/common.js +++ b/frontend/src/locales/it/common.js @@ -476,7 +476,34 @@ const TRANSLATIONS = { "Le chiavi API consentono al titolare di accedere e gestire in modo programmatico questa istanza AnythingLLM.", link: "Leggi la documentazione API", generate: "Genera nuova chiave API", + empty: "Nessuna chiave API trovata", + actions: "Azioni", + messages: { + error: "Errore: {{error}}", + }, + modal: { + title: "Crea una nuova chiave API", + cancel: "Annulla", + close: "Chiudi", + create: "Crea chiave API", + helper: + "Una volta creata, la chiave API può essere usata per accedere e configurare questa istanza AnythingLLM in modo programmatico.", + name: { + label: "Nome", + placeholder: "Integrazione di produzione", + helper: + "Facoltativo. Usa un nome descrittivo così potrai riconoscere questa chiave in seguito.", + }, + }, + row: { + copy: "Copia chiave API", + copied: "Copiata", + unnamed: "--", + deleteConfirm: + "Sei sicuro di voler disattivare questa chiave API?\nDopo questa azione non potrà più essere utilizzata.\n\nQuesta azione è irreversibile.", + }, table: { + name: "Nome", key: "Chiave API", by: "Creato da", created: "Creato", @@ -1155,9 +1182,6 @@ const TRANSLATIONS = { description: "Incolla il token API che hai ricevuto da @BotFather e seleziona uno spazio di lavoro predefinito per il tuo bot, in modo che possa comunicare.", "bot-token": "Token Bot", - "default-workspace": "Spazio di lavoro predefinito", - "no-workspace": - "Non sono disponibili spazi di lavoro. Ne verrà creato uno nuovo.", connecting: "Connessione...", "connect-bot": "Bot di connessione", }, @@ -1199,20 +1223,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Impossibile revocare l'accesso dell'utente.", }, users: { - "pending-title": "In attesa di approvazione", "pending-description": "Utenti in attesa di verifica. Confrontare il codice di abbinamento visualizzato qui con quello visualizzato nella loro chat di Telegram.", - "approved-title": "Utenti approvati", - "approved-description": - "Utenti che sono stati approvati per chattare con il vostro bot.", - user: "Utente", - "pairing-code": "Codice di abbinamento", - "no-pending": "Non ci sono richieste in sospeso.", - "no-approved": "Nessun utente autorizzato", unknown: "Sconosciuto", - approve: "Approvare", - deny: "Negare", - revoke: "Annullare", }, }, }; diff --git a/frontend/src/locales/ja/common.js b/frontend/src/locales/ja/common.js index 8a812af36..45efa55b1 100644 --- a/frontend/src/locales/ja/common.js +++ b/frontend/src/locales/ja/common.js @@ -465,7 +465,33 @@ const TRANSLATIONS = { "APIキーにより、プログラム経由でこのAnythingLLMインスタンスにアクセスおよび管理できます。", link: "APIドキュメントを読む", generate: "新しいAPIキーを生成", + empty: "APIキーが見つかりません", + actions: "操作", + messages: { + error: "エラー: {{error}}", + }, + modal: { + title: "新しいAPIキーを作成", + cancel: "キャンセル", + close: "閉じる", + create: "APIキーを作成", + helper: + "作成したAPIキーは、このAnythingLLMインスタンスにプログラムからアクセスして設定するために使用できます。", + name: { + label: "名前", + placeholder: "本番環境の統合", + helper: "任意です。後でこのキーを識別しやすい名前を付けてください。", + }, + }, + row: { + copy: "APIキーをコピー", + copied: "コピー済み", + unnamed: "--", + deleteConfirm: + "このAPIキーを無効化してもよろしいですか?\n無効化すると、以後このキーは使用できなくなります。\n\nこの操作は元に戻せません。", + }, table: { + name: "名前", key: "APIキー", by: "作成者", created: "作成日", @@ -1128,9 +1154,6 @@ const TRANSLATIONS = { description: "@BotFatherから受け取ったAPIトークンを貼り付け、ボットとのチャットに使用するデフォルトのワークスペースを選択してください。", "bot-token": "ボット トークン", - "default-workspace": "デフォルトのワークスペース", - "no-workspace": - "利用可能な作業スペースがありません。新しい作業スペースが作成されます。", connecting: "接続中...", "connect-bot": "コネクトボット", }, @@ -1168,20 +1191,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "ユーザーの権限停止に失敗。", }, users: { - "pending-title": "承認待ち", "pending-description": "本人情報の確認待ちのユーザー。ここに表示されているペアリングコードを、彼らがTelegramで表示しているコードと照合してください。", - "approved-title": "承認されたユーザー", - "approved-description": - "あなたのボットとのチャットを許可されたユーザー。", - user: "利用者", - "pairing-code": "組み合わせコード", - "no-pending": "処理中のリクエストはありません", - "no-approved": "承認されたユーザーはいません", unknown: "不明", - approve: "承認", - deny: "否定", - revoke: "無効化する", }, }, }; diff --git a/frontend/src/locales/ko/common.js b/frontend/src/locales/ko/common.js index 4ea4b7766..c3a6240c9 100644 --- a/frontend/src/locales/ko/common.js +++ b/frontend/src/locales/ko/common.js @@ -556,7 +556,34 @@ const TRANSLATIONS = { "API 키는 소유자가 프로그래밍 방식으로 이 AnythingLLM 인스턴스에 액세스하고 관리할 수 있도록 합니다.", link: "API 문서 읽기", generate: "새 API 키 생성", + empty: "API 키를 찾을 수 없습니다", + actions: "작업", + messages: { + error: "오류: {{error}}", + }, + modal: { + title: "새 API 키 만들기", + cancel: "취소", + close: "닫기", + create: "API 키 만들기", + helper: + "생성된 API 키는 이 AnythingLLM 인스턴스에 프로그래밍 방식으로 접근하고 구성하는 데 사용할 수 있습니다.", + name: { + label: "이름", + placeholder: "프로덕션 통합", + helper: + "선택 사항입니다. 나중에 쉽게 식별할 수 있도록 알아보기 쉬운 이름을 사용하세요.", + }, + }, + row: { + copy: "API 키 복사", + copied: "복사됨", + unnamed: "--", + deleteConfirm: + "이 API 키를 비활성화하시겠습니까?\n비활성화하면 더 이상 사용할 수 없습니다.\n\n이 작업은 되돌릴 수 없습니다.", + }, table: { + name: "이름", key: "API 키", by: "생성한 사람", created: "생성일", @@ -1107,9 +1134,6 @@ const TRANSLATIONS = { description: "@BotFather로부터 받은 API 토큰을 복사하여, 봇이 채팅할 기본 워크스페이스를 선택하세요.", "bot-token": "봇 토큰", - "default-workspace": "기본 워크스페이스", - "no-workspace": - "사용 가능한 작업 공간이 없습니다. 새로운 작업 공간이 생성될 것입니다.", connecting: "연결 중...", "connect-bot": "연결 봇", }, @@ -1147,19 +1171,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "사용자 계정 삭제에 실패했습니다.", }, users: { - "pending-title": "승인 대기 중", "pending-description": "승인 대기 중인 사용자. 여기 표시된 매칭 코드를 자신의 Telegram 채팅에서 표시된 코드로 일치시켜 주세요.", - "approved-title": "승인된 사용자", - "approved-description": "당신의 봇과 대화할 수 있도록 승인된 사용자.", - user: "사용자", - "pairing-code": "코드 매칭", - "no-pending": "처리 중인 요청이 없습니다.", - "no-approved": "승인된 사용자가 없습니다", unknown: "알 수 없음", - approve: "승인", - deny: "부인", - revoke: "취소", }, }, }; diff --git a/frontend/src/locales/lt/common.js b/frontend/src/locales/lt/common.js index 5c87cb648..cc798cd65 100644 --- a/frontend/src/locales/lt/common.js +++ b/frontend/src/locales/lt/common.js @@ -571,7 +571,34 @@ const TRANSLATIONS = { "API raktai leidžia programiškai pasiekti ir valdyti šią AnythingLLM instanciją.", link: "Skaityti API dokumentaciją", generate: "Generuoti naują API raktą", + empty: "API raktų nerasta", + actions: "Veiksmai", + messages: { + error: "Klaida: {{error}}", + }, + modal: { + title: "Sukurti naują API raktą", + cancel: "Atšaukti", + close: "Uždaryti", + create: "Sukurti API raktą", + helper: + "Sukūrus API raktą, jį galima naudoti programiškai pasiekti ir konfigūruoti šį AnythingLLM egzempliorių.", + name: { + label: "Pavadinimas", + placeholder: "Produkcinė integracija", + helper: + "Neprivaloma. Naudokite aiškų pavadinimą, kad vėliau lengvai atpažintumėte šį raktą.", + }, + }, + row: { + copy: "Kopijuoti API raktą", + copied: "Nukopijuota", + unnamed: "--", + deleteConfirm: + "Ar tikrai norite išjungti šį API raktą?\nPo to jo nebebus galima naudoti.\n\nŠio veiksmo atšaukti negalima.", + }, table: { + name: "Pavadinimas", key: "API raktas", by: "Sukūrė", created: "Sukurta", @@ -1129,8 +1156,6 @@ const TRANSLATIONS = { description: "Įveskite API žymiklį, kurį gavote iš @BotFather, ir pasirinkite numatytą darbo vietą, kur jūsų bot galės kalbėti.", "bot-token": "„Bot Token“", - "default-workspace": "Numatytasis darbo erdvė", - "no-workspace": "Nėra laisvų darbo vietų. Bus sukurta nauja.", connecting: "Prisijungiam...", "connect-bot": "„Connect Bot“", }, @@ -1171,20 +1196,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Nepavyko atšalinti vartotojo.", }, users: { - "pending-title": "Laikant patvirtinimo", "pending-description": "Naudotojai, laukiantys patvirtinimo. Palyginkite čia pateiktą kodą su tuo, kuris rodomas jų „Telegram“ pokalbyje.", - "approved-title": "Įsijungę vartotojai", - "approved-description": - "Naudotojai, kuriems suteikiama galimybė kalbėti su jūsų botu.", - user: "Naudotojas", - "pairing-code": "Kombinacijos kodas", - "no-pending": "Nėra atidėtų užklausų", - "no-approved": "Nėra patvirtintų vartotojų", unknown: "Nenurodytas", - approve: "Aptinka", - deny: "Atsisakyti", - revoke: "Anuliuoti", }, }, }; diff --git a/frontend/src/locales/lv/common.js b/frontend/src/locales/lv/common.js index c7aebd705..9339bf2c3 100644 --- a/frontend/src/locales/lv/common.js +++ b/frontend/src/locales/lv/common.js @@ -565,7 +565,34 @@ const TRANSLATIONS = { "API atslēgas ļauj to īpašniekam programmatiski piekļūt un pārvaldīt šo AnythingLLM instanci.", link: "Lasīt API dokumentāciju", generate: "Ģenerēt jaunu API atslēgu", + empty: "API atslēgas nav atrastas", + actions: "Darbības", + messages: { + error: "Kļūda: {{error}}", + }, + modal: { + title: "Izveidot jaunu API atslēgu", + cancel: "Atcelt", + close: "Aizvērt", + create: "Izveidot API atslēgu", + helper: + "Pēc izveides API atslēgu var izmantot, lai programmatiski piekļūtu šai AnythingLLM instancei un to konfigurētu.", + name: { + label: "Nosaukums", + placeholder: "Produkcijas integrācija", + helper: + "Nav obligāti. Izmantojiet saprotamu nosaukumu, lai vēlāk šo atslēgu būtu viegli atpazīt.", + }, + }, + row: { + copy: "Kopēt API atslēgu", + copied: "Nokopēts", + unnamed: "--", + deleteConfirm: + "Vai tiešām vēlaties deaktivizēt šo API atslēgu?\nPēc tam to vairs nevarēs izmantot.\n\nŠo darbību nevar atsaukt.", + }, table: { + name: "Nosaukums", key: "API atslēga", by: "Izveidoja", created: "Izveidots", @@ -1135,8 +1162,6 @@ const TRANSLATIONS = { description: "Ievietojiet API atslēgu, ko saņēsit no @BotFather, un izvēlieties nokārtotā darba telpu, kuras jūsu bots varēs veikt sazi.", "bot-token": "Bots tokens", - "default-workspace": "Pamatojas darba videne", - "no-workspace": "Nav pieejamas darba vietas. Tiks izveidota jauna.", connecting: "Savienojums...", "connect-bot": "Saistītais bot", }, @@ -1177,20 +1202,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Neizdevās atcelt lietotāja tiesības.", }, users: { - "pending-title": "Atkarībā no apstākļiem", "pending-description": "Izmantotāji, kas gaida apstiprinājumu. Salīdziniet šeit norādīto koda numuru ar to, kas redzams viņu Telegram sarunā.", - "approved-title": "Atļautie lietotāji", - "approved-description": - "Izmantotāji, kuriem ir atļauts veikt saziņai ar jūsu botu.", - user: "Izmantotājs", - "pairing-code": "Kopējā koda numura kombinācija", - "no-pending": "Neizpildīti pieprasījumi", - "no-approved": "No apstiprinātiem lietotājiem", unknown: "Nezināms", - approve: "Aptver", - deny: "Atbrīsties; atgrūst", - revoke: "Atcel", }, }, }; diff --git a/frontend/src/locales/nl/common.js b/frontend/src/locales/nl/common.js index 536b341d2..371e71100 100644 --- a/frontend/src/locales/nl/common.js +++ b/frontend/src/locales/nl/common.js @@ -471,7 +471,34 @@ const TRANSLATIONS = { "API-sleutels stellen de houder in staat om deze AnythingLLM-instantie programmatisch te openen en beheren.", link: "Lees de API-documentatie", generate: "Genereer Nieuwe API-sleutel", + empty: "Geen API-sleutels gevonden", + actions: "Acties", + messages: { + error: "Fout: {{error}}", + }, + modal: { + title: "Nieuwe API-sleutel maken", + cancel: "Annuleren", + close: "Sluiten", + create: "API-sleutel maken", + helper: + "Na het aanmaken kan de API-sleutel worden gebruikt om programmatisch toegang te krijgen tot deze AnythingLLM-instantie en deze te configureren.", + name: { + label: "Naam", + placeholder: "Productie-integratie", + helper: + "Optioneel. Gebruik een duidelijke naam zodat je deze sleutel later makkelijk kunt herkennen.", + }, + }, + row: { + copy: "API-sleutel kopiëren", + copied: "Gekopieerd", + unnamed: "--", + deleteConfirm: + "Weet je zeker dat je deze API-sleutel wilt uitschakelen?\nDaarna kan deze niet meer worden gebruikt.\n\nDeze actie kan niet ongedaan worden gemaakt.", + }, table: { + name: "Naam", key: "API-sleutel", by: "Aangemaakt Door", created: "Aangemaakt", @@ -1135,9 +1162,6 @@ const TRANSLATIONS = { description: "Plak de API-token die je van @BotFather hebt ontvangen en selecteer een standaard werkruimte voor je bot om mee te communiceren.", "bot-token": "Bot-token", - "default-workspace": "Standaard werkruimte", - "no-workspace": - "Er zijn geen beschikbare werkplekken. Een nieuwe zal worden aangemaakt.", connecting: "Verbinding wordt gemaakt...", "connect-bot": "Connect Bot", }, @@ -1180,20 +1204,9 @@ const TRANSLATIONS = { "Fout bij het intrekken van het gebruikersaccount.", }, users: { - "pending-title": "Afhankelijk van goedkeuring", "pending-description": "Gebruikers die nog geverifieerd moeten worden. Vergelijk de code die hier wordt getoond met de code die in hun Telegram-chat wordt weergegeven.", - "approved-title": "Goedgekeurde gebruikers", - "approved-description": - "Gebruikers die zijn goedgekeurd om met uw bot te communiceren.", - user: "Gebruiker", - "pairing-code": "Code voor het koppelen", - "no-pending": "Er zijn geen lopende verzoeken.", - "no-approved": "Geen goedgekeurde gebruikers", unknown: "Onbekend", - approve: "Goedkeuren", - deny: "Afgewijzen", - revoke: "Intrekken", }, }, }; diff --git a/frontend/src/locales/pl/common.js b/frontend/src/locales/pl/common.js index c0aad7832..78c86bebd 100644 --- a/frontend/src/locales/pl/common.js +++ b/frontend/src/locales/pl/common.js @@ -566,7 +566,34 @@ const TRANSLATIONS = { "Klucze API umożliwiają dostęp do instancji AnythingLLM i zarządzanie nią.", link: "Przeczytaj dokumentację API", generate: "Generuj nowy klucz API", + empty: "Nie znaleziono kluczy API", + actions: "Akcje", + messages: { + error: "Błąd: {{error}}", + }, + modal: { + title: "Utwórz nowy klucz API", + cancel: "Anuluj", + close: "Zamknij", + create: "Utwórz klucz API", + helper: + "Po utworzeniu klucz API może być używany do programowego dostępu do tej instancji AnythingLLM i jej konfiguracji.", + name: { + label: "Nazwa", + placeholder: "Integracja produkcyjna", + helper: + "Opcjonalne. Użyj przyjaznej nazwy, aby później łatwo rozpoznać ten klucz.", + }, + }, + row: { + copy: "Kopiuj klucz API", + copied: "Skopiowano", + unnamed: "--", + deleteConfirm: + "Czy na pewno chcesz dezaktywować ten klucz API?\nPo tej operacji nie będzie już można go używać.\n\nTej akcji nie można cofnąć.", + }, table: { + name: "Nazwa", key: "Klucz API", by: "Utworzony przez", created: "Utworzony o", @@ -1132,9 +1159,6 @@ const TRANSLATIONS = { description: "Wklej token API, który otrzymałeś od @BotFather, i wybierz domyślny przestrzeń roboczą, z której Twój bot będzie mógł komunikować się.", "bot-token": "Token Bot", - "default-workspace": "Domyślne miejsce pracy", - "no-workspace": - "Brak dostępnych miejsc pracy. Nowe zostanie utworzone.", connecting: "Połączenie...", "connect-bot": "Bot łączący", }, @@ -1175,20 +1199,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Nie udało się odwołać konta użytkownika.", }, users: { - "pending-title": "Czekając na zatwierdzenie", "pending-description": "Użytkownicy, którzy czekają na weryfikację. Dopasuj kod parowania, który znajduje się tutaj, z tym, który widnieje w ich rozmowie na Telegramie.", - "approved-title": "Użytkownicy, którym przyznano uprawnienia", - "approved-description": - "Użytkownicy, którzy zostali zatwierdzeni do rozmowy z Twoim botem.", - user: "Użytkownik", - "pairing-code": "Kod dopasowania", - "no-pending": "Brak oczekujących żądań", - "no-approved": "Brak zatwierdzonych użytkowników", unknown: "Nieznany", - approve: "Zaakceptować", - deny: "Odrzucać", - revoke: "Odstrzegać", }, }, }; diff --git a/frontend/src/locales/pt_BR/common.js b/frontend/src/locales/pt_BR/common.js index 7a5367496..52ae9c3a1 100644 --- a/frontend/src/locales/pt_BR/common.js +++ b/frontend/src/locales/pt_BR/common.js @@ -558,10 +558,37 @@ const TRANSLATIONS = { description: "Chaves API permitem acesso programático a esta instância.", link: "Leia a documentação da API", generate: "Gerar Nova Chave", + empty: "Nenhuma chave de API encontrada", + actions: "Ações", + messages: { + error: "Erro: {{error}}", + }, + modal: { + title: "Criar nova chave de API", + cancel: "Cancelar", + close: "Fechar", + create: "Criar chave de API", + helper: + "Depois de criada, a chave de API pode ser usada para acessar e configurar esta instância do AnythingLLM programaticamente.", + name: { + label: "Nome", + placeholder: "Integração de produção", + helper: + "Opcional. Use um nome amigável para identificar esta chave depois.", + }, + }, + row: { + copy: "Copiar chave de API", + copied: "Copiado", + unnamed: "--", + deleteConfirm: + "Tem certeza de que deseja desativar esta chave de API?\nDepois disso ela não poderá mais ser usada.\n\nEsta ação é irreversível.", + }, table: { + name: "Nome", key: "Chave API", - by: "Criado Por", - created: "Criado Em", + by: "Criada Por", + created: "Criada Em", }, }, llm: { @@ -1109,9 +1136,6 @@ const TRANSLATIONS = { description: "Cole o token da API que recebeu do @BotFather e selecione um espaço de trabalho padrão para que seu bot possa conversar.", "bot-token": "Token do Bot", - "default-workspace": "Espaço de Trabalho Padrão", - "no-workspace": - "Não há espaços de trabalho disponíveis. Um novo será criado.", connecting: "Conectando...", "connect-bot": "Bot de Conexão", }, @@ -1151,20 +1175,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Falhou ao revogar o acesso do usuário.", }, users: { - "pending-title": "Aguardando Aprovação", "pending-description": "Usuários aguardando a verificação. Compare o código de pareamento exibido aqui com o que aparece em seu chat do Telegram.", - "approved-title": "Usuários Aprovados", - "approved-description": - "Usuários que foram aprovados para conversar com o seu bot.", - user: "Usuário", - "pairing-code": "Código de emparelhamento", - "no-pending": "Não há solicitações pendentes.", - "no-approved": "Sem usuários autorizados", unknown: "Desconhecido", - approve: "Aprovar", - deny: "Negar", - revoke: "Anular", }, }, }; diff --git a/frontend/src/locales/ro/common.js b/frontend/src/locales/ro/common.js index d10d998ea..9248a956d 100644 --- a/frontend/src/locales/ro/common.js +++ b/frontend/src/locales/ro/common.js @@ -1020,7 +1020,34 @@ const TRANSLATIONS = { "Cheile API permit deținătorului să acceseze și să gestioneze programatic această instanță AnythingLLM.", link: "Citește documentația API", generate: "Generează o nouă cheie API", + empty: "Nu au fost găsite chei API", + actions: "Acțiuni", + messages: { + error: "Eroare: {{error}}", + }, + modal: { + title: "Creează o cheie API nouă", + cancel: "Anulează", + close: "Închide", + create: "Creează cheia API", + helper: + "După creare, cheia API poate fi folosită pentru a accesa și configura programatic această instanță AnythingLLM.", + name: { + label: "Nume", + placeholder: "Integrare de producție", + helper: + "Opțional. Folosește un nume clar pentru a putea identifica această cheie mai târziu.", + }, + }, + row: { + copy: "Copiază cheia API", + copied: "Copiată", + unnamed: "--", + deleteConfirm: + "Sigur doriți să dezactivați această cheie API?\nDupă aceea nu va mai putea fi folosită.\n\nAceastă acțiune este ireversibilă.", + }, table: { + name: "Nume", key: "Cheie API", by: "Creat de", created: "Creat la", @@ -1135,9 +1162,6 @@ const TRANSLATIONS = { description: "Lipește token-ul API pe care l-ați primit de la @BotFather și selectați un spațiu de lucru implicit pentru ca botul dumneavoastră să poată interacționa.", "bot-token": "Token Bot", - "default-workspace": "Spațiu de lucru implicit", - "no-workspace": - "Nu există spații de lucru disponibile. Va fi creat unul nou.", connecting: "Conectare...", "connect-bot": "Conectare automată", }, @@ -1179,20 +1203,9 @@ const TRANSLATIONS = { "Nu a fost posibil să se anuleze contul utilizatorului.", }, users: { - "pending-title": "Așteptare aprobare", "pending-description": "Utilizatorii care așteaptă să fie verificați. Potrivirea codului de asociere afișat aici cu cel afișat în chat-ul lor de pe Telegram.", - "approved-title": "Utilizatori autorizați", - "approved-description": - "Utilizatorii care au fost autorizați să interacționeze cu botul dumneavoastră.", - user: "Utilizator", - "pairing-code": "Cod de asociere", - "no-pending": "Nu există cereri în așteptare.", - "no-approved": "Nu există utilizatori autorizați.", unknown: "Necunoscut", - approve: "Aprobă", - deny: "Negarea", - revoke: "Anula", }, }, }; diff --git a/frontend/src/locales/ru/common.js b/frontend/src/locales/ru/common.js index af1100dd1..e28edbc54 100644 --- a/frontend/src/locales/ru/common.js +++ b/frontend/src/locales/ru/common.js @@ -470,7 +470,34 @@ const TRANSLATIONS = { "API ключи позволяют владельцу программно получать доступ к этому экземпляру AnythingLLM и управлять им.", link: "Прочитать документацию по API", generate: "Создать новый API ключ", + empty: "API-ключи не найдены", + actions: "Действия", + messages: { + error: "Ошибка: {{error}}", + }, + modal: { + title: "Создать новый API-ключ", + cancel: "Отмена", + close: "Закрыть", + create: "Создать API-ключ", + helper: + "После создания API-ключ можно использовать для программного доступа к этому экземпляру AnythingLLM и его настройки.", + name: { + label: "Название", + placeholder: "Продакшн-интеграция", + helper: + "Необязательно. Используйте понятное имя, чтобы потом легко узнать этот ключ.", + }, + }, + row: { + copy: "Копировать API-ключ", + copied: "Скопировано", + unnamed: "--", + deleteConfirm: + "Вы уверены, что хотите деактивировать этот API-ключ?\nПосле этого его больше нельзя будет использовать.\n\nЭто действие необратимо.", + }, table: { + name: "Название", key: "API ключ", by: "Создано", created: "Создано", @@ -1141,8 +1168,6 @@ const TRANSLATIONS = { description: "Вставьте API-токен, который вы получили от @BotFather, и выберите основной рабочий стол для вашего бота, чтобы он мог общаться.", "bot-token": "Токен бота", - "default-workspace": "Основной рабочий стол", - "no-workspace": "Недоступны рабочие места. Будет создано новое.", connecting: "Устанавливается соединение...", "connect-bot": "Bot Connect", }, @@ -1184,20 +1209,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Не удалось отменить действия пользователя.", }, users: { - "pending-title": "Ожидается утверждение", "pending-description": "Пользователи, ожидающие подтверждения. Сравните код, указанный здесь, с кодом, отображаемым в их чате в Telegram.", - "approved-title": "Утвержденные пользователи", - "approved-description": - "Пользователи, которым разрешено общаться с вашим ботом.", - user: "Пользователь", - "pairing-code": "Код сопоставления", - "no-pending": "Отсутствуют незавершенные запросы.", - "no-approved": "Нет зарегистрированных пользователей", unknown: "Неизвестно", - approve: "Одобрить", - deny: "Отрицать", - revoke: "Отменить", }, }, }; diff --git a/frontend/src/locales/tr/common.js b/frontend/src/locales/tr/common.js index c84a76e8e..620812da4 100644 --- a/frontend/src/locales/tr/common.js +++ b/frontend/src/locales/tr/common.js @@ -466,12 +466,39 @@ const TRANSLATIONS = { }, }, api: { - title: "API Anahtarları", + title: "API anahtarları", description: "API anahtarları, bu AnythingLLM örneğine programatik olarak erişmeye ve yönetmeye olanak tanır.", link: "API dokümantasyonunu okuyun", generate: "Yeni API Anahtarı Oluştur", + empty: "API anahtarları bulunamadı", + actions: "İşlemler", + messages: { + error: "Hata: {{error}}", + }, + modal: { + title: "Yeni API anahtarı oluştur", + cancel: "İptal", + close: "Kapat", + create: "API anahtarı oluştur", + helper: + "Oluşturulduktan sonra API anahtarı, bu AnythingLLM örneğine programatik olarak erişmek ve onu yapılandırmak için kullanılabilir.", + name: { + label: "Ad", + placeholder: "Üretim entegrasyonu", + helper: + "İsteğe bağlıdır. Bu anahtarı daha sonra kolayca tanıyabilmek için açıklayıcı bir ad kullanın.", + }, + }, + row: { + copy: "API anahtarını kopyala", + copied: "Kopyalandı", + unnamed: "--", + deleteConfirm: + "Bu API anahtarını devre dışı bırakmak istediğinizden emin misiniz?\nBunu yaptıktan sonra artık kullanılamaz.\n\nBu işlem geri alınamaz.", + }, table: { + name: "Ad", key: "API Anahtarı", by: "Oluşturan", created: "Oluşturulma Tarihi", @@ -1127,9 +1154,6 @@ const TRANSLATIONS = { description: "Aldığınız API token'ı (@BotFather) kopyalayın ve botunuzun iletişim kuracağı varsayılan çalışma alanını seçin.", "bot-token": "Bot Token", - "default-workspace": "Varsayılan Çalışma Alanı", - "no-workspace": - "Mevcut çalışma alanları bulunmamaktadır. Yeni bir çalışma alanı oluşturulacaktır.", connecting: "Bağlantı kuruluyor...", "connect-bot": "Bağlantı Botu", }, @@ -1169,20 +1193,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Kullanıcıyı silme işlemi başarısız oldu.", }, users: { - "pending-title": "Onay Bekliyor", "pending-description": "Doğrulama işlemi bekleyen kullanıcılar. Burada gösterilen eşleştirme kodunu, Telegram sohbetlerinde görüntülenen kodla karşılaştırın.", - "approved-title": "Onaylanmış Kullanıcılar", - "approved-description": - "Botunuzla sohbet etmeye yetkili olan kullanıcılar.", - user: "Kullanıcı", - "pairing-code": "Eşleştirme Kodu", - "no-pending": "Henüz tamamlanmamış herhangi bir istek bulunmamaktadır.", - "no-approved": "Onaylanmış kullanıcı bulunmamaktadır", unknown: "Bilinmiyor", - approve: "Onayla", - deny: "İnkar", - revoke: "İptal et", }, }, }; diff --git a/frontend/src/locales/vn/common.js b/frontend/src/locales/vn/common.js index d70853f69..ab9fcbd33 100644 --- a/frontend/src/locales/vn/common.js +++ b/frontend/src/locales/vn/common.js @@ -469,7 +469,34 @@ const TRANSLATIONS = { "Khóa API cho phép người sở hữu truy cập và quản lý phiên bản AnythingLLM này theo chương trình.", link: "Đọc tài liệu API", generate: "Tạo Khóa API Mới", + empty: "Không tìm thấy khóa API nào", + actions: "Thao tác", + messages: { + error: "Lỗi: {{error}}", + }, + modal: { + title: "Tạo khóa API mới", + cancel: "Hủy", + close: "Đóng", + create: "Tạo khóa API", + helper: + "Sau khi được tạo, khóa API có thể được dùng để truy cập và cấu hình phiên bản AnythingLLM này theo chương trình.", + name: { + label: "Tên", + placeholder: "Tích hợp production", + helper: + "Tùy chọn. Hãy dùng tên dễ nhận biết để bạn có thể xác định khóa này sau này.", + }, + }, + row: { + copy: "Sao chép khóa API", + copied: "Đã sao chép", + unnamed: "--", + deleteConfirm: + "Bạn có chắc muốn vô hiệu hóa khóa API này không?\nSau đó khóa sẽ không thể sử dụng được nữa.\n\nHành động này không thể hoàn tác.", + }, table: { + name: "Tên", key: "Khóa API", by: "Tạo bởi", created: "Ngày tạo", @@ -1125,9 +1152,6 @@ const TRANSLATIONS = { description: "Dán mã API mà bạn nhận được từ @BotFather và chọn không gian làm việc mặc định để bot của bạn có thể trò chuyện.", "bot-token": "Token Bot", - "default-workspace": "Không gian làm việc mặc định", - "no-workspace": - "Không có không gian làm việc nào khả dụng. Một không gian mới sẽ được tạo ra.", connecting: "Kết nối...", "connect-bot": "Bot kết nối", }, @@ -1167,20 +1191,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "Không thể thu hồi quyền truy cập cho người dùng.", }, users: { - "pending-title": "Chờ phê duyệt", "pending-description": "Người dùng đang chờ xác nhận. So sánh mã ghép đôi được hiển thị ở đây với mã hiển thị trong cuộc trò chuyện Telegram của họ.", - "approved-title": "Người dùng đã được phê duyệt", - "approved-description": - "Người dùng đã được chấp thuận để trò chuyện với bot của bạn.", - user: "Người dùng", - "pairing-code": "Mã ghép", - "no-pending": "Không có yêu cầu nào đang chờ xử lý.", - "no-approved": "Không có người dùng được xác nhận", unknown: "Không xác định", - approve: "Chấp thuận", - deny: "Từ chối", - revoke: "Thu hồi", }, }, }; diff --git a/frontend/src/locales/zh/common.js b/frontend/src/locales/zh/common.js index 088821b44..51968453e 100644 --- a/frontend/src/locales/zh/common.js +++ b/frontend/src/locales/zh/common.js @@ -531,7 +531,32 @@ const TRANSLATIONS = { description: "API 密钥允许持有者以编程方式访问和管理此 AnythingLLM 实例。", link: "阅读 API 文档", generate: "生成新的 API 密钥", + empty: "未找到 API 密钥", + actions: "操作", + messages: { + error: "错误:{{error}}", + }, + modal: { + title: "创建新的 API 密钥", + cancel: "取消", + close: "关闭", + create: "创建 API 密钥", + helper: "创建后,API 密钥可用于以编程方式访问并配置此 AnythingLLM 实例。", + name: { + label: "名称", + placeholder: "生产环境集成", + helper: "可选。使用一个易于识别的名称,以便之后识别此密钥。", + }, + }, + row: { + copy: "复制 API 密钥", + copied: "已复制", + unnamed: "--", + deleteConfirm: + "确定要停用此 API 密钥吗?\n停用后将无法再使用。\n\n此操作不可撤销。", + }, table: { + name: "名称", key: "API 密钥", by: "创建者", created: "创建时间", @@ -1058,8 +1083,6 @@ const TRANSLATIONS = { description: "将您从 @BotFather 获得的 API 令牌粘贴到指定位置,并选择一个默认的工作区,以便您的机器人可以进行对话。", "bot-token": "机器人代币", - "default-workspace": "默认工作区", - "no-workspace": "目前没有可用的工作空间。将会创建一个新的工作空间。", connecting: "正在连接...", "connect-bot": "连接机器人", }, @@ -1095,19 +1118,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "未能撤销用户权限。", }, users: { - "pending-title": "待审批", "pending-description": "等待验证的用户。请将此处显示的配对代码与他们在 Telegram 聊天中显示的配对代码进行匹配。", - "approved-title": "已批准的用户", - "approved-description": "已获得批准,可以与您的机器人进行对话的用户。", - user: "用户", - "pairing-code": "配对代码", - "no-pending": "目前没有待处理的请求", - "no-approved": "未批准的用户", unknown: "未知", - approve: "批准", - deny: "否认", - revoke: "撤销", }, }, }; diff --git a/frontend/src/locales/zh_TW/common.js b/frontend/src/locales/zh_TW/common.js index f070e3a01..4bae18190 100644 --- a/frontend/src/locales/zh_TW/common.js +++ b/frontend/src/locales/zh_TW/common.js @@ -443,7 +443,33 @@ const TRANSLATIONS = { "API 金鑰可讓持有人透過程式方式存取並管理這個 AnythingLLM 系統。", link: "閱讀 API 文件", generate: "產生新的 API 金鑰", + empty: "找不到 API 金鑰", + actions: "操作", + messages: { + error: "錯誤:{{error}}", + }, + modal: { + title: "建立新的 API 金鑰", + cancel: "取消", + close: "關閉", + create: "建立 API 金鑰", + helper: + "建立後,API 金鑰可用於以程式方式存取並設定這個 AnythingLLM 執行個體。", + name: { + label: "名稱", + placeholder: "正式環境整合", + helper: "選填。請使用易於辨識的名稱,方便你之後識別這把金鑰。", + }, + }, + row: { + copy: "複製 API 金鑰", + copied: "已複製", + unnamed: "--", + deleteConfirm: + "確定要停用此 API 金鑰嗎?\n停用後將無法再使用。\n\n此操作無法復原。", + }, table: { + name: "名稱", key: "API 金鑰", by: "建立者", created: "建立時間", @@ -1052,8 +1078,6 @@ const TRANSLATIONS = { description: "請將您從 @BotFather 處獲得的 API 令牌複製並貼上,然後選擇一個預設的工作空間,讓您的機器人與其對話。", "bot-token": "機器人代幣", - "default-workspace": "預設工作空間", - "no-workspace": "目前沒有可用的工作空間。將會創建一個新的工作空間。", connecting: "正在連接...", "connect-bot": "連線機器人", }, @@ -1089,19 +1113,9 @@ const TRANSLATIONS = { "toast-revoke-failed": "未能取消使用者權限。", }, users: { - "pending-title": "待審核", "pending-description": "等待驗證的使用者。請將這裡顯示的配對碼與他們在 Telegram 聊天中顯示的配對碼對齊。", - "approved-title": "已授權的使用者", - "approved-description": "已獲得批准,可以與您的機器人進行對話的使用者。", - user: "使用者", - "pairing-code": "編碼組合", - "no-pending": "目前沒有待處理的請求", - "no-approved": "目前沒有已授權的使用者", unknown: "未知的", - approve: "批准", - deny: "拒絕", - revoke: "撤銷", }, }, }; diff --git a/frontend/src/models/admin.js b/frontend/src/models/admin.js index 132f63384..c34016d5b 100644 --- a/frontend/src/models/admin.js +++ b/frontend/src/models/admin.js @@ -205,10 +205,11 @@ const Admin = { return { apiKeys: [], error: e.message }; }); }, - generateApiKey: async function () { + generateApiKey: async function (data = {}) { return fetch(`${API_BASE}/admin/generate-api-key`, { method: "POST", headers: baseHeaders(), + body: JSON.stringify(data), }) .then((res) => { if (!res.ok) { diff --git a/frontend/src/models/system.js b/frontend/src/models/system.js index 115dbd6dd..cc682df02 100644 --- a/frontend/src/models/system.js +++ b/frontend/src/models/system.js @@ -520,10 +520,11 @@ const System = { return { apiKey: null, error: e.message }; }); }, - generateApiKey: async function () { + generateApiKey: async function (data = {}) { return fetch(`${API_BASE}/system/generate-api-key`, { method: "POST", headers: baseHeaders(), + body: JSON.stringify(data), }) .then((res) => { if (!res.ok) { diff --git a/frontend/src/pages/GeneralSettings/ApiKeys/ApiKeyRow/index.jsx b/frontend/src/pages/GeneralSettings/ApiKeys/ApiKeyRow/index.jsx index 786c89ff5..eb11d3025 100644 --- a/frontend/src/pages/GeneralSettings/ApiKeys/ApiKeyRow/index.jsx +++ b/frontend/src/pages/GeneralSettings/ApiKeys/ApiKeyRow/index.jsx @@ -1,31 +1,25 @@ import { useEffect, useState } from "react"; import Admin from "@/models/admin"; -import showToast from "@/utils/toast"; import { Trash } from "@phosphor-icons/react"; import { userFromStorage } from "@/utils/request"; import System from "@/models/system"; +import { useTranslation } from "react-i18next"; export default function ApiKeyRow({ apiKey, removeApiKey }) { + const { t } = useTranslation(); const [copied, setCopied] = useState(false); const handleDelete = async () => { - if ( - !window.confirm( - `Are you sure you want to deactivate this api key?\nAfter you do this it will not longer be useable.\n\nThis action is irreversible.` - ) - ) - return false; + if (!window.confirm(t("api.row.deleteConfirm"))) return false; const user = userFromStorage(); const Model = !!user ? Admin : System; await Model.deleteApiKey(apiKey.id); - showToast("API Key permanently deleted", "info"); removeApiKey(apiKey.id); }; const copyApiKey = () => { if (!apiKey) return false; window.navigator.clipboard.writeText(apiKey.secret); - showToast("API Key copied to clipboard", "success"); setCopied(true); }; @@ -41,26 +35,37 @@ export default function ApiKeyRow({ apiKey, removeApiKey }) { return ( <> - - - {apiKey.secret} + + + {apiKey.name || t("api.row.unnamed")} - {apiKey.createdBy?.username || "--"} - {apiKey.createdAt} - - - + + + {apiKey.secret} + + + + {apiKey.createdBy?.username || "--"} + + + {new Date(apiKey.createdAt).toLocaleString()} + + +
+ + +
diff --git a/frontend/src/pages/GeneralSettings/ApiKeys/NewApiKeyModal/index.jsx b/frontend/src/pages/GeneralSettings/ApiKeys/NewApiKeyModal/index.jsx index 8e0248b55..220947fb1 100644 --- a/frontend/src/pages/GeneralSettings/ApiKeys/NewApiKeyModal/index.jsx +++ b/frontend/src/pages/GeneralSettings/ApiKeys/NewApiKeyModal/index.jsx @@ -4,10 +4,12 @@ import Admin from "@/models/admin"; import paths from "@/utils/paths"; import { userFromStorage } from "@/utils/request"; import System from "@/models/system"; -import showToast from "@/utils/toast"; +import { useTranslation } from "react-i18next"; export default function NewApiKeyModal({ closeModal, onSuccess }) { + const { t } = useTranslation(); const [apiKey, setApiKey] = useState(null); + const [name, setName] = useState(""); const [error, setError] = useState(null); const [copied, setCopied] = useState(false); @@ -17,7 +19,9 @@ export default function NewApiKeyModal({ closeModal, onSuccess }) { const user = userFromStorage(); const Model = !!user ? Admin : System; - const { apiKey: newApiKey, error } = await Model.generateApiKey(); + const { apiKey: newApiKey, error } = await Model.generateApiKey({ + name, + }); if (!!newApiKey) { setApiKey(newApiKey); onSuccess(); @@ -29,9 +33,6 @@ export default function NewApiKeyModal({ closeModal, onSuccess }) { if (!apiKey) return false; window.navigator.clipboard.writeText(apiKey.secret); setCopied(true); - showToast("API key copied to clipboard", "success", { - clear: true, - }); }; useEffect(() => { @@ -50,7 +51,7 @@ export default function NewApiKeyModal({ closeModal, onSuccess }) {

- Create new API key + {t("api.modal.title")}

) : ( @@ -127,7 +148,7 @@ export default function NewApiKeyModal({ closeModal, onSuccess }) { type="button" className="transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm" > - Close + {t("api.modal.close")} )}
diff --git a/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx b/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx index 9c2e3c2a6..5f235dfc3 100644 --- a/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx +++ b/frontend/src/pages/GeneralSettings/ApiKeys/index.jsx @@ -84,10 +84,13 @@ export default function AdminApiKeys() { containerClassName="flex w-full" /> ) : ( - +
+ {apiKeys.length === 0 ? ( - ) : ( diff --git a/server/endpoints/admin.js b/server/endpoints/admin.js index 430a3e320..a9b32df04 100644 --- a/server/endpoints/admin.js +++ b/server/endpoints/admin.js @@ -503,10 +503,11 @@ function adminEndpoints(app) { async (request, response) => { try { const user = await userFromSession(request, response); - const { apiKey, error } = await ApiKey.create(user.id); + const { name = null } = reqBody(request); + const { apiKey, error } = await ApiKey.create(user.id, name); await EventLogs.logEvent( "api_key_created", - { createdBy: user?.username }, + { createdBy: user?.username, name: apiKey?.name }, user?.id ); return response.status(200).json({ diff --git a/server/endpoints/system.js b/server/endpoints/system.js index 02b238889..a1ebeff7d 100644 --- a/server/endpoints/system.js +++ b/server/endpoints/system.js @@ -985,16 +985,17 @@ function systemEndpoints(app) { app.post( "/system/generate-api-key", [validatedRequest], - async (_, response) => { + async (request, response) => { try { if (response.locals.multiUserMode) { return response.sendStatus(401).end(); } - const { apiKey, error } = await ApiKey.create(); + const { name = null } = reqBody(request); + const { apiKey, error } = await ApiKey.create(null, name); await EventLogs.logEvent( "api_key_created", - {}, + { name: apiKey?.name }, response?.locals?.user?.id ); return response.status(200).json({ diff --git a/server/models/apiKeys.js b/server/models/apiKeys.js index 32727fec8..856c73fe3 100644 --- a/server/models/apiKeys.js +++ b/server/models/apiKeys.js @@ -2,17 +2,20 @@ const prisma = require("../utils/prisma"); const ApiKey = { tablename: "api_keys", - writable: [], + writable: ["name"], makeSecret: () => { const uuidAPIKey = require("uuid-apikey"); return uuidAPIKey.create().apiKey; }, - create: async function (createdByUserId = null) { + create: async function (createdByUserId = null, name = null) { try { + const normalizedName = + typeof name === "string" && name.trim().length > 0 ? name.trim() : null; const apiKey = await prisma.api_keys.create({ data: { + name: normalizedName, secret: this.makeSecret(), createdBy: createdByUserId, }, diff --git a/server/prisma/migrations/20260406120000_init/migration.sql b/server/prisma/migrations/20260406120000_init/migration.sql new file mode 100644 index 000000000..2ade09e19 --- /dev/null +++ b/server/prisma/migrations/20260406120000_init/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "api_keys" ADD COLUMN "name" TEXT; diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index 326e5f585..ef8765afc 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -17,6 +17,7 @@ datasource db { model api_keys { id Int @id @default(autoincrement()) + name String? secret String? @unique createdBy Int? createdAt DateTime @default(now())
+ {t("api.table.name")} + {t("api.table.key")} @@ -97,15 +100,15 @@ export default function AdminApiKeys() { {t("api.table.created")} - {" "} + {t("api.actions")}
- No API keys found + + {t("api.empty")}