infoalloggi-monorepo/apps/infoalloggi/src/middleware.ts
Marco Pedone 208deeac28 Refactor image handling in announcement components
- Updated CardAnnuncio and related components to use a new images structure instead of url_immagini.
- Removed references to url_immagini and replaced them with images array containing img and thumb properties.
- Adjusted API responses to include images in the new format.
- Modified middleware and storage service to accommodate new image handling.
- Cleaned up unused code and schemas related to old image references.
- Updated Docker configuration for storage service.
2025-10-27 17:58:42 +01:00

30 lines
911 B
TypeScript

import { type NextRequest, NextResponse } from "next/server";
import { authMiddleware } from "~/middlewares/auth_middleware";
import { apisMiddleware } from "./middlewares/api_middleware";
export async function middleware(request: NextRequest) {
//console.log("Middleware triggered for:", request.nextUrl.pathname);
const { pathname } = request.nextUrl;
if (pathname.startsWith("/storage-api/")) {
return await apisMiddleware(request);
}
return (await authMiddleware(request)) ?? NextResponse.next();
}
export const config = {
matcher: [
"/storage-api/:path*",
{
source: "/",
},
{
missing: [
{ key: "next-router-prefetch", type: "header" },
{ key: "purpose", type: "header", value: "prefetch" },
],
source:
"/((?!api/trpc|storage-api|api/tiles|api/auth|_next/static|_next/image|screenshots|site.webmanifest|favicon.ico|favicon|sitemap.xml|robots.txt).*)",
},
],
};