fix: hide dashboard + internal routes from swagger docs

This commit is contained in:
M1
2026-03-16 13:33:44 +04:00
parent fe7a0bf19b
commit fd4af848bc
3 changed files with 11 additions and 11 deletions
+8 -9
View File
@@ -3,13 +3,12 @@ import { resolve } from "path";
const dir = resolve(import.meta.dir, "../dashboard");
export const dashboard = new Elysia()
// Static assets
.get("/dashboard/app.js", () => Bun.file(`${dir}/app.js`))
.get("/dashboard/query-builder.js", () => Bun.file(`${dir}/query-builder.js`))
const hide = { detail: { hide: true } };
// Pages
.get("/dashboard", () => Bun.file(`${dir}/index.html`))
.get("/dashboard/home", () => Bun.file(`${dir}/home.html`))
.get("/dashboard/monitors/new", () => Bun.file(`${dir}/new.html`))
.get("/dashboard/monitors/:id", () => Bun.file(`${dir}/detail.html`));
export const dashboard = new Elysia()
.get("/dashboard/app.js", () => Bun.file(`${dir}/app.js`), hide)
.get("/dashboard/query-builder.js", () => Bun.file(`${dir}/query-builder.js`), hide)
.get("/dashboard", () => Bun.file(`${dir}/index.html`), hide)
.get("/dashboard/home", () => Bun.file(`${dir}/home.html`), hide)
.get("/dashboard/monitors/new", () => Bun.file(`${dir}/new.html`), hide)
.get("/dashboard/monitors/:id", () => Bun.file(`${dir}/detail.html`), hide);
+2 -1
View File
@@ -4,7 +4,7 @@
import { Elysia } from "elysia";
import sql from "../db";
export const internal = new Elysia({ prefix: "/internal" })
export const internal = new Elysia({ prefix: "/internal", detail: { hide: true } })
.derive(({ headers, error }) => {
if (headers["x-monitor-token"] !== process.env.MONITOR_TOKEN)
return error(401, { error: "Unauthorized" });
@@ -13,6 +13,7 @@ export const internal = new Elysia({ prefix: "/internal" })
// Returns monitors that are due for a check
.get("/due", async () => {
return sql`
SELECT m.id, m.url, m.interval_s, m.query
FROM monitors m