umstellung auf claud

This commit is contained in:
marco committed 2026-12-04 10:14:49 +01:00
1 parent 79c5f0c5cd
commit 5bb4e063da
171 files changed
+5471 -1333

No files matched your search

@@ -0,0 +1,43 @@
import { BACKEND_URL } from '@/_config/backend';
type BackupFileRouteContext = {
params: Promise<{ id: string }>;
};
const UNSAFE_FILENAME_CHARACTERS = /[^A-Za-z0-9_.-]/g;
// Nur der letzte Pfadteil wird als Download-Name verwendet,
// unsichere Zeichen werden ersetzt.
function toDownloadFilename(file: string): string {
const lastPathPart = file.split('/').pop();
return lastPathPart?.replace(UNSAFE_FILENAME_CHARACTERS, '_') ?? 'backup.json';
}
export async function GET(request: Request, { params }: BackupFileRouteContext) {
const { id } = await params;
const file = new URL(request.url).searchParams.get('file') ?? 'manifest.json';
const backupFileUrl = `${BACKEND_URL}/rk2/backups/${encodeURIComponent(id)}/file`
+ `?file=${encodeURIComponent(file)}`;
try {
const response = await fetch(backupFileUrl, { cache: 'no-store' });
if (!response.ok) {
return new Response('Sicherungsdatei nicht verfügbar', { status: response.status });
}
const filename = toDownloadFilename(file);
return new Response(response.body, {
headers: {
'Content-Type': response.headers.get('Content-Type') ?? 'application/json',
'Content-Disposition': 'attachment; filename="' + filename + '"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
}
@@ -0,0 +1,17 @@
import Link from 'next/link';
import { api_backups } from '@/actions/backup/api-backup';
import BackupPanel from '@/components/backup/backupPanel';
export default async function DatensicherungPage() {
try {
const backups = await api_backups();
return (
<section className="space-y-4">
<Link href="/projekte/system" className="text-sm text-blue-700 underline">Zurück zu System</Link>
<BackupPanel initial={backups} />
</section>
);
} catch {
return <p role="alert">Datensicherungen konnten nicht geladen werden.</p>;
}
}