feat(files): a file that is not media opens in a viewer — an image, a PDF, text as text

- GET /api/files/{id}/preview: an allow-list on the stored extension (downloads/preview.py) picks
  image / PDF / text; served inline under `CSP: sandbox; frame-ancestors 'self'`, the type from the
  table; HTML and SVG arrive as plain text; a text is its first 1 MiB (X-Preview-Truncated), sent
  as UTF-8 whatever it was written in (BOM, UTF-8, else cp1250); a NUL means binary: 415
- the list says which preview each file gets (asset.preview); FE/BE contract on kinds and header
- the viewer (shared dialog shell): ← / → through the list's such files in its order, Save, open in
  a tab, the file's menu; one stage height for every kind; a no-preview card offers the file
- the name, the card's picture and the menu's Preview open it; an image up to 8 MB is its own
  thumbnail
This commit is contained in:
2026-10-12 15:28:31 +02:00
parent 6707550513
commit fb8fb980e5
26 changed files with 1090 additions and 48 deletions
+2 -1
View File
@@ -237,6 +237,7 @@
"file_folder_name_taken": "You already have a folder with that name",
"file_folder_not_own": "Only a folder you made can be renamed or deleted",
"file_folder_gone": "That folder no longer exists",
"file_folder_not_its_source": "A file can only go into one of your own folders or back to the folder it came from"
"file_folder_not_its_source": "A file can only go into one of your own folders or back to the folder it came from",
"file_no_preview": "There is no preview for this file"
}
}
+12 -1
View File
@@ -55,7 +55,8 @@
"keep": "Keep",
"unkeep": "Stop keeping",
"details": "Details…",
"upload": "Upload"
"upload": "Upload",
"view": "Preview"
},
"folder": {
"menu": "Folder actions",
@@ -91,5 +92,15 @@
"label": "A link to download",
"placeholder": "Paste a link and I'll download it (YouTube, TikTok, Facebook…)",
"download": "Download"
},
"preview": {
"prev": "Previous file",
"next": "Next file",
"position": "{{n}} / {{total}}",
"openInTab": "Open in a new tab",
"none": "There is no preview for this file",
"asText": "Shown as plain text",
"truncated": "Showing the start of this {{size}} file",
"wrap": "Wrap long lines"
}
}
+1
View File
@@ -10,6 +10,7 @@
"fineSeek": "Fine seek",
"episode": "Previous / next episode",
"video": "Previous / next video",
"file": "Previous / next file",
"volume": "Volume up / down",
"mute": "Mute",
"audio": "Cycle audio track",
+2 -1
View File
@@ -237,6 +237,7 @@
"file_folder_name_taken": "Már van ilyen nevű mappád",
"file_folder_not_own": "Csak a saját mappádat nevezheted át vagy törölheted",
"file_folder_gone": "Ez a mappa már nem létezik",
"file_folder_not_its_source": "Egy fájl csak a saját mappáidba vagy vissza az eredeti mappájába kerülhet"
"file_folder_not_its_source": "Egy fájl csak a saját mappáidba vagy vissza az eredeti mappájába kerülhet",
"file_no_preview": "Ehhez a fájlhoz nincs előnézet"
}
}
+12 -1
View File
@@ -55,7 +55,8 @@
"keep": "Megtartom",
"unkeep": "Megtartás visszavonása",
"details": "Részletek…",
"upload": "Feltöltés"
"upload": "Feltöltés",
"view": "Előnézet"
},
"folder": {
"menu": "Mappa műveletei",
@@ -91,5 +92,15 @@
"label": "Letöltendő link",
"placeholder": "Illessz be egy linket, és letöltöm (YouTube, TikTok, Facebook…)",
"download": "Letöltés"
},
"preview": {
"prev": "Előző fájl",
"next": "Következő fájl",
"position": "{{n}} / {{total}}",
"openInTab": "Megnyitás új lapon",
"none": "Ehhez a fájlhoz nincs előnézet",
"asText": "Egyszerű szövegként",
"truncated": "A {{size}} méretű fájl eleje látszik",
"wrap": "Hosszú sorok tördelése"
}
}
+1
View File
@@ -9,6 +9,7 @@
"seek5": "Tekerés 5 másodperc",
"fineSeek": "Finom léptetés",
"episode": "Előző / következő rész",
"file": "Előző / következő fájl",
"video": "Előző / következő videó",
"volume": "Hangerő fel / le",
"mute": "Némítás",