feat: harden deployment and public api handoff

This commit is contained in:
inman
2026-05-29 14:00:39 +08:00
parent 63e62d444c
commit 4b21d2999c
16 changed files with 961 additions and 19 deletions

View File

@@ -0,0 +1,18 @@
import { jsonError, jsonOk } from "@/lib/server/api";
import { authenticatePublicApiRequest } from "@/lib/server/public-api-auth";
import { getPublicApiAsset } from "@/lib/server/public-api-assets";
import { publicApiError } from "@/lib/server/public-api-response";
export const runtime = "nodejs";
export async function GET(request: Request, context: { params: Promise<{ id: string }> }) {
try {
const client = authenticatePublicApiRequest(request);
const { id } = await context.params;
const asset = await getPublicApiAsset(client.id, id);
if (!asset) return jsonError("Asset not found.", 404);
return jsonOk({ asset });
} catch (error) {
return publicApiError(error);
}
}