fix: sync SUPPORT_SYSTEM_MODE between SystemSettings and SupportSettings

When changing SUPPORT_SYSTEM_MODE via system settings admin panel, the
SupportSettingsService JSON cache was not updated, causing the old value
to take priority. Now both services stay in sync bidirectionally.
This commit is contained in:
Fringg
2026-02-16 18:22:44 +03:00
parent a93a32f3a7
commit 0807a9ff19
2 changed files with 8 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ class SupportSettingsService:
return False
cls._load()
cls._data['system_mode'] = mode_clean
settings.SUPPORT_SYSTEM_MODE = mode_clean
return cls._save()
# Main menu visibility

View File

@@ -1603,6 +1603,13 @@ class BotConfigurationService:
)
except Exception as error:
logger.error('Не удалось обновить сервис автосинхронизации RemnaWave', error=error)
elif key == 'SUPPORT_SYSTEM_MODE':
try:
from app.services.support_settings_service import SupportSettingsService
SupportSettingsService.set_system_mode(str(value))
except Exception as error:
logger.error('Не удалось синхронизировать SupportSettingsService', error=error)
elif key in {
'REMNAWAVE_API_URL',
'REMNAWAVE_API_KEY',