feat: Audit and settings
Server Deploy / deploy (push) Successful in 1m26s

This commit is contained in:
domrichardson
2026-06-25 11:30:26 +01:00
parent e37a09ef0d
commit c3c16083f7
12 changed files with 856 additions and 4 deletions
+50
View File
@@ -42,6 +42,38 @@ export interface Assignment {
revoked_at: string | null;
}
export interface AuditEvent {
id: string;
event_type: string;
actor: string;
server_id?: string;
key_id?: string;
details: string;
created_at: string;
}
export interface AlertSettings {
enabled: boolean;
webhook_url: string;
offline_threshold_minutes: number;
}
export interface EmailSettings {
enabled: boolean;
smtp_host: string;
smtp_port: number;
username: string;
password: string;
from_addr: string;
to_addrs: string[];
use_tls: boolean;
}
export interface Settings {
alerts: AlertSettings;
email: EmailSettings;
}
export interface NewServerResponse {
server_id: string;
pre_reg_token: string;
@@ -141,6 +173,24 @@ export const api = {
});
},
// Audit
listAuditEvents(limit?: number): Promise<AuditEvent[]> {
const qs = limit ? `?limit=${limit}` : "";
return request<AuditEvent[]>(`/audit${qs}`);
},
// Settings
getSettings(): Promise<Settings> {
return request<Settings>("/settings");
},
saveSettings(settings: { alerts: AlertSettings; email: EmailSettings }): Promise<{ saved: boolean }> {
return request<{ saved: boolean }>("/settings", {
method: "PUT",
body: JSON.stringify(settings),
});
},
// Keys
listKeys(): Promise<Key[]> {
return request<Key[]>("/keys");