Support sub-path deploy via NEXT_PUBLIC_BASE_PATH (loma.chat/pagiva)
Adds basePath config, withBase/appUrl helpers, base-path-aware cookies, OAuth redirects, manifest, service worker and cron runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { BASE_PATH } from "@/lib/base-path";
|
||||
import { cookies } from "next/headers";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { encryptToken } from "@/lib/crypto/tokenBox";
|
||||
@@ -22,7 +23,7 @@ export async function GET(req: Request) {
|
||||
const url = new URL(req.url);
|
||||
const jar = await cookies();
|
||||
const stateCookie = jar.get(OAUTH_STATE_COOKIE)?.value;
|
||||
jar.delete({ name: OAUTH_STATE_COOKIE, path: "/api/facebook/oauth" });
|
||||
jar.delete({ name: OAUTH_STATE_COOKIE, path: `${BASE_PATH}/api/facebook/oauth` });
|
||||
|
||||
const userId = await verifyOAuthState(stateCookie, url.searchParams.get("state"));
|
||||
if (!userId) return hop(`/pages?fb_error=${encodeURIComponent("ลิงก์เชื่อมหมดอายุหรือไม่ถูกต้อง ลองกดเชื่อมใหม่")}`);
|
||||
|
||||
Reference in New Issue
Block a user