Phase4
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 9s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 12:32:27 +02:00
parent 9b061c3ee7
commit 4262464cd5
101 changed files with 4024 additions and 74 deletions

View File

@@ -0,0 +1,80 @@
import { apiFetch } from "./auth";
export interface BackupItem {
id: string;
serverId: string;
type: string;
status: string;
sizeBytes: string | null;
sha256: string | null;
label: string | null;
failureReason: string | null;
createdAt: string;
completedAt: string | null;
}
export interface BackupListResponse {
backups: BackupItem[];
}
export interface BackupSchedule {
enabled: boolean;
intervalHours: number;
retentionCount: number;
nextRunAt: string | null;
lastRunAt: string | null;
}
export async function listBackups(serverId: string): Promise<BackupListResponse> {
return apiFetch<BackupListResponse>(`/servers/${serverId}/backups`);
}
export async function createBackup(
serverId: string,
label?: string,
): Promise<{ backup: BackupItem; jobId?: string }> {
return apiFetch(`/servers/${serverId}/backups`, {
method: "POST",
body: JSON.stringify({ label }),
});
}
export async function deleteBackup(
serverId: string,
backupId: string,
): Promise<BackupItem> {
return apiFetch(`/servers/${serverId}/backups/${backupId}`, {
method: "DELETE",
});
}
export async function getBackupDownloadUrl(
serverId: string,
backupId: string,
): Promise<{ downloadUrl: string; expiresAt: string }> {
return apiFetch(`/servers/${serverId}/backups/${backupId}/download-url`);
}
export async function restoreBackup(
serverId: string,
backupId: string,
): Promise<unknown> {
return apiFetch(`/servers/${serverId}/backups/${backupId}/restore`, {
method: "POST",
body: JSON.stringify({ confirm: true }),
});
}
export async function getBackupSchedule(serverId: string): Promise<BackupSchedule> {
return apiFetch(`/servers/${serverId}/backups/schedule`);
}
export async function updateBackupSchedule(
serverId: string,
input: Partial<BackupSchedule>,
): Promise<BackupSchedule> {
return apiFetch(`/servers/${serverId}/backups/schedule`, {
method: "PATCH",
body: JSON.stringify(input),
});
}

View File

@@ -0,0 +1,48 @@
import { apiFetch } from "./auth";
export interface WorldSummary {
name: string;
path: string;
sizeBytes: string;
hasLevelDat: boolean;
}
export interface WorldInfoResponse {
activeWorldName: string;
worlds: WorldSummary[];
}
export async function getWorldInfo(serverId: string): Promise<WorldInfoResponse> {
return apiFetch(`/servers/${serverId}/worlds`);
}
export async function initiateWorldUpload(
serverId: string,
worldName: string,
): Promise<{
uploadId: string;
uploadUrl: string;
expiresAt: string;
}> {
return apiFetch(`/servers/${serverId}/worlds/uploads`, {
method: "POST",
body: JSON.stringify({ worldName }),
});
}
export async function completeWorldUpload(
serverId: string,
uploadId: string,
): Promise<unknown> {
return apiFetch(`/servers/${serverId}/worlds/uploads/${uploadId}/complete`, {
method: "POST",
});
}
export async function requestWorldDownload(
serverId: string,
): Promise<{ backupId: string }> {
return apiFetch(`/servers/${serverId}/worlds/download`, {
method: "POST",
});
}