Projeto bot pontos

This commit is contained in:
2026-10-23 22:31:02 -03:00
parent 29614855ff
commit b35e1a7d69
116 changed files with 14523 additions and 0 deletions

18
web/middleware.ts Normal file
View File

@@ -0,0 +1,18 @@
// Só redireciona para /login quando não há cookie de sessão.
// A autorização de verdade acontece sempre na API Go (ARQUITETURA.md 5.4).
import { NextResponse, type NextRequest } from "next/server";
export function middleware(req: NextRequest) {
if (!req.cookies.get("bp_session")) {
const url = req.nextUrl.clone();
url.pathname = "/login";
url.search = req.nextUrl.pathname === "/" ? "" : `?next=${encodeURIComponent(req.nextUrl.pathname)}`;
return NextResponse.redirect(url);
}
return NextResponse.next();
}
export const config = {
// Tudo, menos login, healthcheck, API (repassada ao Go) e arquivos do Next.
matcher: ["/((?!login|healthz|api/|_next/|favicon.ico).*)"],
};