import { Hono } from "hono";

import { rpcApp } from "./routes/rpc";
import { clientEntry } from "./routes/client-entry";

const app = new Hono();

// Allow all hosts for Tailscale Funnel
app.use("*", async (c, next) => {
  // Accept requests from any host
  return next();
});

// Health check endpoint
app.get("/health", (c) => {
  return c.json({ status: "ok", timestamp: new Date().toISOString() });
});

app.route("/rpc", rpcApp);
app.get("/*", clientEntry);

export default app;
