Fix: compress cover uploads and raise API payload limit

This commit is contained in:
Ponte
2026-02-14 23:00:54 +01:00
parent 23352d85d0
commit e04a5a0a25
2 changed files with 50 additions and 5 deletions

View File

@@ -27,11 +27,12 @@ function sendJson(response, statusCode, payload) {
async function readJsonBody(request) {
const chunks = [];
let size = 0;
const maxPayloadSizeBytes = 8 * 1024 * 1024;
for await (const chunk of request) {
size += chunk.length;
if (size > 1024 * 1024) {
throw new Error("Payload too large");
if (size > maxPayloadSizeBytes) {
throw new Error("Payload too large (max 8MB)");
}
chunks.push(chunk);
}