fix: move mii images to new uploads directory and add route to access it

This commit is contained in:
trafficlunar 2025-04-30 19:25:50 +01:00
parent 594309d22d
commit eea3df283c
12 changed files with 73 additions and 33 deletions

View file

@ -78,7 +78,7 @@ export default function DeleteMiiButton({ miiId, miiName, likes }: Props) {
<p className="text-sm text-zinc-500">Are you sure? This will delete your Mii permanently. This action cannot be undone.</p>
<div className="bg-orange-100 rounded-xl border-2 border-orange-400 mt-4 flex">
<Image src={`/mii/${miiId}/mii.webp`} alt="mii image" width={128} height={128} />
<Image src={`/mii/${miiId}/image?type=mii`} alt="mii image" width={128} height={128} />
<div className="p-4">
<p className="text-xl font-bold line-clamp-1" title={miiName}>
{miiName}

View file

@ -83,9 +83,9 @@ export default function MiiList({ isLoggedIn, userId, sessionUserId }: Props) {
>
<Carousel
images={[
`/mii/${mii.id}/mii.webp`,
`/mii/${mii.id}/qr-code.webp`,
...Array.from({ length: mii.imageCount }, (_, index) => `/mii/${mii.id}/image${index}.webp`),
`/mii/${mii.id}/image?type=mii`,
`/mii/${mii.id}/image?type=qr-code`,
...Array.from({ length: mii.imageCount }, (_, index) => `/mii/${mii.id}/image?type=image${index}`),
]}
/>

View file

@ -91,7 +91,7 @@ export default function EditForm({ mii, likes }: Props) {
try {
const existing = await Promise.all(
Array.from({ length: mii.imageCount }, async (_, index) => {
const path = `/mii/${mii.id}/image${index}.webp`;
const path = `/mii/${mii.id}/image?type=image${index}`;
const response = await fetch(path);
const blob = await response.blob();
@ -112,7 +112,9 @@ export default function EditForm({ mii, likes }: Props) {
<form className="flex justify-center gap-4 w-full max-lg:flex-col max-lg:items-center">
<div className="flex justify-center">
<div className="w-[18.75rem] h-min flex flex-col bg-zinc-50 rounded-3xl border-2 border-zinc-300 shadow-lg p-3">
<Carousel images={[`/mii/${mii.id}/mii.webp`, `/mii/${mii.id}/qr-code.webp`, ...files.map((file) => URL.createObjectURL(file))]} />
<Carousel
images={[`/mii/${mii.id}/image?type=mii`, `/mii/${mii.id}/image?type=qr-code`, ...files.map((file) => URL.createObjectURL(file))]}
/>
<div className="p-4 flex flex-col gap-1 h-full">
<h1 className="font-bold text-2xl line-clamp-1" title={name}>