v0.2.4 max-monthly union + /relay/policy
This commit is contained in:
@@ -22,6 +22,7 @@ import { transcribeRouter } from "./routes/transcribe.js";
|
||||
import { analyzeRouter } from "./routes/analyze.js";
|
||||
import { healthRouter } from "./routes/health.js";
|
||||
import { balanceRouter } from "./routes/balance.js";
|
||||
import { policyRouter } from "./routes/policy.js";
|
||||
import { adminRouter } from "./routes/admin.js";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -47,6 +48,7 @@ setupAdminAuthRoutes(app);
|
||||
// authenticates per-call via headers (X-Recap-Install-Id required,
|
||||
// Authorization optional).
|
||||
app.use("/relay", healthRouter());
|
||||
app.use("/relay", policyRouter());
|
||||
app.use("/relay", balanceRouter());
|
||||
app.use("/relay", transcribeRouter());
|
||||
app.use("/relay", analyzeRouter());
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "recap-relay-server",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// GET /relay/policy — public, no auth. Returns the relay's current
|
||||
// tier-quota config so Recap installs can show dynamic copy (e.g. the
|
||||
// activation screen's "N relay credits" line stays in sync when the
|
||||
// operator tunes the Core lifetime cap via the Adjust Tier Quotas
|
||||
// StartOS action, with no Recap update required).
|
||||
//
|
||||
// Read-only, safe to expose publicly — the response is the same
|
||||
// information the relay enforces against every request anyway.
|
||||
|
||||
import express from "express";
|
||||
import { getTierQuotas } from "../config.js";
|
||||
|
||||
export function policyRouter() {
|
||||
const router = express.Router();
|
||||
|
||||
router.get("/policy", async (_req, res) => {
|
||||
const tiers = await getTierQuotas();
|
||||
res.json({
|
||||
tiers,
|
||||
// Convenience field for Recap clients that just want "N credits
|
||||
// for a fresh Core install" without re-deriving from tiers.core.
|
||||
core_total_credits: tiers.core?.lifetime ?? null,
|
||||
core_gemini_credits: tiers.core?.geminiCapLifetime ?? null,
|
||||
});
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
||||
Reference in New Issue
Block a user