feat: v1 — persistent shell, model gateway, artifact improvements (#1462)
This commit is contained in:
parent
3651670fb9
commit
f9652b452a
161 changed files with 5166 additions and 8009 deletions
1
app/(auth)/api/auth/[...nextauth]/route.ts
Normal file
1
app/(auth)/api/auth/[...nextauth]/route.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { GET, POST } from "@/app/(auth)/auth";
|
||||
26
app/(auth)/api/auth/guest/route.ts
Normal file
26
app/(auth)/api/auth/guest/route.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import { getToken } from "next-auth/jwt";
|
||||
import { signIn } from "@/app/(auth)/auth";
|
||||
import { isDevelopmentEnvironment } from "@/lib/constants";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const rawRedirect = searchParams.get("redirectUrl") || "/";
|
||||
const redirectUrl =
|
||||
rawRedirect.startsWith("/") && !rawRedirect.startsWith("//")
|
||||
? rawRedirect
|
||||
: "/";
|
||||
|
||||
const token = await getToken({
|
||||
req: request,
|
||||
secret: process.env.AUTH_SECRET,
|
||||
secureCookie: !isDevelopmentEnvironment,
|
||||
});
|
||||
|
||||
if (token) {
|
||||
const base = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||
return NextResponse.redirect(new URL(`${base}/`, request.url));
|
||||
}
|
||||
|
||||
return signIn("guest", { redirect: true, redirectTo: redirectUrl });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue