feat: add Settings tab with provider management and language preferences
CI / Test (Python 3.11) (push) Has been cancelled
CI / Test (Python 3.12) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Summary (push) Has been cancelled

- Implemented AppSettings model and table using SQLModel.
- Created Settings router with endpoints for preferences and provider toggling.
- Added Settings tab to the UI with real-time health status of providers.
- Integrated language and provider filtering into anime and series search logic.
- Updated templates to respect user-defined settings.
This commit is contained in:
root
2026-03-26 16:12:29 +00:00
parent 3b405f2a42
commit 0c03f4f4a6
15 changed files with 383 additions and 25 deletions
+58
View File
@@ -0,0 +1,58 @@
"""Models for application settings with SQLModel support"""
import uuid
import json
from pydantic import BaseModel, Field as PydanticField
from typing import Optional, List, Dict
from datetime import datetime
from sqlmodel import SQLModel, Field, Column, String
class AppSettingsBase(SQLModel):
"""Base schema for application settings"""
default_lang: str = Field(default="vostfr")
theme: str = Field(default="dark")
# Store list of disabled providers as a JSON string
disabled_providers_json: str = Field(default="[]", sa_column=Column(String))
@property
def disabled_providers(self) -> List[str]:
try:
return json.loads(self.disabled_providers_json or "[]")
except:
return []
@disabled_providers.setter
def disabled_providers(self, value: List[str]):
self.disabled_providers_json = json.dumps(value or [])
class AppSettingsTable(AppSettingsBase, table=True):
"""Database table for application settings"""
__tablename__ = "app_settings"
id: str = Field(
default_factory=lambda: str(uuid.uuid4()),
primary_key=True,
index=True,
nullable=False
)
user_id: str = Field(foreign_key="users.id", index=True, unique=True)
updated_at: datetime = Field(default_factory=datetime.now)
class AppSettings(BaseModel):
"""Application settings (API Response)"""
default_lang: str = "vostfr"
theme: str = "dark"
disabled_providers: List[str] = []
class Config:
from_attributes = True
class AppSettingsUpdate(BaseModel):
"""Model for updating application settings"""
default_lang: Optional[str] = None
theme: Optional[str] = None
disabled_providers: Optional[List[str]] = None