feat: publish approved RF4 media catalog
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s

This commit is contained in:
ik
2026-09-14 22:20:46 +07:00
parent 6146ea9eb0
commit b47a6cc366
25 changed files with 2487 additions and 893 deletions
@@ -0,0 +1,21 @@
import type { APIRoute } from "astro";
const apiBase = process.env.API_INTERNAL_URL || import.meta.env.API_INTERNAL_URL || "http://localhost:8000";
export const GET: APIRoute = async ({ params }) => {
const digest = params.digest ?? "";
if (!/^[a-f0-9]{64}$/.test(digest)) return new Response("Not found", { status: 404 });
try {
const upstream = await fetch(`${apiBase}/api/v1/media/assets/${digest}`);
if (!upstream.ok || !upstream.body) return new Response("Not found", { status: upstream.status === 404 ? 404 : 502 });
const headers = new Headers();
for (const name of ["content-type", "content-length", "cache-control", "etag"]) {
const value = upstream.headers.get(name);
if (value) headers.set(name, value);
}
return new Response(upstream.body, { status: 200, headers });
} catch {
return new Response("Media service unavailable", { status: 502 });
}
};