Halte die gewaehlte Inhaltsliste beim Oeffnen und mache Typ sowie das Logo auf dunkler Flaeche aus der Lieferung erkennbar.
Deploy Development / deploy (push) Successful in 25s
Test Suite / pytest-backend (push) Successful in 56s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 15:50:05 +02:00
1 parent dc8a9c2db6
commit 97bffc6175
71 files changed
+572 -142

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
/** UI classification only. The server's element kind and access rules are unchanged. */
export function contentSymbol(element = {}) {
if (element.kind === "note") return "note";
const detail = element.external?.detail || {};
const mime = String(element.file?.content_type || detail.content_type || detail.mime_type || "").split(";")[0].trim().toLowerCase();
const filename = String(element.file?.filename || detail.filename || "");
const ext = filename.toLowerCase().split(".").slice(1).pop() || "";
const media = element.preview?.media;
if (mime === "application/pdf" || media === "pdf" || ext === "pdf") return "pdf";
if (mime.startsWith("image/") || media === "image" || /^(png|jpe?g|webp|gif|heic|avif|svg|tiff?)$/.test(ext)) return "image";
if (mime.startsWith("audio/") || /^(mp3|wav|ogg|m4a|flac|aac)$/.test(ext)) return "audio";
if (mime.startsWith("video/") || /^(mp4|webm|mov|mkv|avi)$/.test(ext)) return "video";
if (mime === "message/rfc822" || mime === "application/vnd.ms-outlook" || /^(eml|msg)$/.test(ext)) return "email";
if (/spreadsheet|excel|csv|tab-separated/.test(mime) || /^(xlsx?|ods|csv|tsv)$/.test(ext)) return "spreadsheet";
if (/presentation|powerpoint/.test(mime) || /^(pptx?|odp)$/.test(ext)) return "presentation";
if (/zip|compressed|gzip|x-tar/.test(mime) || /^(zip|7z|rar|tar|gz|tgz)$/.test(ext)) return "archive";
if (/javascript|json|xml/.test(mime) || /^(js|jsx|ts|tsx|py|json|xml|html?|css|sql|ya?ml)$/.test(ext)) return "code";
if (mime.startsWith("text/") || /word|opendocument.text|rtf/.test(mime) || /^(docx?|odt|txt|rtf|md)$/.test(ext)) return "document";
// Paperless is an origin, not proof that a resource is a PDF. Do not infer format from a title.
if (element.kind === "external_ref") return element.external?.source === "paperless" ? "file" : "link";
return "file";
}
export function contentSourceSymbol(element = {}) {
return element.external?.source === "paperless" ? "source-archive" : null;
}