diff --git a/backend/src/app.ts b/backend/src/app.ts index 7c37e23..3eb972a 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -34,9 +34,12 @@ export function createApp() { app.use(cors({ origin: true })); // Alle übrigen Routen bekommen normal geparstes JSON. Limit angehoben, da - // die Inventarverwaltung mehrere Fotos als Data-URLs im Body versendet - // (keine separate Objekt-Storage-Anbindung in diesem Demo-Stand). - app.use(express.json({ limit: '10mb' })); + // Inventarfotos, Vertragsdokumente und beim Einladung-Annehmen bis zu drei + // Dateien (Ausweis vorne/hinten, optional Schufa) als Data-URLs im Body + // versendet werden (keine separate Objekt-Storage-Anbindung in diesem + // Demo-Stand). 10mb reichte für einzelne Fotos, war aber zu knapp für drei + // hochauflösende Handyfotos in einem Request (HTTP 413). + app.use(express.json({ limit: '30mb' })); app.use('/v1', paymentsRouter); app.use('/v1', cockpitRouter); app.use('/v1', authRouter); diff --git a/web-dashboard/index.html b/web-dashboard/index.html index e04bba8..0935878 100644 --- a/web-dashboard/index.html +++ b/web-dashboard/index.html @@ -1209,6 +1209,12 @@ const password = document.getElementById('acceptPassword').value; const body = { fullName, password }; if (isTenant) { + const MAX_UPLOAD_BYTES = 8 * 1024 * 1024; // 8MB je Datei, reichlich Luft unter dem 30mb-Server-Limit für alle 3 Dateien zusammen + const tooLarge = [idFrontInput.files[0], idBackInput.files[0], schufaInput.files[0]] + .filter(f => f && f.size > MAX_UPLOAD_BYTES); + if (tooLarge.length) { + throw new Error(`Datei zu groß (max. 8 MB): ${tooLarge.map(f => f.name).join(', ')}. Bitte kleineres Foto/Scan wählen.`); + } body.phoneNumber = document.getElementById('acceptPhone').value.trim(); body.firstResidenceAddress = document.getElementById('acceptFirstResidence').value.trim(); body.idDocumentFrontUrl = await readFileAsDataUrl(idFrontInput.files[0]);