feat(backend): add admin API with provider config endpoint (#83)

* feat(backend): add admin API with provider config endpoint

Add /api/admin/* route group with admin role middleware and a
PUT /api/admin/:sourceId/config endpoint for updating feed source
provider config at runtime. Currently supports aelis.weather.

Co-authored-by: Ona <no-reply@ona.com>

* test: remove weak active session test

Co-authored-by: Ona <no-reply@ona.com>

---------

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-21 19:01:43 +00:00
committed by GitHub
parent 0095d9cd72
commit 7862a6d367
6 changed files with 381 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
import { Hono } from "hono"
import { registerAdminHttpHandlers } from "./admin/http.ts"
import { createRequireAdmin } from "./auth/admin-middleware.ts"
import { registerAuthHandlers } from "./auth/http.ts"
import { createAuth } from "./auth/index.ts"
import { createRequireSession } from "./auth/session-middleware.ts"
@@ -50,6 +52,7 @@ function main() {
app.get("/health", (c) => c.json({ status: "ok" }))
const authSessionMiddleware = createRequireSession(auth)
const adminMiddleware = createRequireAdmin(auth)
registerAuthHandlers(app, auth)
@@ -58,6 +61,7 @@ function main() {
authSessionMiddleware,
})
registerLocationHttpHandlers(app, { sessionManager, authSessionMiddleware })
registerAdminHttpHandlers(app, { sessionManager, adminMiddleware, db })
process.on("SIGTERM", async () => {
await closeDb()