Merge pull request #55 from R0m1k3/antigravity

feat: Implement a new notification service using Apprise for sending …
This commit is contained in:
LogiFlow authored and GitHub committed 2025-11-23 23:42:20 +01:00
commit 18e8d21288
1 file changed
+9 -5
+9 -5
View File
@@ -38,12 +38,8 @@ class NotificationService:
@staticmethod
def _get_config_url(channel: models.NotificationChannel) -> str | None:
"""Construct Apprise URL from channel configuration."""
# Try to parse as JSON first
try:
# If configuration is already a URL (e.g. for simple webhooks), use it
if channel.configuration.startswith("http") or "://" in channel.configuration:
return channel.configuration
# If it's JSON, parse it
config = json.loads(channel.configuration)
if channel.type == "email":
@@ -87,6 +83,14 @@ class NotificationService:
return None
except json.JSONDecodeError:
# If not JSON, check if it's a raw URL
if channel.configuration.startswith("http") or "://" in channel.configuration:
return channel.configuration
logger.error(f"Invalid configuration format for channel {channel.name}")
return None
except Exception as e:
logger.error(f"Error parsing configuration for channel {channel.name}: {e}")
return None