feat: P1 — audio/video modal player + MIME detection via magic bytes (infer)
Backend: - Add infer crate for magic-byte MIME detection (<1μs per file) - New src/common/mime_detect.rs: refine_content_type() with priority magic bytes > extension > client Content-Type - Inject MIME refinement in file upload handler (after spool to temp) - Inject MIME refinement in chunked upload handler (after assembly) Frontend: - Extend isViewableFile() to include audio/* and video/* - Add createMediaViewer() to InlineViewer with <audio>/<video> controls - Blob URL pattern for authenticated streaming playback - Graceful fallback for unsupported codecs (error message + download) - CSS: video player, audio wrapper with animated icon, responsive
This commit is contained in:
@@ -299,6 +299,14 @@ impl ChunkedUploadHandler {
|
||||
}
|
||||
};
|
||||
|
||||
// ── MIME detection (magic bytes + extension fallback) ─────
|
||||
let content_type = crate::common::mime_detect::refine_content_type_from_file(
|
||||
&assembled_path,
|
||||
&filename,
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
// Upload from assembled file on disk — zero extra RAM copies, hash pre-computed
|
||||
match upload_service
|
||||
.upload_file_from_path(
|
||||
|
||||
Reference in New Issue
Block a user