Redesign responsive MyTube interface
This commit is contained in:
parent
90eb012e0d
commit
c4a772b1e3
23 changed files with 787 additions and 1119 deletions
|
|
@ -2,7 +2,7 @@ import base64
|
|||
from datetime import datetime, timezone
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy import func, or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.auth_dependency import require_session
|
||||
|
|
@ -79,6 +79,7 @@ def get_feed(
|
|||
uncategorized: bool = False,
|
||||
channel_id: int | None = None,
|
||||
downloaded: bool = False,
|
||||
search: str | None = Query(None, max_length=200),
|
||||
limit: int = Query(DEFAULT_LIMIT, ge=1, le=MAX_LIMIT),
|
||||
cursor: str | None = None,
|
||||
db: Session = Depends(get_db),
|
||||
|
|
@ -99,6 +100,13 @@ def get_feed(
|
|||
if downloaded:
|
||||
query = query.filter(Video.id.in_(_completed_video_ids()))
|
||||
|
||||
if search and search.strip():
|
||||
escaped = search.strip().replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
|
||||
needle = f"%{escaped}%"
|
||||
query = query.join(Channel, Channel.id == Video.channel_id).filter(
|
||||
or_(Video.title.ilike(needle, escape="\\"), Channel.title.ilike(needle, escape="\\"))
|
||||
)
|
||||
|
||||
if cursor:
|
||||
cursor_published_at, cursor_id = _decode_cursor(cursor)
|
||||
query = query.filter(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue