Реализована проверка версионности и требование soft\force обновлений приложения
This commit is contained in:
@@ -38,6 +38,12 @@ from app.integrations import (
|
||||
SafetyClient,
|
||||
fresh_openlines_payload,
|
||||
)
|
||||
from app.mobile_update_settings import (
|
||||
MOBILE_UPDATE_BOOLEAN_KEYS,
|
||||
MOBILE_UPDATE_INTEGER_KEYS,
|
||||
MOBILE_UPDATE_SETTING_KEYS,
|
||||
validate_mobile_update_settings,
|
||||
)
|
||||
from app.otp_settings import OTP_SETTING_KEYS, validate_otp_settings
|
||||
from app.realtime import RealtimeFanout
|
||||
from app.schemas import (
|
||||
@@ -226,7 +232,7 @@ REQUIRED_SETTINGS = {
|
||||
"rate_limit.notification_upload.per_user",
|
||||
"rate_limit.notifications_public.per_ip",
|
||||
CHAT_MESSAGE_MAX_LENGTH_KEY,
|
||||
} | OTP_SETTING_KEYS
|
||||
} | OTP_SETTING_KEYS | MOBILE_UPDATE_SETTING_KEYS
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -286,15 +292,33 @@ async def load_settings(session: AsyncSession) -> SettingsSnapshot:
|
||||
invalid_metadata = sorted(
|
||||
row.setting_key
|
||||
for row in rows
|
||||
if row.setting_key in OTP_SETTING_KEYS
|
||||
and (row.value_type != "integer" or row.is_public)
|
||||
if (
|
||||
row.setting_key in OTP_SETTING_KEYS
|
||||
and (row.value_type != "integer" or row.is_public)
|
||||
)
|
||||
or (
|
||||
row.setting_key in MOBILE_UPDATE_BOOLEAN_KEYS
|
||||
and (row.value_type != "boolean" or not row.is_public)
|
||||
)
|
||||
or (
|
||||
row.setting_key in MOBILE_UPDATE_INTEGER_KEYS
|
||||
and (row.value_type != "integer" or not row.is_public)
|
||||
)
|
||||
or (
|
||||
row.setting_key
|
||||
in MOBILE_UPDATE_SETTING_KEYS
|
||||
- MOBILE_UPDATE_BOOLEAN_KEYS
|
||||
- MOBILE_UPDATE_INTEGER_KEYS
|
||||
and (row.value_type != "string" or not row.is_public)
|
||||
)
|
||||
)
|
||||
if invalid_metadata:
|
||||
raise ValueError(
|
||||
f"OTP settings must have integer type and be private: {invalid_metadata}"
|
||||
f"Settings metadata is invalid: {invalid_metadata}"
|
||||
)
|
||||
validate_otp_settings(values)
|
||||
validate_chat_settings(values)
|
||||
validate_mobile_update_settings(values)
|
||||
except ValueError as error:
|
||||
raise DomainError(
|
||||
"dependency_unavailable",
|
||||
|
||||
Reference in New Issue
Block a user