From 60f9a1f437b18936f1e518914f21e37304caf9ef Mon Sep 17 00:00:00 2001 From: tenkus47 Date: Fri, 3 Jul 2026 19:19:23 +0530 Subject: [PATCH 1/2] Enhance platform normalization in push configuration - Introduced a new helper function, _normalize_platform, to standardize platform input for push notifications. - Updated is_push_configured to utilize the normalized platform value, improving compatibility with various input formats. --- .../notifications/services/push/config_loader.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/worker_api/notifications/services/push/config_loader.py b/worker_api/notifications/services/push/config_loader.py index d47abe8..24e9ad4 100644 --- a/worker_api/notifications/services/push/config_loader.py +++ b/worker_api/notifications/services/push/config_loader.py @@ -61,7 +61,18 @@ def is_fcm_configured() -> bool: return bool(get("GOOGLE_CLOUD_PROJECT").strip()) +def _normalize_platform(platform: str) -> str: + value = platform + if hasattr(platform, "value"): + value = platform.value + value = str(value) + if "." in value: + value = value.rsplit(".", 1)[-1] + return value.lower() + + def is_push_configured(platform: str) -> bool: - if platform in ("android", "ios"): + normalized = _normalize_platform(platform) + if normalized in ("android", "ios"): return is_fcm_configured() return False From c9aca445e6a7080829a8c06a5d4ddf13640fc208 Mon Sep 17 00:00:00 2001 From: tenkus47 Date: Sun, 5 Jul 2026 12:39:57 +0530 Subject: [PATCH 2/2] Add notification dispatch secret token to configuration - Introduced NOTIFICATION_DISPATCH_SECRET_TOKEN to the configuration defaults, enhancing security for dispatch operations. --- worker_api/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/worker_api/config.py b/worker_api/config.py index 9223a38..6968bf1 100644 --- a/worker_api/config.py +++ b/worker_api/config.py @@ -40,6 +40,7 @@ NOTIFICATION_DEFAULT_TITLE="WebBuddhist", NOTIFICATION_DEFAULT_BODY="Time for your daily practice.", +NOTIFICATION_DISPATCH_SECRET_TOKEN="Dispatch", # Optional Redis idempotency during dispatch NOTIFICATION_IDEMPOTENCY_ENABLED="false", NOTIFICATION_IDEMPOTENCY_TTL_SECONDS=3600,