feat: visual polish & UX — fade-in, theme toggle, scroll-to-top, footer, cursor, badge
- Add FadeIn component (IntersectionObserver scroll-reveal + load animation) - Add dark/light theme toggle (useSyncExternalStore + localStorage) - Add scroll-to-top button (appears after 300px scroll) - Add configurable footer with social links (gallery.yaml) - Add crosshair cursor on photo grid items - Add 'X photos' count badge on subpage cover images - Add light theme color palette in tokens.css
This commit is contained in:
@@ -7,40 +7,25 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
import { authenticate, isProtected } from '@/lib/auth';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { slug, password } = body;
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { slug, password } = body;
|
||||
|
||||
if (!slug || !password) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Missing slug or password' },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
|
||||
if (!isProtected(slug)) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Album is not password-protected' },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
|
||||
const setCookie = authenticate(slug, password);
|
||||
if (!setCookie) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid password' },
|
||||
{ status: 401 },
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true },
|
||||
{ headers: { 'Set-Cookie': setCookie } },
|
||||
);
|
||||
} catch {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid request body' },
|
||||
{ status: 400 },
|
||||
);
|
||||
if (!slug || !password) {
|
||||
return NextResponse.json({ error: 'Missing slug or password' }, { status: 400 });
|
||||
}
|
||||
|
||||
if (!isProtected(slug)) {
|
||||
return NextResponse.json({ error: 'Album is not password-protected' }, { status: 400 });
|
||||
}
|
||||
|
||||
const setCookie = authenticate(slug, password);
|
||||
if (!setCookie) {
|
||||
return NextResponse.json({ error: 'Invalid password' }, { status: 401 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true }, { headers: { 'Set-Cookie': setCookie } });
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user