news: clamp free + anonymous to last 6h; paid keeps 24h

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-25 22:49:21 +02:00
parent a7d657e1b4
commit 671faed707
4 changed files with 96 additions and 3 deletions

View file

@ -22,6 +22,10 @@ from fastapi import Depends, HTTPException, status
from app.auth import CurrentUser, require_auth
from app.models import User
# How many hours of news the free tier sees. Paid sees whatever the
# endpoint's `since_hours` param requests (up to its own max).
FREE_NEWS_WINDOW_HOURS = 6.0
def _utcnow() -> datetime:
return datetime.now(timezone.utc)