feat(storage): phase 5 — replace Supabase storage with local filesystem + HMAC evidence serving
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import type { EvidenceStage } from '@/lib/supabase/storage'
|
||||
import type { EvidenceStage } from '@/lib/storage/evidence'
|
||||
|
||||
type EvidenceFile = {
|
||||
id: string
|
||||
@@ -18,12 +18,6 @@ interface Props {
|
||||
function isImage(type: string) { return type.startsWith('image/') }
|
||||
function isVideo(type: string) { return type.startsWith('video/') }
|
||||
|
||||
// Supabase Storage image transform endpoint. Falls back to the original object
|
||||
// URL via onError if the project plan has no image transformation.
|
||||
function thumbnailUrl(url: string, width = 320): string {
|
||||
if (!url.includes('/storage/v1/object/public/')) return url
|
||||
return `${url.replace('/storage/v1/object/public/', '/storage/v1/render/image/public/')}?width=${width}&quality=60`
|
||||
}
|
||||
|
||||
export function EvidenceGallery({ files, stage }: Props) {
|
||||
const filtered = stage ? files.filter(f => f.stage === stage) : files
|
||||
@@ -41,14 +35,10 @@ export function EvidenceGallery({ files, stage }: Props) {
|
||||
>
|
||||
{isImage(file.file_type) ? (
|
||||
<img
|
||||
src={thumbnailUrl(file.file_url)}
|
||||
src={file.file_url}
|
||||
alt="Evidence"
|
||||
loading="lazy"
|
||||
className="w-full h-full object-cover"
|
||||
onError={e => {
|
||||
const img = e.currentTarget
|
||||
if (img.src !== file.file_url) img.src = file.file_url
|
||||
}}
|
||||
/>
|
||||
) : isVideo(file.file_type) ? (
|
||||
<div className="w-full h-full flex items-center justify-center text-3xl">🎥</div>
|
||||
|
||||
Reference in New Issue
Block a user