feat(v1.5.1): renomeação OpenSheets → OpenMonetis + multi-domínio
Renomeia o projeto em ~40 arquivos (package.json, manifests, layouts, componentes, server actions, emails, Docker, docs, landing page). Adiciona suporte a multi-domínio via PUBLIC_DOMAIN onde o domínio público serve apenas a landing page sem botões de auth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
proxy.ts
16
proxy.ts
@@ -22,6 +22,21 @@ const PUBLIC_AUTH_ROUTES = ["/login", "/signup"];
|
||||
export default async function proxy(request: NextRequest) {
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
// Multi-domain: block all routes except landing on public domain
|
||||
// Normalize PUBLIC_DOMAIN: strip protocol and port if provided
|
||||
const publicDomain = process.env.PUBLIC_DOMAIN?.replace(
|
||||
/^https?:\/\//,
|
||||
"",
|
||||
).replace(/:\d+$/, "");
|
||||
const hostname = request.headers.get("host")?.replace(/:\d+$/, "");
|
||||
|
||||
if (publicDomain && hostname === publicDomain) {
|
||||
if (pathname !== "/") {
|
||||
return NextResponse.redirect(new URL("/", request.url));
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// Validate actual session, not just cookie existence
|
||||
const session = await auth.api.getSession({
|
||||
headers: request.headers,
|
||||
@@ -49,6 +64,7 @@ export default async function proxy(request: NextRequest) {
|
||||
export const config = {
|
||||
// Apply middleware to protected and auth routes
|
||||
matcher: [
|
||||
"/",
|
||||
"/ajustes/:path*",
|
||||
"/anotacoes/:path*",
|
||||
"/calendario/:path*",
|
||||
|
||||
Reference in New Issue
Block a user