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,23 @@
import {
authenticateRelayNode,
authorizeDeviceForRelay,
} 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<{
device_id?: string;
token_hash?: string;
}>(request);
const result = await authorizeDeviceForRelay({
principal,
deviceId: payload.device_id ?? "",
tokenHash: payload.token_hash?.trim().toLowerCase() ?? "",
});
return Response.json(result, { headers: { "cache-control": "no-store" } });
} catch (error) {
return apiError(error);
}
}