Fix review findings and remove Uncategorized from sidebar

Backend: cache Google access tokens (drop dead access_token_expires_at,
migration 0007), handle MeTube cleared/canceled events by URL, return
email from /auth/status only when authenticated, move Google base URLs
into settings, run container as non-root.

Frontend: include local feed filters in the query key, remove dead
Saved page and unused assets, drop stale CategoryNav props and classes,
send Content-Type only with a body, remove Uncategorized from sidebar.
This commit is contained in:
vrubelroman 2026-09-17 17:22:22 +00:00
parent 6c704cac97
commit fde9a439df
25 changed files with 420 additions and 174 deletions

View file

@ -7,7 +7,6 @@ from app.config import settings
logger = logging.getLogger(__name__)
API_BASE = "https://www.googleapis.com/youtube/v3"
BATCH_SIZE = 50
@ -68,7 +67,7 @@ def fetch_subscriptions(credentials: Credentials) -> list[dict]:
if page_token:
params["pageToken"] = page_token
response = client.get(f"{API_BASE}/subscriptions", params=params, headers=_headers(credentials))
response = client.get(f"{settings.youtube_api_base_url}/subscriptions", params=params, headers=_headers(credentials))
_raise_for_status(response)
data = response.json()
@ -109,7 +108,7 @@ def fetch_playlist_video_ids(credentials: Credentials, playlist_id: str, max_res
"playlistId": playlist_id,
"maxResults": min(max_results, 50),
}
response = client.get(f"{API_BASE}/playlistItems", params=params, headers=_headers(credentials))
response = client.get(f"{settings.youtube_api_base_url}/playlistItems", params=params, headers=_headers(credentials))
if response.status_code == 404:
return []
_raise_for_status(response)
@ -134,7 +133,7 @@ def fetch_videos_details(credentials: Credentials, video_ids: list[str]) -> list
"id": ",".join(batch),
"maxResults": BATCH_SIZE,
}
response = client.get(f"{API_BASE}/videos", params=params, headers=_headers(credentials))
response = client.get(f"{settings.youtube_api_base_url}/videos", params=params, headers=_headers(credentials))
_raise_for_status(response)
data = response.json()
@ -162,7 +161,7 @@ def fetch_videos_details(credentials: Credentials, video_ids: list[str]) -> list
def unsubscribe(credentials: Credentials, youtube_subscription_id: str) -> None:
with httpx.Client(timeout=settings.metube_request_timeout_seconds) as client:
response = client.delete(
f"{API_BASE}/subscriptions",
f"{settings.youtube_api_base_url}/subscriptions",
params={"id": youtube_subscription_id},
headers=_headers(credentials),
)
@ -183,7 +182,7 @@ def fetch_uploads_playlists(credentials: Credentials, channel_ids: list[str]) ->
"id": ",".join(batch),
"maxResults": BATCH_SIZE,
}
response = client.get(f"{API_BASE}/channels", params=params, headers=_headers(credentials))
response = client.get(f"{settings.youtube_api_base_url}/channels", params=params, headers=_headers(credentials))
_raise_for_status(response)
data = response.json()