feat: harden deployment and public api handoff
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user