mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-10 12:07:44 -06:00
Use datetime.utcnow instead, eliminate timezone consideration
This commit is contained in:
@@ -115,7 +115,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:
|
|||||||
class IPCounter:
|
class IPCounter:
|
||||||
# Note: This is not the true 'seen' count, but the count of how many times the IP has been seen since the last flush.
|
# Note: This is not the true 'seen' count, but the count of how many times the IP has been seen since the last flush.
|
||||||
count: int = 0
|
count: int = 0
|
||||||
last_seen: datetime = field(default_factory=datetime.now)
|
last_seen: datetime = field(default_factory=datetime.utcnow)
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI(lifespan=lifespan)
|
app = FastAPI(lifespan=lifespan)
|
||||||
@@ -166,7 +166,7 @@ async def get_ips(request: Request, response: Response):
|
|||||||
"""
|
"""
|
||||||
Returns a list of partially redacted IP addresses, as well as submitting the user's IP address to the database (buffered).
|
Returns a list of partially redacted IP addresses, as well as submitting the user's IP address to the database (buffered).
|
||||||
"""
|
"""
|
||||||
now = datetime.now()
|
now = datetime.utcnow()
|
||||||
|
|
||||||
# Get the user's IP address
|
# Get the user's IP address
|
||||||
user_ip = get_ip(request)
|
user_ip = get_ip(request)
|
||||||
|
|||||||
Reference in New Issue
Block a user