Restore videoreg public guide site with static isolated deployment
Production container deploy / production (push) Failing after 2m34s
Production container deploy / production (push) Failing after 2m34s
This commit is contained in:
1 parent
2ce58fcbc0
commit
53e4f06486
35 files changed
+599
-355
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { revalidatePath, revalidateTag } from 'next/cache';
|
||||
import { getCachedVideoDashboard, VIDEO_COLLECTION_TAG } from '@/entities/video/api/videoCache';
|
||||
import { addVideo } from '@/entities/video/api/videoRepository';
|
||||
import { normalizeVideoDraft } from '@/entities/video/model/video';
|
||||
|
||||
export const revalidate = 3600;
|
||||
|
||||
export async function GET() {
|
||||
const dashboard = await getCachedVideoDashboard();
|
||||
|
||||
return NextResponse.json(dashboard, {
|
||||
headers: {
|
||||
'cache-control': 'public, max-age=60, s-maxage=3600, stale-while-revalidate=86400',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = (await request.json().catch(() => undefined)) as
|
||||
| { title?: string; owner?: string; sourceUrl?: string; status?: string }
|
||||
| undefined;
|
||||
|
||||
const video = await addVideo(normalizeVideoDraft(body ?? {}));
|
||||
revalidateTag(VIDEO_COLLECTION_TAG, { expire: 0 });
|
||||
revalidatePath('/');
|
||||
|
||||
return NextResponse.json({ video }, { status: 201 });
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { NextResponse, type NextRequest } from 'next/server';
|
||||
export function proxy(request: NextRequest) { if(request.nextUrl.pathname.startsWith('/api/videos') || request.nextUrl.pathname.endsWith('/showcase')) return new NextResponse('Not found',{status:404}); return NextResponse.next(); }
|
||||
export const config={matcher:['/api/videos/:path*','/:devRoot/showcase']};
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Design System Showcase | videoreg.ru',
|
||||
description:
|
||||
'Hidden design-system showcase for the Best Dashcams 2026 comparison experience.',
|
||||
robots: {
|
||||
follow: false,
|
||||
index: false,
|
||||
},
|
||||
};
|
||||
|
||||
type ShowcaseLayoutProps = {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export default function ShowcaseLayout({ children }: ShowcaseLayoutProps) {
|
||||
return children;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { dashcamProducts } from '@/entities/dashcam/model/data';
|
||||
import { BestDashcamsPage } from '@/shared/ui/templates/BestDashcamsPage';
|
||||
|
||||
export const dynamicParams = false;
|
||||
export const revalidate = 3600;
|
||||
|
||||
export function generateStaticParams() {
|
||||
return [{ devRoot: '_dev' }];
|
||||
}
|
||||
|
||||
type ShowcasePageProps = {
|
||||
params: Promise<{
|
||||
devRoot: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
export default async function ShowcasePage({ params }: ShowcasePageProps) {
|
||||
const { devRoot } = await params;
|
||||
|
||||
if (devRoot !== '_dev') {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <BestDashcamsPage products={dashcamProducts} />;
|
||||
}
|
||||
Reference in new issue
Block a user