Refactor settings system and improve context initialization
Backend: - Add type validation and coercion for settings API - Implement SettingStorage and SettingType in registry - Improve CRUD operations for settings Frontend: - Refactor Theme, Language, Sidebar, ViewMode contexts - Simplify admin components (GeneralTab, SettingsTab, UsersTab) - Add new settings endpoints to API client - Improve App initialization flow Infrastructure: - Update Dockerfile and docker-compose.yml - Add .dockerignore - Update Makefile and README 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,12 +33,17 @@ def register(
|
||||
|
||||
# If not the first user, check if registration is enabled
|
||||
if not is_first_user:
|
||||
registration_enabled = crud.settings.get_setting_value(
|
||||
registration_enabled_raw = crud.settings.get_setting_value(
|
||||
db,
|
||||
key="registration_enabled",
|
||||
default=True # Default to enabled if setting doesn't exist
|
||||
)
|
||||
|
||||
if isinstance(registration_enabled_raw, str):
|
||||
registration_enabled = registration_enabled_raw.strip().lower() in ("true", "1")
|
||||
else:
|
||||
registration_enabled = bool(registration_enabled_raw)
|
||||
|
||||
if not registration_enabled:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
@@ -146,10 +151,15 @@ def get_registration_status(
|
||||
This is a public endpoint that doesn't require authentication.
|
||||
Returns the registration_enabled setting value.
|
||||
"""
|
||||
registration_enabled = crud.settings.get_setting_value(
|
||||
registration_enabled_raw = crud.settings.get_setting_value(
|
||||
db,
|
||||
key="registration_enabled",
|
||||
default=True
|
||||
)
|
||||
|
||||
if isinstance(registration_enabled_raw, str):
|
||||
registration_enabled = registration_enabled_raw.strip().lower() in ("true", "1")
|
||||
else:
|
||||
registration_enabled = bool(registration_enabled_raw)
|
||||
|
||||
return {"registration_enabled": registration_enabled}
|
||||
|
||||
Reference in New Issue
Block a user