Add temporary PDF preview links via public token TTL
- Schema: add publicTokenExpiresAt to invoices table
- invoices.generatePublicToken: accepts optional ttlHours param; sets
expiry timestamp when provided
- invoices.getByPublicToken: returns 403 if token is expired
- New route GET /api/i/[token]/pdf: streams the invoice PDF publicly,
returns 410 Gone if expired; excluded from auth middleware
- MCP invoices_generate_public_token: exposes ttlHours, returns both
webUrl (/i/{token}) and pdfUrl (/api/i/{token}/pdf)
https://claude.ai/code/session_014126WHVRT8mftmqkU6dajG
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ export function proxy(request: NextRequest) {
|
||||
const publicRoutes = ["/", "/auth/signin", "/auth/register"];
|
||||
|
||||
// Define API routes that should be handled separately
|
||||
const apiRoutes = ["/api/auth", "/api/trpc", "/api/mcp"];
|
||||
const apiRoutes = ["/api/auth", "/api/trpc", "/api/mcp", "/api/i"];
|
||||
|
||||
// Allow API routes to pass through
|
||||
if (apiRoutes.some((route) => pathname.startsWith(route))) {
|
||||
|
||||
Reference in New Issue
Block a user