feat: massive front-end overhaul and initial github release

This commit is contained in:
Simeon Radivoev 2026-02-08 21:18:10 +02:00
parent a2b40e38bf
commit d5a0e70580
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
303 changed files with 19840 additions and 676 deletions

38
src/bun/api/clients.ts Normal file
View file

@ -0,0 +1,38 @@
import { config } from "./settings";
import Elysia from "elysia";
export const romm = new Elysia({ prefix: "/romm" })
.all("/*", async ({ request, params, set }) =>
{
if (!config.has('rommAddress') && !config.get('rommAddress'))
{
return new Response("Romm Address Not Found", { status: 404 });
}
const rommUrl = new URL(config.get('rommAddress')!);
const url = new URL(request.url);
url.pathname = url.pathname.replace(/^\/api\/romm/, '');
url.host = rommUrl.host;
url.port = rommUrl.port;
url.protocol = rommUrl.protocol;
// Forward headers (optional: remove host if needed)
const headers = new Headers(request.headers);
headers.delete('host');
headers.set("accept-encoding", "identity");
const rommResponse = await fetch(url, {
method: request.method,
headers,
body: await request.arrayBuffer(),
redirect: 'manual', // avoid ROMM redirects
});
set.status = rommResponse.status;
rommResponse.headers.forEach((value, key) =>
{
set.headers[key] = value;
});
return new Response(rommResponse.body, { status: rommResponse.status });
});