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
+28
View File
@@ -0,0 +1,28 @@
import { getCloudViewer } from "@/app/cloud-auth";
import { getOrCreateAccount, revokeHost } from "@/db/repository";
import { apiError, readJsonMutation } from "../../respond";
export async function POST(request: Request) {
try {
const viewer = await getCloudViewer();
if (!viewer) {
return Response.json(
{ error: "authentication_required", message: "请先登录" },
{ status: 401 },
);
}
const payload = await readJsonMutation<{ hostId?: string; reason?: string }>(
request,
);
const account = await getOrCreateAccount(viewer);
const result = await revokeHost({
accountId: account.id,
hostId: payload.hostId ?? "",
actorId: viewer.userId,
reason: payload.reason ?? "用户从控制台撤销主机",
});
return Response.json(result);
} catch (error) {
return apiError(error);
}
}