Spaces:
Running
Running
Download lib/auth/proxy.ts from Leon4gr45/nodepad-hypotheses: direct link, hf CLI and curl.
- Browser
- Download file 395 Bytes
-
https://huggingface.co/spaces/Leon4gr45/nodepad-hypotheses/resolve/main/lib/auth/proxy.ts
- Command line
-
hf download hf://spaces/Leon4gr45/nodepad-hypotheses/lib/auth/proxy.ts
-
curl -L -o proxy.ts https://huggingface.co/spaces/Leon4gr45/nodepad-hypotheses/resolve/main/lib/auth/proxy.ts
395 Bytes
| import { NextRequest, NextResponse } from "next/server" | |
| export const SESSION_COOKIE = "nodepad_session" | |
| export function isAuthenticatedProxy(req: NextRequest): boolean { | |
| const header = req.headers.get("authorization") || "" | |
| if (header.startsWith("Bearer ") && header.length > 7) { | |
| return true; // Weak check for proxy routing | |
| } | |
| return !!req.cookies.get(SESSION_COOKIE)?.value; | |
| } | |