Add proactive token refresh lead times for providers and implement Codex proxy management
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
pollForToken
|
||||
} from "@/lib/oauth/providers";
|
||||
import { createProviderConnection } from "@/models";
|
||||
import { startCodexProxy, stopCodexProxy } from "@/lib/oauth/utils/server";
|
||||
|
||||
/**
|
||||
* Dynamic OAuth API Route
|
||||
@@ -30,6 +31,26 @@ export async function GET(request, { params }) {
|
||||
return NextResponse.json(authData);
|
||||
}
|
||||
|
||||
if (action === "start-proxy") {
|
||||
if (provider !== "codex") {
|
||||
return NextResponse.json({ error: "Proxy only supported for codex" }, { status: 400 });
|
||||
}
|
||||
const appPort = searchParams.get("app_port");
|
||||
if (!appPort) {
|
||||
return NextResponse.json({ error: "Missing app_port" }, { status: 400 });
|
||||
}
|
||||
const result = await startCodexProxy(Number(appPort));
|
||||
return NextResponse.json(result);
|
||||
}
|
||||
|
||||
if (action === "stop-proxy") {
|
||||
if (provider !== "codex") {
|
||||
return NextResponse.json({ error: "Proxy only supported for codex" }, { status: 400 });
|
||||
}
|
||||
stopCodexProxy();
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
|
||||
if (action === "device-code") {
|
||||
const providerData = getProvider(provider);
|
||||
if (providerData.flowType !== "device_code") {
|
||||
|
||||
Reference in New Issue
Block a user