Client-side optimization pipeline with apply-to-J-ID

Backend:
- POST /api/files/J-x/optimize/ applies a browser-processed file: replaces
  every copy (renaming when the extension changes), recomputes MD5, size
  and perceptual hashes, seeds guest visibility; 400 when identical,
  409 when the result matches another item, owner/staff only.

Frontend (no server-side processing by design):
- optimize.worker.ts + pipelines: Mediabunny/WebCodecs for video with a
  prefer-hardware hint and per-browser codec detection; MozJPEG/OxiPNG/
  libwebp (jSquash) for images; gifuct-js+gifenc and UPNG for GIF/APNG.
- OptimizeModal: per-file-type options, original vs processed previews
  with sizes/savings, progress bar with ETA, then Apply (overwrite).
- Optimize button on the library detail for the uploader/staff.
This commit is contained in:
2026-09-17 20:03:22 -05:00
parent 90e61bb333
commit bab9904fc8
14 changed files with 1721 additions and 8 deletions
+9
View File
@@ -10,13 +10,22 @@
"preview": "vite preview"
},
"dependencies": {
"@jsquash/jpeg": "^1.6.0",
"@jsquash/oxipng": "^2.3.0",
"@jsquash/resize": "^2.1.1",
"@jsquash/webp": "^1.5.0",
"@tanstack/react-query": "^5.103.1",
"clsx": "^2.1.1",
"gifenc": "^1.0.3",
"gifuct-js": "^2.1.2",
"lucide-react": "^1.47.0",
"mediabunny": "^1.58.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-router-dom": "^7.18.4",
"tailwind-merge": "^3.7.0",
"upng-js": "^2.1.0",
"wasm-feature-detect": "^1.9.0",
"zustand": "^5.0.15"
},
"devDependencies": {