feat: Pro limit 2,500/mo, website templating, cleanup
All checks were successful
Deploy to Production / Deploy to Server (push) Successful in 2m24s
All checks were successful
Deploy to Production / Deploy to Server (push) Successful in 2m24s
- Set Pro tier limit to 2,500 PDFs/month (was unlimited/5000) - Added Pro limit enforcement in usage middleware - Updated landing page, JSON-LD, and Stripe product description - Created build-time HTML templating (partials for nav/footer/styles) - Source files in public/src/, partials in public/partials/ - Build script: node scripts/build-html.cjs - Deleted stale backup file - Fixed index.html nav logo to use <a> tag for consistency
This commit is contained in:
parent
d3015826e5
commit
aab6bf3bee
15 changed files with 556 additions and 407 deletions
12
dist/middleware/usage.js
vendored
12
dist/middleware/usage.js
vendored
|
|
@ -2,6 +2,7 @@ import { isProKey } from "../services/keys.js";
|
|||
import logger from "../services/logger.js";
|
||||
import pool from "../services/db.js";
|
||||
const FREE_TIER_LIMIT = 100;
|
||||
const PRO_TIER_LIMIT = 5000;
|
||||
// In-memory cache, periodically synced to PostgreSQL
|
||||
let usage = new Map();
|
||||
function getMonthKey() {
|
||||
|
|
@ -36,6 +37,15 @@ export function usageMiddleware(req, res, next) {
|
|||
const key = keyInfo?.key || "unknown";
|
||||
const monthKey = getMonthKey();
|
||||
if (isProKey(key)) {
|
||||
const record = usage.get(key);
|
||||
if (record && record.monthKey === monthKey && record.count >= PRO_TIER_LIMIT) {
|
||||
res.status(429).json({
|
||||
error: "Pro tier limit reached (5,000/month). Contact support for higher limits.",
|
||||
limit: PRO_TIER_LIMIT,
|
||||
used: record.count,
|
||||
});
|
||||
return;
|
||||
}
|
||||
trackUsage(key, monthKey);
|
||||
next();
|
||||
return;
|
||||
|
|
@ -46,7 +56,7 @@ export function usageMiddleware(req, res, next) {
|
|||
error: "Free tier limit reached",
|
||||
limit: FREE_TIER_LIMIT,
|
||||
used: record.count,
|
||||
upgrade: "Upgrade to Pro for unlimited conversions: https://docfast.dev/pricing",
|
||||
upgrade: "Upgrade to Pro for 5,000 PDFs/month: https://docfast.dev/pricing",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue