Business agent: Hetzner DNS API works with same token, unblocked

This commit is contained in:
Hoid 2026-02-14 13:55:32 +00:00
parent a0a03e337c
commit 46967f730a
9 changed files with 247 additions and 19 deletions

View file

@ -10,9 +10,12 @@ import { authMiddleware } from "./middleware/auth.js";
import { usageMiddleware } from "./middleware/usage.js";
import { getUsageStats } from "./middleware/usage.js";
import { initBrowser, closeBrowser } from "./services/browser.js";
import { billingRouter } from "./routes/billing.js";
const app = express();
const PORT = parseInt(process.env.PORT || "3100", 10);
app.use(helmet());
// Raw body for Stripe webhook signature verification
app.use("/v1/billing/webhook", express.raw({ type: "application/json" }));
app.use(express.json({ limit: "2mb" }));
app.use(express.text({ limit: "2mb", type: "text/*" }));
// Rate limiting: 100 req/min for free tier
@ -28,6 +31,8 @@ app.use("/health", healthRouter);
// Authenticated
app.use("/v1/convert", authMiddleware, usageMiddleware, convertRouter);
app.use("/v1/templates", authMiddleware, usageMiddleware, templatesRouter);
// Billing (public — Stripe handles auth)
app.use("/v1/billing", billingRouter);
// Admin: usage stats (protected by auth)
app.get("/v1/usage", authMiddleware, (_req, res) => {
res.json(getUsageStats());