maint: Dependency upgrades and High backlog items (v2.11.0)
- All dependencies to current releases (97 known vulnerabilities -> 0), Python 3.14, uv pinned, requirements-test.txt, lxml/dateutil pinned - CSRF tokens on admin forms, logout and IndieAuth consent - IndieAuth client and crosspost link-card fetches via safe_get - FLASK_DEBUG/FLASK_ENV default off/production; image sets them - Foreign keys enforced on pooled connections; migration 018 removes orphans - Rate limits shared across processes (rate_limits, migration 019) - datetime.utcnow() and sqlite3 default adapters replaced - compose.yaml fixed; duplicate dev_auth.py and test.ini removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f17e145ff
commit
75946be7b2
67 files changed
+885
-498
No files matched your search
+9
-9
@@ -8,7 +8,7 @@ state. All models are immutable and use dataclasses for clean structure.
|
||||
|
||||
# Standard library imports
|
||||
from dataclasses import dataclass, field, replace
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
import re
|
||||
@@ -698,7 +698,7 @@ class Session:
|
||||
>>> session.is_expired
|
||||
False
|
||||
"""
|
||||
return datetime.utcnow() >= self.expires_at
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None) >= self.expires_at
|
||||
|
||||
@property
|
||||
def is_active(self) -> bool:
|
||||
@@ -726,7 +726,7 @@ class Session:
|
||||
>>> session.age
|
||||
datetime.timedelta(days=2, seconds=3600)
|
||||
"""
|
||||
return datetime.utcnow() - self.created_at
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None) - self.created_at
|
||||
|
||||
@property
|
||||
def time_until_expiry(self) -> timedelta:
|
||||
@@ -740,7 +740,7 @@ class Session:
|
||||
>>> session.time_until_expiry
|
||||
datetime.timedelta(days=28)
|
||||
"""
|
||||
return self.expires_at - datetime.utcnow()
|
||||
return self.expires_at - datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
def is_valid(self) -> bool:
|
||||
"""
|
||||
@@ -787,7 +787,7 @@ class Session:
|
||||
>>> updated.last_used_at
|
||||
datetime.datetime(2024, 11, 18, 15, 30, 0)
|
||||
"""
|
||||
return replace(self, last_used_at=datetime.utcnow())
|
||||
return replace(self, last_used_at=datetime.now(timezone.utc).replace(tzinfo=None))
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
"""
|
||||
@@ -863,7 +863,7 @@ class Token:
|
||||
me: str
|
||||
client_id: Optional[str] = None
|
||||
scope: Optional[str] = None
|
||||
created_at: datetime = field(default_factory=lambda: datetime.utcnow())
|
||||
created_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc).replace(tzinfo=None))
|
||||
expires_at: Optional[datetime] = None
|
||||
|
||||
@classmethod
|
||||
@@ -926,7 +926,7 @@ class Token:
|
||||
# No expiry set, token never expires
|
||||
return False
|
||||
|
||||
return datetime.utcnow() >= self.expires_at
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None) >= self.expires_at
|
||||
|
||||
@property
|
||||
def is_active(self) -> bool:
|
||||
@@ -1145,7 +1145,7 @@ class AuthState:
|
||||
>>> auth_state.is_expired
|
||||
False
|
||||
"""
|
||||
return datetime.utcnow() >= self.expires_at
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None) >= self.expires_at
|
||||
|
||||
@property
|
||||
def is_active(self) -> bool:
|
||||
@@ -1169,7 +1169,7 @@ class AuthState:
|
||||
>>> auth_state.age
|
||||
datetime.timedelta(seconds=120)
|
||||
"""
|
||||
return datetime.utcnow() - self.created_at
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None) - self.created_at
|
||||
|
||||
def is_valid(self) -> bool:
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user