feat(s3-storage): add backup metadata, upload verification, restore, and retention

This commit is contained in:
KodekaTeam committed 2026-07-15 12:07:55 +07:00
1 parent dbefb42725
commit 8470a68e78
12 files changed
+1278 -558

No files matched your search

+22 -15
View File
@@ -1,5 +1,5 @@
/**
* API Client — DOKTAINER
* API Client — DOKTAINER
* Centralized HTTP client with auth token injection
*/
@@ -130,7 +130,7 @@ function handleUnauthorizedSession(
throw new Error("Unauthorized - session expired");
}
// ─── Token helpers ────────────────────────────────────────────────────────────
// ─── Token helpers ────────────────────────────────────────────────────────────
export function getToken(): string | null {
return getSensitiveStorageItem(sensitiveStorageKeys.token);
@@ -165,7 +165,7 @@ export function setUser(user: UserInfo): void {
emitAuthStateChanged();
}
// ─── Types ────────────────────────────────────────────────────────────────────
// ─── Types ────────────────────────────────────────────────────────────────────
export interface UserInfo {
id: string;
@@ -457,6 +457,9 @@ export interface S3StorageDestinationRecord {
bucket: string;
endpoint: string;
additionalFlags: string[];
retentionDays: number | null;
maxBackupCount: number | null;
objectPrefix: string;
serverId: string | null;
targetServer: S3StorageTargetServer | null;
createdAt: string;
@@ -473,6 +476,9 @@ export interface S3StorageDestinationInput {
bucket: string;
endpoint?: string;
additionalFlags: string[];
retentionDays?: number | null;
maxBackupCount?: number | null;
objectPrefix?: string;
serverId?: string | null;
}
@@ -622,7 +628,7 @@ async function readApiErrorMessage(
}
}
// ─── Core fetch wrapper ───────────────────────────────────────────────────────
// ─── Core fetch wrapper ───────────────────────────────────────────────────────
async function request<T>(
path: string,
@@ -748,7 +754,7 @@ function del<T>(path: string, body?: unknown, config?: { timeoutMs?: number }) {
);
}
// ─── WebSocket helper ─────────────────────────────────────────────────────────
// ─── WebSocket helper ─────────────────────────────────────────────────────────
export function createWs(path: string): WebSocket {
const token = getToken();
@@ -758,7 +764,7 @@ export function createWs(path: string): WebSocket {
);
}
// ─── Auth ─────────────────────────────────────────────────────────────────────
// ─── Auth ─────────────────────────────────────────────────────────────────────
export const auth = {
registrationStatus: () =>
@@ -852,7 +858,7 @@ export const auth = {
),
};
// ─── Users ───────────────────────────────────────────────────────────────────
// ─── Users ───────────────────────────────────────────────────────────────────
export type UserRole = "SUPER_ADMIN" | "OPERATOR" | "DEVELOPER" | "VIEWER";
@@ -1238,7 +1244,7 @@ export const gitProvidersApi = {
),
};
// ─── Servers ──────────────────────────────────────────────────────────────────
// ─── Servers ──────────────────────────────────────────────────────────────────
export interface Server {
id: string;
@@ -1530,7 +1536,7 @@ export const servers = {
),
};
// ─── Containers ───────────────────────────────────────────────────────────────
// ─── Containers ───────────────────────────────────────────────────────────────
export interface Container {
id: string;
@@ -1997,7 +2003,7 @@ export const containers = {
),
};
// ─── Metrics ──────────────────────────────────────────────────────────────────
// ─── Metrics ──────────────────────────────────────────────────────────────────
export interface DashboardOverview {
servers: { total: number; online: number };
@@ -2053,7 +2059,7 @@ export const metrics = {
),
};
// ─── Domains ──────────────────────────────────────────────────────────────────
// ─── Domains ──────────────────────────────────────────────────────────────────
export interface Domain {
id: string;
@@ -2444,7 +2450,7 @@ export const security = {
),
};
// ─── Apps ────────────────────────────────────────────────────────────────────
// ─── Apps ────────────────────────────────────────────────────────────────────
export interface AppTemplate {
id: string;
@@ -2643,7 +2649,7 @@ export const apps = {
}),
};
// ─── Backups ──────────────────────────────────────────────────────────────────
// ─── Backups ──────────────────────────────────────────────────────────────────
export interface Backup {
id: string;
@@ -2744,7 +2750,7 @@ export const backups = {
delete: (id: string) => del<{ success: boolean }>(`/backups/${id}`),
};
// ─── Logs ─────────────────────────────────────────────────────────────────────
// ─── Logs ─────────────────────────────────────────────────────────────────────
export const logs = {
list: (params?: {
@@ -2769,7 +2775,7 @@ export const logs = {
},
};
// ─── Terminal ─────────────────────────────────────────────────────────────────
// ─── Terminal ─────────────────────────────────────────────────────────────────
export const terminal = {
sessions: () =>
@@ -2841,3 +2847,4 @@ export const apiClient = {
terminal,
};
export default apiClient;