feat: add verified desktop ChatGPT subscription connection

This commit is contained in:
amosblomqvist
2026-10-24 12:17:08 +03:00
parent ae2fad56c4
commit 0fc6d4ab94
53 changed files with 2557 additions and 140 deletions
+17
View File
@@ -0,0 +1,17 @@
import { NextResponse, type NextRequest } from "next/server";
import { desktopAPIAuthorized } from "./src/server/desktop-access.ts";
/** Applies to every API method, including SSE and spending/settings routes.
* No public callback or worker bypass: internal jobs call server functions,
* and any legitimate self-HTTP request must carry the private capability. */
export function proxy(request: NextRequest) {
if (!desktopAPIAuthorized(request.headers)) {
return NextResponse.json(
{ error: "Desktop API access requires the trusted LearnHarness window." },
{ status: 403, headers: { "Cache-Control": "no-store" } },
);
}
return NextResponse.next();
}
export const config = { matcher: "/api/:path*" };