mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-08 04:08:24 +00:00
Add the admin page (phase 3)
services/admin is a client of the content service's HTTP API, served on the tailnet only. It renders on the server with plain forms and no client scripts, and holds the admin token so the browser never sees it. - Review queue: reasons, line diff against the live version, accept, reject, and reject with the live version put back into Obsidian - Notes and drafts: search, preview, fields, backlinks, publish toggle - History with compare and roll back - Quick capture for a status or a Library item (optionally both) - Store: orders open or closed per category, open slots and stock - Overview: counts, last scan and error, scan now, sync job health - Same-origin check on every post, strict CSP, sanitized previews The content service gains /api/status, sync run reports (/api/syncs) and lookup of a note by name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Starts the admin page. It talks to the content service with the admin
|
||||
* token and must be published on the tailnet only.
|
||||
*/
|
||||
import { ContentApi } from "./client.ts";
|
||||
import { createAdminServer } from "./server.ts";
|
||||
|
||||
const contentUrl = process.env.CONTENT_URL ?? "http://localhost:4310";
|
||||
const token = process.env.ADMIN_TOKEN;
|
||||
if (!token) throw new Error("ADMIN_TOKEN is required: the content service's admin token");
|
||||
const port = Number(process.env.PORT ?? 4320);
|
||||
const host = process.env.HOST ?? "0.0.0.0";
|
||||
|
||||
const server = createAdminServer(new ContentApi(contentUrl, token));
|
||||
server.listen(port, host, () => console.log(`Admin page on ${host}:${port}, using ${contentUrl}`));
|
||||
|
||||
const stop = () => server.close(() => process.exit(0));
|
||||
process.on("SIGTERM", stop);
|
||||
process.on("SIGINT", stop);
|
||||
Reference in New Issue
Block a user