mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
hanzo-build-linux-amd64 is the only ARC runner pool installed on hanzo-k8s today (arm64 pool is paused until DigitalOcean ships arm64 droplets, per ~/work/hanzo/.github/RUNNERS.md). The arm64 job was waiting on spark-hanzoai-arm64 — not provisioned in this cluster — so every build sat in queue forever and the amd64 leg got cancelled. Set platforms: linux/amd64 on the reusable build call to skip arm64 entirely. Re-add arm64 if/when DO ships arm64 droplets and the spark runner pool comes back online.
78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import { jackson } from "@/lib/jackson";
|
|
import type { OAuthReq } from "@boxyhq/saml-jackson";
|
|
import { NextResponse } from "next/server";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET(req: Request) {
|
|
try {
|
|
const { oauthController } = await jackson();
|
|
|
|
const url = new URL(req.url);
|
|
const requestParams = Object.fromEntries(
|
|
url.searchParams.entries(),
|
|
) as unknown as OAuthReq;
|
|
|
|
const { redirect_url, authorize_form } =
|
|
await oauthController.authorize(requestParams);
|
|
|
|
if (redirect_url) {
|
|
return NextResponse.redirect(redirect_url, { status: 302 });
|
|
} else if (authorize_form) {
|
|
return new Response(authorize_form, {
|
|
headers: { "Content-Type": "text/html; charset=utf-8" },
|
|
});
|
|
}
|
|
|
|
return NextResponse.json(
|
|
{ error: "No redirect URL returned" },
|
|
{ status: 400 },
|
|
);
|
|
} catch (error: any) {
|
|
console.error("[SAML] Authorize error:", error);
|
|
return NextResponse.json(
|
|
{ error: error.message || "Internal server error" },
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
}
|
|
|
|
export async function POST(req: Request) {
|
|
try {
|
|
const { oauthController } = await jackson();
|
|
|
|
const contentType = req.headers.get("content-type") || "";
|
|
|
|
let body: Record<string, any>;
|
|
|
|
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
const formData = await req.formData();
|
|
body = Object.fromEntries(formData.entries());
|
|
} else {
|
|
body = await req.json();
|
|
}
|
|
|
|
const { redirect_url, authorize_form } =
|
|
await oauthController.authorize(body as unknown as OAuthReq);
|
|
|
|
if (redirect_url) {
|
|
return NextResponse.redirect(redirect_url, { status: 302 });
|
|
} else if (authorize_form) {
|
|
return new Response(authorize_form, {
|
|
headers: { "Content-Type": "text/html; charset=utf-8" },
|
|
});
|
|
}
|
|
|
|
return NextResponse.json(
|
|
{ error: "No redirect URL returned" },
|
|
{ status: 400 },
|
|
);
|
|
} catch (error: any) {
|
|
console.error("[SAML] Authorize error:", error);
|
|
return NextResponse.json(
|
|
{ error: error.message || "Internal server error" },
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
}
|