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

@@ -1,6 +1,7 @@
import { createAsset, listAssets } from "@/lib/server/data-store";
import { createAsset } from "@/lib/server/data-store";
import { jsonOk, readJsonBody } from "@/lib/server/api";
import { authenticatePublicApiRequest } from "@/lib/server/public-api-auth";
import { listPublicApiAssets } from "@/lib/server/public-api-assets";
import { publicApiError } from "@/lib/server/public-api-response";
import { DEFAULT_OWNER_ID, requestOrigin } from "@/lib/server/runtime";
import { saveUploadAsset } from "@/lib/server/storage";
@@ -10,8 +11,8 @@ export const runtime = "nodejs";
export async function GET(request: Request) {
try {
authenticatePublicApiRequest(request);
return jsonOk({ assets: await listAssets(DEFAULT_OWNER_ID) });
const client = authenticatePublicApiRequest(request);
return jsonOk({ assets: await listPublicApiAssets(client.id) });
} catch (error) {
return publicApiError(error);
}