diff --git a/src/app/api/dev-reset-profile/route.ts b/src/app/api/dev-reset-profile/route.ts index b61154b..799273d 100644 --- a/src/app/api/dev-reset-profile/route.ts +++ b/src/app/api/dev-reset-profile/route.ts @@ -18,7 +18,8 @@ export async function POST(request: NextRequest) { return Response.json({ error: "userId is required" }, { status: 400 }); } - const scriptPath = "C:\\Users\\User\\.gemini\\antigravity-ide\\brain\\5015ea2d-f1fc-4e3d-9372-4bb0670449cc\\scratch\\reset_user.py"; + const scriptPath = + "C:\\Users\\User\\.gemini\\antigravity-ide\\brain\\5015ea2d-f1fc-4e3d-9372-4bb0670449cc\\scratch\\reset_user.py"; // Construct the command safely with numeric userId const command = `python "${scriptPath}" ${Number(userId)}`; const { stdout, stderr } = await execAsync(command); @@ -36,6 +37,9 @@ export async function POST(request: NextRequest) { } } catch (error: any) { console.error("Failed to reset profile:", error); - return Response.json({ error: error.message || "Internal Server Error" }, { status: 500 }); + return Response.json( + { error: error.message || "Internal Server Error" }, + { status: 500 }, + ); } } diff --git a/src/app/api/proxy/route.ts b/src/app/api/proxy/route.ts index 464d650..28cd2bf 100644 --- a/src/app/api/proxy/route.ts +++ b/src/app/api/proxy/route.ts @@ -131,7 +131,7 @@ function getRequestHeaders(request: NextRequest, targetUrl: URL) { getCookieValue(cookieHeader, "token") ?? getCookieValue(cookieHeader, "auth_token"); - if (cookieToken) { + if (cookieToken && cookieToken !== "NO_TOKEN") { headers.set("authorization", `Token ${cookieToken}`); } } @@ -141,6 +141,14 @@ function getRequestHeaders(request: NextRequest, targetUrl: URL) { headers.set("authorization", `Token ${authKey}`); } + // Fall back to the development default token when nothing else provided auth. + if (!headers.has("authorization")) { + const defaultToken = process.env.NEXT_PUBLIC_DEFAULT_TOKEN; + if (defaultToken && defaultToken !== "NO_TOKEN") { + headers.set("authorization", `Token ${defaultToken}`); + } + } + // Dynamically set language headers let lang = getCookieValue(cookieHeader, "HABIB_LANGUAGE") ?? diff --git a/src/app/finding-match/page.tsx b/src/app/finding-match/page.tsx index 7ee7247..1c9cd1c 100644 --- a/src/app/finding-match/page.tsx +++ b/src/app/finding-match/page.tsx @@ -89,7 +89,9 @@ export default function FindingMatchPage() { role="status" >