feat: establish NekoNest Cloud control and relay

This commit is contained in:
2026-08-12 23:25:43 +08:00
commit f27606b709
222 changed files with 71456 additions and 0 deletions
@@ -0,0 +1,25 @@
import {
authenticateRelayNode,
authorizePhoneRoute,
} from "@/db/relay-control-plane";
import { apiError, readJsonMutation } from "../../../respond";
export async function POST(request: Request) {
try {
const principal = await authenticateRelayNode(request);
const payload = await readJsonMutation<{
route_handle?: string;
phone_token_hash?: string;
}>(request);
return Response.json(
await authorizePhoneRoute({
principal,
routeHandle: payload.route_handle ?? "",
phoneTokenHash: payload.phone_token_hash ?? "",
}),
{ headers: { "cache-control": "no-store" } },
);
} catch (error) {
return apiError(error);
}
}