refactor: improve code readability and structure in various components
- Refactored the `mini_app_short_name` assignment in `config.py` for better clarity. - Enhanced the `app_config_js` function in `app.py` to improve formatting of the JavaScript response body. - Added per-chat locks in `group_duty_pin.py` to prevent concurrent refreshes, improving message handling. - Updated `_schedule_next_update` to include optional jitter for scheduling, enhancing performance during high-load scenarios. - Cleaned up test files by removing unused imports and improving test descriptions for clarity.
This commit is contained in:
@@ -153,7 +153,9 @@ def app_config_js() -> Response:
|
||||
log_level = _safe_js_string(config.LOG_LEVEL_STR.lower(), _VALID_LOG_LEVELS, "info")
|
||||
tz = _safe_tz_string(config.DUTY_DISPLAY_TZ)
|
||||
tz_js = f'\nwindow.__DT_TZ = "{tz}";' if tz else "\nwindow.__DT_TZ = undefined;"
|
||||
body = f'window.__DT_LANG = "{lang}";\nwindow.__DT_LOG_LEVEL = "{log_level}";{tz_js}'
|
||||
body = (
|
||||
f'window.__DT_LANG = "{lang}";\nwindow.__DT_LOG_LEVEL = "{log_level}";{tz_js}'
|
||||
)
|
||||
return Response(
|
||||
content=body,
|
||||
media_type="application/javascript; charset=utf-8",
|
||||
@@ -281,7 +283,6 @@ def get_personal_calendar_ical(
|
||||
)
|
||||
|
||||
|
||||
|
||||
webapp_path = config.PROJECT_ROOT / "webapp-next" / "out"
|
||||
if webapp_path.is_dir():
|
||||
app.mount("/app", StaticFiles(directory=str(webapp_path), html=True), name="webapp")
|
||||
|
||||
Reference in New Issue
Block a user