Files
edubox/server/app/api/check-domain/route.ts
EduBox Dev 124543d658 feat(vpn): VPN on-demand Tailscale + agent studioE5 standalone
- Agent studioE5 standalone en Go (console + systray)
- VPN on-demand via tailscaled + tailscale up (authkey Headscale)
- Resolver/serveur dans le tailnet studioe5
- Caddy on-demand TLS pour les instances
- Nouveaux endpoints serveur /api/internal/send-to-node
- Suppression des anciens binaires edubox-agent
- Suivi dans SUIVI_VPN_ONDEMAND.md
2026-06-23 09:48:00 +00:00

32 lines
841 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
const MAIN_DOMAIN = process.env.MAIN_DOMAIN || "alfrednobel.edudeploy.com";
export async function GET(req: NextRequest) {
const { searchParams } = new URL(req.url);
const domain = searchParams.get("domain");
if (!domain) {
return NextResponse.json({ ok: false }, { status: 400 });
}
if (
domain === MAIN_DOMAIN ||
domain === `headscale.${MAIN_DOMAIN}`
) {
return NextResponse.json({ ok: true });
}
if (!domain.endsWith(`.${MAIN_DOMAIN}`)) {
return NextResponse.json({ ok: false }, { status: 400 });
}
const subdomain = domain.replace(`.${MAIN_DOMAIN}`, "");
const instance = await prisma.instance.findUnique({
where: { id: subdomain },
});
return NextResponse.json({ ok: !!instance });
}