feat(admin): media library + upload component (replace URL fields)
- /admin/files Media Library: drag-drop multi-upload, thumbnails, copy-URL, delete - FileUploadField replaces raw URL inputs; new "image" field type in AdminResource; wired into category image - upload proxy /api/admin/files/upload: browser → Next → presigned PUT (server-side, reaches minio:9000) → confirm → returns public URL - user-uploads bucket is public-read; public base via NEXT_PUBLIC_MINIO_URL Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Public base URL for objects in the (public-read) user-uploads MinIO bucket.
|
||||
* Must be browser-reachable (MinIO is published on :9000). Configure per deployment
|
||||
* via NEXT_PUBLIC_MINIO_URL; falls back to localhost for local dev.
|
||||
*/
|
||||
export const MINIO_PUBLIC_URL = (
|
||||
process.env.NEXT_PUBLIC_MINIO_URL ?? "http://localhost:9000"
|
||||
).replace(/\/$/, "");
|
||||
|
||||
/** Build a public object URL from a file's bucket + key. */
|
||||
export function publicFileUrl(bucket: string, key: string): string {
|
||||
return `${MINIO_PUBLIC_URL}/${bucket}/${key}`;
|
||||
}
|
||||
|
||||
export interface UploadedFile {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
mime_type?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user