feat: redesign news & master classes sections, migrate middleware to proxy

- News: magazine layout with featured hero article + compact list, click-to-open modal
- Master classes: fashion lookbook portrait cards with full-bleed images and overlay content
- Rename middleware.ts to proxy.ts (Next.js 16 convention)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-16 18:49:13 +03:00
parent 4a1a2d7512
commit 26cb9a9772
4 changed files with 336 additions and 136 deletions

28
src/proxy.ts Normal file
View File

@@ -0,0 +1,28 @@
import { NextRequest, NextResponse } from "next/server";
import { verifyToken, COOKIE_NAME } from "@/lib/auth-edge";
export async function proxy(request: NextRequest) {
const { pathname } = request.nextUrl;
// Allow login page and login API
if (pathname === "/admin/login" || pathname === "/api/auth/login") {
return NextResponse.next();
}
// Protect /admin/* and /api/admin/*
const token = request.cookies.get(COOKIE_NAME)?.value;
const valid = token ? await verifyToken(token) : false;
if (!valid) {
if (pathname.startsWith("/api/")) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
return NextResponse.redirect(new URL("/admin/login", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/admin/:path*", "/api/admin/:path*"],
};