v0.2.4 max-monthly union + /relay/policy

This commit is contained in:
local
2026-05-11 22:02:38 -05:00
parent 6797aae404
commit e612e8b8e8
6 changed files with 113 additions and 10 deletions
+28
View File
@@ -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;
}