Enhanced setup and settings pages with full configuration
- Extended SetupRequest model to include all configuration fields - Updated setup API endpoint to handle comprehensive configuration - Created new setup.html with organized configuration sections - Enhanced config modal in index.html with all settings - Updated JavaScript modules to use unified config API - Added backup configuration section - Documented new features in features.md and instructions.md
This commit is contained in:
@@ -36,14 +36,106 @@ class LoginResponse(BaseModel):
|
||||
|
||||
|
||||
class SetupRequest(BaseModel):
|
||||
"""Request to initialize the master password during first-time setup."""
|
||||
"""Request to initialize the master password during first-time setup.
|
||||
|
||||
This request includes all configuration fields needed to set up the application.
|
||||
"""
|
||||
|
||||
# Required fields
|
||||
master_password: str = Field(
|
||||
..., min_length=8, description="New master password"
|
||||
)
|
||||
anime_directory: Optional[str] = Field(
|
||||
None, description="Optional anime directory path"
|
||||
)
|
||||
|
||||
# Application settings
|
||||
name: Optional[str] = Field(
|
||||
default="Aniworld", description="Application name"
|
||||
)
|
||||
data_dir: Optional[str] = Field(
|
||||
default="data", description="Data directory path"
|
||||
)
|
||||
|
||||
# Scheduler configuration
|
||||
scheduler_enabled: Optional[bool] = Field(
|
||||
default=True, description="Enable/disable scheduler"
|
||||
)
|
||||
scheduler_interval_minutes: Optional[int] = Field(
|
||||
default=60, ge=1, description="Scheduler interval in minutes"
|
||||
)
|
||||
|
||||
# Logging configuration
|
||||
logging_level: Optional[str] = Field(
|
||||
default="INFO", description="Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)"
|
||||
)
|
||||
logging_file: Optional[str] = Field(
|
||||
default=None, description="Log file path"
|
||||
)
|
||||
logging_max_bytes: Optional[int] = Field(
|
||||
default=None, ge=0, description="Max log file size in bytes"
|
||||
)
|
||||
logging_backup_count: Optional[int] = Field(
|
||||
default=3, ge=0, description="Number of backup log files"
|
||||
)
|
||||
|
||||
# Backup configuration
|
||||
backup_enabled: Optional[bool] = Field(
|
||||
default=False, description="Enable/disable backups"
|
||||
)
|
||||
backup_path: Optional[str] = Field(
|
||||
default="data/backups", description="Backup directory path"
|
||||
)
|
||||
backup_keep_days: Optional[int] = Field(
|
||||
default=30, ge=0, description="Days to keep backups"
|
||||
)
|
||||
|
||||
# NFO configuration
|
||||
nfo_tmdb_api_key: Optional[str] = Field(
|
||||
default=None, description="TMDB API key"
|
||||
)
|
||||
nfo_auto_create: Optional[bool] = Field(
|
||||
default=True, description="Auto-create NFO files"
|
||||
)
|
||||
nfo_update_on_scan: Optional[bool] = Field(
|
||||
default=True, description="Update NFO on scan"
|
||||
)
|
||||
nfo_download_poster: Optional[bool] = Field(
|
||||
default=True, description="Download poster images"
|
||||
)
|
||||
nfo_download_logo: Optional[bool] = Field(
|
||||
default=True, description="Download logo images"
|
||||
)
|
||||
nfo_download_fanart: Optional[bool] = Field(
|
||||
default=True, description="Download fanart images"
|
||||
)
|
||||
nfo_image_size: Optional[str] = Field(
|
||||
default="original", description="Image size preference (original or w500)"
|
||||
)
|
||||
|
||||
@field_validator("logging_level")
|
||||
@classmethod
|
||||
def validate_logging_level(cls, v: Optional[str]) -> Optional[str]:
|
||||
"""Validate logging level."""
|
||||
if v is None:
|
||||
return v
|
||||
allowed = {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
|
||||
lvl = v.upper()
|
||||
if lvl not in allowed:
|
||||
raise ValueError(f"Invalid logging level: {v}. Must be one of {allowed}")
|
||||
return lvl
|
||||
|
||||
@field_validator("nfo_image_size")
|
||||
@classmethod
|
||||
def validate_image_size(cls, v: Optional[str]) -> Optional[str]:
|
||||
"""Validate image size."""
|
||||
if v is None:
|
||||
return v
|
||||
allowed = {"original", "w500"}
|
||||
size = v.lower()
|
||||
if size not in allowed:
|
||||
raise ValueError(f"Invalid image size: {v}. Must be 'original' or 'w500'")
|
||||
return size
|
||||
|
||||
|
||||
class AuthStatus(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user