Initial commit: page-manager Next.js app with Coolify deploy support
Replace Vercel-specific infra (Cron, Blob) with self-hosted equivalents for deployment to Coolify: in-container cron scheduler (scripts/cron-runner.mjs) and disk-based upload storage served via /api/uploads/[...path]. Add Dockerfile, .dockerignore, and /api/health for container health checks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import {
|
||||
authorizeUrl,
|
||||
createSocialState,
|
||||
enabledProviders,
|
||||
parseProvider,
|
||||
safeRedirectPath,
|
||||
SOCIAL_STATE_COOKIE,
|
||||
SOCIAL_STATE_PATH,
|
||||
SOCIAL_STATE_TTL_SECONDS,
|
||||
} from "@/lib/auth/social";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
/** Public: sends the browser to the Google / Facebook sign-in dialog. */
|
||||
export async function GET(req: Request, ctx: RouteContext<"/api/auth/oauth/[provider]/start">) {
|
||||
const { provider: raw } = await ctx.params;
|
||||
const url = new URL(req.url);
|
||||
const provider = parseProvider(raw);
|
||||
if (!provider || !enabledProviders().includes(provider)) {
|
||||
return NextResponse.redirect(new URL("/login?error=not_configured", url.origin));
|
||||
}
|
||||
|
||||
const { nonce, cookie } = await createSocialState(provider, {
|
||||
from: safeRedirectPath(url.searchParams.get("from")),
|
||||
remember: url.searchParams.get("remember") !== "0",
|
||||
});
|
||||
const res = NextResponse.redirect(authorizeUrl(provider, url.origin, nonce));
|
||||
res.cookies.set(SOCIAL_STATE_COOKIE, cookie, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
// Lax: must survive the top-level redirect back from the provider.
|
||||
sameSite: "lax",
|
||||
path: SOCIAL_STATE_PATH,
|
||||
maxAge: SOCIAL_STATE_TTL_SECONDS,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user