Use ffmpeg

This commit is contained in:
2026-01-22 21:53:36 +01:00
parent a8c4c97294
commit 10a7f5675d
14 changed files with 406 additions and 319 deletions

View File

@@ -2406,7 +2406,9 @@ export function createAdminConsole({
})
.then((response) => {
if (!response.ok) {
throw new Error("Upload failed");
return extractErrorMessage(response, "Upload failed").then((message) => {
throw new Error(message);
});
}
if (fileInput) {
fileInput.value = "";
@@ -2421,10 +2423,31 @@ export function createAdminConsole({
}
console.error(e);
removePendingUpload(pendingId);
showToast("Upload failed. Please try again with a supported file.", "error");
showToast(e?.message || "Upload failed. Please try again with a supported file.", "error");
});
}
function extractErrorMessage(response, fallback) {
if (!response) {
return Promise.resolve(fallback);
}
return response
.json()
.then((data) => {
if (data?.message) {
return data.message;
}
if (data?.error) {
return data.error;
}
if (typeof data === "string" && data.trim()) {
return data;
}
return fallback;
})
.catch(() => response.text().then((text) => text?.trim() || fallback).catch(() => fallback));
}
function getCanvasPoint(event) {
const rect = canvas.getBoundingClientRect();
const scaleX = canvas.width / rect.width;