package traefikllmgateway import ( "encoding/json" "fmt" "net/http" "net/url" "sort" "strconv" "strings" "time" ) // The admin dashboard's routes (spec §4, v0.2; adminUsageHistoryPath added // by the v0.2 data-layer task; adminAssetsPathPrefix added by the Vue // admin-panel task; adminTargetsPath added by Feature B, v0.21), matched // only when adminEnabled(g.cfg) — see llmgateway.go's ServeHTTP dispatch. // adminAssetsPathPrefix is a prefix, not one fixed path: every hashed // filename the Vite build emits (admin_assets_gen.go) is served under it. const ( adminPagePath = "/admin" adminAssetsPathPrefix = "/admin/assets/" adminOverviewPath = "/admin/api/overview" adminUsagePath = "/admin/api/usage" adminUsageHistoryPath = "/admin/api/usage/history" adminTargetsPath = "/admin/api/targets" ) // adminCSP is the Content-Security-Policy header served with GET /admin, // every GET /admin/assets/{hashedname} response (serveAdminAsset), and // every /admin/api/* JSON route — every /admin* response this // gateway ever sends (spec §4, v0.2; extended to the JSON routes by a // folded review item, 2026-08-20 review; extended to the asset route by // a later review sweep — see serveAdminAsset's own doc comment for why). // It was // widened with `script-src 'unsafe-inline'`/`style-src 'unsafe-inline'` // for the original vanilla-JS single-file page; the baked Vue build (Vue // admin-panel task) needs neither: `vite build` emits index.html with // only an external `