v0.2.4 max-monthly union + /relay/policy
This commit is contained in:
@@ -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