Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,333 changes: 1,196 additions & 137 deletions app/(dashboard)/sse/page.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/auth/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function LoginForm({
<div className="relative flex w-full flex-col items-center justify-center bg-white dark:border-neutral-700 dark:bg-neutral-900 lg:w-1/2">
<div className="absolute end-4 top-4 z-10">
<Link
href="/config"
href={buildRoute("/config")}
className="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm transition-colors hover:bg-gray-50 hover:text-gray-800 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-white"
title={t("Server Configuration")}
>
Expand Down
86 changes: 61 additions & 25 deletions hooks/use-sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,125 @@

import { useCallback } from "react"
import { useApi } from "@/contexts/api-context"
import type {
KmsCancelDeletionRequest,
KmsConfigPayload,
KmsCreateKeyRequest,
KmsCreateKeyResponse,
KmsDeleteKeyOptions,
KmsKeyDetailResponse,
KmsKeyListResponse,
KmsMutationResponse,
KmsServiceStatusResponse,
KmsStartRequest,
} from "@/types/kms"

export function useSSE() {
const api = useApi()

const getKMSStatus = useCallback(async () => {
return api.get("/kms/service-status")
const getKMSStatus = useCallback(async (): Promise<KmsServiceStatusResponse> => {
return (await api.get("/kms/service-status")) as KmsServiceStatusResponse
}, [api])

const configureKMS = useCallback(
async (data: Record<string, unknown>) => {
return api.post("/kms/configure", data)
async (data: KmsConfigPayload): Promise<KmsMutationResponse> => {
return (await api.post("/kms/configure", data)) as KmsMutationResponse
},
[api],
)

const startKMS = useCallback(async () => {
return api.post("/kms/start", {})
const reconfigureKMS = useCallback(
async (data: KmsConfigPayload): Promise<KmsMutationResponse> => {
return (await api.post("/kms/reconfigure", data)) as KmsMutationResponse
},
[api],
)

const startKMS = useCallback(async (data: KmsStartRequest = {}): Promise<KmsMutationResponse> => {
return (await api.post("/kms/start", data)) as KmsMutationResponse
}, [api])

const stopKMS = useCallback(async () => {
return api.post("/kms/stop", {})
const stopKMS = useCallback(async (): Promise<KmsMutationResponse> => {
return (await api.post("/kms/stop", {})) as KmsMutationResponse
}, [api])

const getConfiguration = useCallback(async () => {
return api.get("/kms/config")
}, [api])

const clearCache = useCallback(async () => {
return api.post("/kms/clear-cache", {})
const clearCache = useCallback(async (): Promise<KmsMutationResponse> => {
return (await api.post("/kms/clear-cache", {})) as KmsMutationResponse
}, [api])

const getDetailedStatus = useCallback(async () => {
return api.get("/kms/status")
}, [api])

const createKey = useCallback(
async (data: { KeyUsage?: string; Description?: string; Tags?: Record<string, string> }) => {
async (data: KmsCreateKeyRequest): Promise<KmsCreateKeyResponse> => {
const requestData = {
key_usage: data.KeyUsage || "EncryptDecrypt",
description: data.Description,
tags: data.Tags,
key_usage: data.key_usage || "EncryptDecrypt",
description: data.description,
tags: data.tags,
}
return api.post("/kms/keys", requestData)
return (await api.post("/kms/keys", requestData)) as KmsCreateKeyResponse
},
[api],
)

const getKeyDetails = useCallback(
async (keyId: string) => {
return api.get(`/kms/keys/${keyId}`)
async (keyId: string): Promise<KmsKeyDetailResponse> => {
return (await api.get(`/kms/keys/${keyId}`)) as KmsKeyDetailResponse
},
[api],
)

const getKeyList = useCallback(
async (params?: { limit?: number; marker?: string }) => {
async (params?: { limit?: number; marker?: string }): Promise<KmsKeyListResponse> => {
const queryParams = new URLSearchParams()
if (params?.limit) queryParams.append("limit", params.limit.toString())
if (params?.marker) queryParams.append("marker", params.marker)
const url = queryParams.toString() ? `/kms/keys?${queryParams}` : "/kms/keys"
return api.get(url)
return (await api.get(url)) as KmsKeyListResponse
},
[api],
)

const deleteKey = useCallback(
async (keyId: string) => {
const url = `/kms/keys/delete?keyId=${encodeURIComponent(keyId)}`
return api.delete(url)
async (keyId: string, options: KmsDeleteKeyOptions = {}): Promise<KmsMutationResponse> => {
const queryParams = new URLSearchParams({ keyId: keyId })
if (options.pending_window_in_days != null) {
queryParams.append("pending_window_in_days", String(options.pending_window_in_days))
}
if (options.force_immediate) {
queryParams.append("force_immediate", "true")
}
const url = `/kms/keys/delete?${queryParams.toString()}`
return (await api.delete(url)) as KmsMutationResponse
},
[api],
)

const forceDeleteKey = useCallback(
async (keyId: string) => {
const url = `/kms/keys/delete?keyId=${encodeURIComponent(keyId)}&force_immediate=true`
return api.delete(url)
async (keyId: string): Promise<KmsMutationResponse> => {
return deleteKey(keyId, { force_immediate: true })
},
[deleteKey],
)

const cancelKeyDeletion = useCallback(
async (request: string | KmsCancelDeletionRequest): Promise<KmsMutationResponse> => {
const keyId = typeof request === "string" ? request : request.key_id
const url = `/kms/keys/cancel-deletion?keyId=${encodeURIComponent(keyId)}`
return (await api.post(url, typeof request === "string" ? {} : request)) as KmsMutationResponse
},
[api],
)

return {
getKMSStatus,
configureKMS,
reconfigureKMS,
startKMS,
stopKMS,
getConfiguration,
Expand All @@ -96,5 +131,6 @@ export function useSSE() {
getKeyList,
deleteKey,
forceDeleteKey,
cancelKeyDeletion,
}
}
68 changes: 67 additions & 1 deletion i18n/locales/ar-MA.json
Original file line number Diff line number Diff line change
Expand Up @@ -888,5 +888,71 @@
"Completing SSO login...": "جارٍ إكمال تسجيل الدخول عبر SSO...",
"SSO Login Failed": "فشل تسجيل الدخول عبر SSO",
"SSO Login Success": "تم تسجيل الدخول عبر SSO بنجاح",
"SSO login failed: invalid callback": "فشل تسجيل الدخول عبر SSO: عنوان callback غير صالح"
"SSO login failed: invalid callback": "فشل تسجيل الدخول عبر SSO: عنوان callback غير صالح",
"Advanced Actions": "إجراءات متقدمة",
"Choose the backend used by SSE/KMS.": "اختر الواجهة الخلفية المستخدمة من SSE/KMS.",
"Clearing cache...": "جارٍ مسح ذاكرة التخزين المؤقت...",
"Configure the KMS backend, cache policy, and default SSE key.": "اضبط واجهة KMS الخلفية وسياسة التخزين المؤقت ومفتاح SSE الافتراضي.",
"Create a new KMS key and optionally make it the default SSE key.": "أنشئ مفتاح KMS جديدًا واجعله اختياريًا مفتاح SSE الافتراضي.",
"Default SSE Key": "مفتاح SSE الافتراضي",
"Default SSE key updated successfully": "تم تحديث مفتاح SSE الافتراضي بنجاح",
"Delete Immediately": "حذف فورًا",
"Delete Key Immediately": "حذف المفتاح فورًا",
"Describe the purpose of this key": "صف غرض هذا المفتاح",
"Enable KMS Cache": "تفعيل ذاكرة تخزين KMS المؤقتة",
"Enter an absolute path such as D:/data/kms-keys": "أدخل مسارًا مطلقًا مثل D:/data/kms-keys",
"Enter the default SSE key ID": "أدخل معرّف مفتاح SSE الافتراضي",
"Failed to cancel key deletion": "فشل إلغاء حذف المفتاح",
"Failed to create KMS key": "فشل إنشاء مفتاح KMS",
"Failed to force delete key": "فشل الحذف الفوري للمفتاح",
"Failed to restart KMS service": "فشل إعادة تشغيل خدمة KMS",
"Failed to save KMS configuration": "فشل حفظ إعدادات KMS",
"Failed to schedule key deletion": "فشل جدولة حذف المفتاح",
"Failed to update key status": "فشل تحديث حالة المفتاح",
"KMS Backend": "واجهة KMS الخلفية",
"KMS Key Details": "تفاصيل مفتاح KMS",
"KMS configuration saved successfully": "تم حفظ إعدادات KMS بنجاح",
"KMS configuration updated successfully": "تم تحديث إعدادات KMS بنجاح",
"KMS configured but not started": "تم إعداد KMS لكنه غير مشغّل",
"KMS key created successfully": "تم إنشاء مفتاح KMS بنجاح",
"KMS service restarted successfully": "تم إعادة تشغيل خدمة KMS بنجاح",
"KV Mount": "تثبيت KV",
"Key Path Prefix": "بادئة مسار المفتاح",
"Key created but could not update the default SSE key. Save the configuration form and try again.": "تم إنشاء المفتاح لكن تعذّر تحديث مفتاح SSE الافتراضي. احفظ نموذج الإعداد ثم أعد المحاولة.",
"Key deleted immediately": "تم حذف المفتاح فورًا",
"Key deletion canceled successfully": "تم إلغاء حذف المفتاح بنجاح",
"Key deletion scheduled successfully": "تم جدولة حذف المفتاح بنجاح",
"Keys in PendingDeletion can still be restored or deleted immediately.": "لا يزال بإمكان استعادة المفاتيح في حالة PendingDeletion أو حذفها فورًا.",
"Local Key Directory": "دليل المفاتيح المحلي",
"Local filesystem": "نظام الملفات المحلي",
"No key details available": "لا تتوفر تفاصيل للمفتاح",
"Not set": "غير مضبوط",
"Optional Vault namespace": "مساحة أسماء Vault اختيارية",
"Optional display name for the key": "اسم عرض اختياري للمفتاح",
"Please enter Vault transit mount path": "يُرجى إدخال مسار تثبيت transit في Vault",
"Please enter an absolute local key directory path": "يُرجى إدخال مسار مطلق لدليل المفاتيح المحلي",
"Reconfigure KMS": "إعادة تهيئة KMS",
"Reset to Current Status": "إعادة التعيين إلى الحالة الحالية",
"Restart KMS": "إعادة تشغيل KMS",
"Restore Key": "استعادة المفتاح",
"Schedule Deletion": "جدولة الحذف",
"Schedule Key Deletion": "جدولة حذف المفتاح",
"Set as default SSE key": "تعيين كمفتاح SSE افتراضي",
"Showing up to {count} keys per page": "عرض ما يصل إلى {count} مفتاحًا لكل صفحة",
"Skip TLS verification": "تخطي التحقق من TLS",
"Start KMS to make SSE and key management available.": "شغّل KMS لتمكين SSE وإدارة المفاتيح.",
"Stopping KMS...": "جارٍ إيقاف KMS...",
"The directory must be an absolute path on the server.": "يجب أن يكون الدليل مسارًا مطلقًا على الخادم.",
"This key is used as the platform default for SSE-KMS.": "يُستخدم هذا المفتاح كافتراضي للمنصة لـ SSE-KMS.",
"This permanently deletes the key immediately and cannot be undone.": "يحذف المفتاح نهائيًا فورًا ولا يمكن التراجع.",
"This restores the key from the pending deletion state.": "يستعيد المفتاح من حالة الحذف المعلّق.",
"This schedules the key for deletion using the default pending window.": "يجدول حذف المفتاح باستخدام نافذة الانتظار الافتراضية.",
"This will update the current KMS configuration after key creation.": "سيحدّث إعدادات KMS الحالية بعد إنشاء المفتاح.",
"Timeout (seconds)": "المهلة (ثوانٍ)",
"Two-stage key deletion": "حذف المفتاح على مرحلتين",
"Use decimal values such as 384 for 0o600.": "استخدم قيمًا عشرية مثل 384 لـ 0o600.",
"Vault AppRole is not supported in the first version of this console.": "Vault AppRole غير مدعوم في الإصدار الأول من هذه الوحدة.",
"Vault Namespace": "مساحة أسماء Vault",
"Vault token authentication only": "مصادقة رمز Vault فقط",
"View Details": "عرض التفاصيل"
}
68 changes: 67 additions & 1 deletion i18n/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -901,5 +901,71 @@
"Completing SSO login...": "SSO-Anmeldung wird abgeschlossen...",
"SSO Login Failed": "SSO-Anmeldung fehlgeschlagen",
"SSO Login Success": "SSO-Anmeldung erfolgreich",
"SSO login failed: invalid callback": "SSO-Anmeldung fehlgeschlagen: ungültiger Callback"
"SSO login failed: invalid callback": "SSO-Anmeldung fehlgeschlagen: ungültiger Callback",
"Advanced Actions": "Erweiterte Aktionen",
"Choose the backend used by SSE/KMS.": "Wählen Sie das Backend für SSE/KMS.",
"Clearing cache...": "Cache wird geleert...",
"Configure the KMS backend, cache policy, and default SSE key.": "Konfigurieren Sie KMS-Backend, Cache-Richtlinie und den Standard-SSE-Schlüssel.",
"Create a new KMS key and optionally make it the default SSE key.": "Neuen KMS-Schlüssel erstellen und optional als Standard-SSE-Schlüssel festlegen.",
"Default SSE Key": "Standard-SSE-Schlüssel",
"Default SSE key updated successfully": "Standard-SSE-Schlüssel erfolgreich aktualisiert",
"Delete Immediately": "Sofort löschen",
"Delete Key Immediately": "Schlüssel sofort löschen",
"Describe the purpose of this key": "Zweck dieses Schlüssels beschreiben",
"Enable KMS Cache": "KMS-Cache aktivieren",
"Enter an absolute path such as D:/data/kms-keys": "Absoluten Pfad eingeben, z. B. D:/data/kms-keys",
"Enter the default SSE key ID": "Standard-SSE-Schlüssel-ID eingeben",
"Failed to cancel key deletion": "Löschung des Schlüssels konnte nicht abgebrochen werden",
"Failed to create KMS key": "KMS-Schlüssel konnte nicht erstellt werden",
"Failed to force delete key": "Sofortiges Löschen des Schlüssels fehlgeschlagen",
"Failed to restart KMS service": "KMS-Dienst konnte nicht neu gestartet werden",
"Failed to save KMS configuration": "KMS-Konfiguration konnte nicht gespeichert werden",
"Failed to schedule key deletion": "Geplante Schlüssellöschung fehlgeschlagen",
"Failed to update key status": "Schlüsselstatus konnte nicht aktualisiert werden",
"KMS Backend": "KMS-Backend",
"KMS Key Details": "KMS-Schlüsseldetails",
"KMS configuration saved successfully": "KMS-Konfiguration erfolgreich gespeichert",
"KMS configuration updated successfully": "KMS-Konfiguration erfolgreich aktualisiert",
"KMS configured but not started": "KMS konfiguriert, aber nicht gestartet",
"KMS key created successfully": "KMS-Schlüssel erfolgreich erstellt",
"KMS service restarted successfully": "KMS-Dienst erfolgreich neu gestartet",
"KV Mount": "KV-Mount",
"Key Path Prefix": "Schlüsselpfad-Präfix",
"Key created but could not update the default SSE key. Save the configuration form and try again.": "Schlüssel erstellt, Standard-SSE-Schlüssel konnte nicht aktualisiert werden. Speichern Sie das Konfigurationsformular und versuchen Sie es erneut.",
"Key deleted immediately": "Schlüssel sofort gelöscht",
"Key deletion canceled successfully": "Schlüssellöschung erfolgreich abgebrochen",
"Key deletion scheduled successfully": "Schlüssellöschung erfolgreich geplant",
"Keys in PendingDeletion can still be restored or deleted immediately.": "Schlüssel im Status PendingDeletion können weiterhin wiederhergestellt oder sofort gelöscht werden.",
"Local Key Directory": "Lokales Schlüsselverzeichnis",
"Local filesystem": "Lokales Dateisystem",
"No key details available": "Keine Schlüsseldetails verfügbar",
"Not set": "Nicht festgelegt",
"Optional Vault namespace": "Optionaler Vault-Namespace",
"Optional display name for the key": "Optionaler Anzeigename für den Schlüssel",
"Please enter Vault transit mount path": "Bitte Vault-Transit-Mount-Pfad eingeben",
"Please enter an absolute local key directory path": "Bitte einen absoluten Pfad zum lokalen Schlüsselverzeichnis eingeben",
"Reconfigure KMS": "KMS neu konfigurieren",
"Reset to Current Status": "Auf aktuellen Status zurücksetzen",
"Restart KMS": "KMS neu starten",
"Restore Key": "Schlüssel wiederherstellen",
"Schedule Deletion": "Löschung planen",
"Schedule Key Deletion": "Schlüssellöschung planen",
"Set as default SSE key": "Als Standard-SSE-Schlüssel festlegen",
"Showing up to {count} keys per page": "Bis zu {count} Schlüssel pro Seite",
"Skip TLS verification": "TLS-Überprüfung überspringen",
"Start KMS to make SSE and key management available.": "Starten Sie KMS, um SSE und Schlüsselverwaltung zu nutzen.",
"Stopping KMS...": "KMS wird gestoppt...",
"The directory must be an absolute path on the server.": "Das Verzeichnis muss ein absoluter Pfad auf dem Server sein.",
"This key is used as the platform default for SSE-KMS.": "Dieser Schlüssel ist die Plattform-Standardvorgabe für SSE-KMS.",
"This permanently deletes the key immediately and cannot be undone.": "Der Schlüssel wird sofort dauerhaft gelöscht und kann nicht rückgängig gemacht werden.",
"This restores the key from the pending deletion state.": "Stellt den Schlüssel aus dem ausstehenden Löschzustand wieder her.",
"This schedules the key for deletion using the default pending window.": "Plant die Schlüssellöschung mit dem Standard-Wartefenster.",
"This will update the current KMS configuration after key creation.": "Aktualisiert die aktuelle KMS-Konfiguration nach der Schlüsselerstellung.",
"Timeout (seconds)": "Timeout (Sekunden)",
"Two-stage key deletion": "Zweistufige Schlüssellöschung",
"Use decimal values such as 384 for 0o600.": "Dezimalwerte verwenden, z. B. 384 für 0o600.",
"Vault AppRole is not supported in the first version of this console.": "Vault AppRole wird in der ersten Version dieser Konsole nicht unterstützt.",
"Vault Namespace": "Vault-Namespace",
"Vault token authentication only": "Nur Vault-Token-Authentifizierung",
"View Details": "Details anzeigen"
}
Loading
Loading