MAJOR Fix: Resolved API Request Delays;

Feat: Added a dev test account to users for expedited login;
Refactor: Improve socket connection handling and add logging for API request duration & update to ListRow key generation for improved uniqueness;
Feat: Made it so streams with no set thumbnail use their category's thumbnail;
Minor Fix: Corrections to db recommendation methods;
This commit is contained in:
Chris-1010
2025-01-30 03:42:22 +00:00
parent 6cfac0d78f
commit 6586506c97
19 changed files with 197 additions and 118 deletions

View File

@@ -1,14 +1,24 @@
from flask import redirect, url_for, request, g, session
from functools import wraps
from re import match
from time import time
def logged_in_user():
"""
Validator to make sure a user is logged in.
"""
g.start_time = time()
g.user = session.get("username", None)
g.admin = session.get("username", None)
def record_time(response):
if hasattr(g, 'start_time'):
time_taken = time() - g.start_time
print(f"Request to {request.endpoint} took {time_taken:.4f} seconds", flush=True)
else:
print("No start time found", flush=True)
return response
def login_required(view):
"""
Add at start of routes where users need to be logged in to access.