mirror of https://github.com/caronc/apprise
feat: add icon field support for bark plugin (#1393)
parent
666f50457c
commit
92d5d7cc8a
|
@ -209,6 +209,10 @@ class NotifyBark(NotifyBase):
|
||||||
"default": True,
|
"default": True,
|
||||||
"map_to": "include_image",
|
"map_to": "include_image",
|
||||||
},
|
},
|
||||||
|
"icon": {
|
||||||
|
"name": _("Icon URL"),
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -223,6 +227,7 @@ class NotifyBark(NotifyBase):
|
||||||
click=None,
|
click=None,
|
||||||
badge=None,
|
badge=None,
|
||||||
volume=None,
|
volume=None,
|
||||||
|
icon=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Initialize Notify Bark Object."""
|
"""Initialize Notify Bark Object."""
|
||||||
|
@ -301,6 +306,9 @@ class NotifyBark(NotifyBase):
|
||||||
volume,
|
volume,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Icon URL
|
||||||
|
self.icon = icon if isinstance(icon, str) else None
|
||||||
|
|
||||||
# Level
|
# Level
|
||||||
self.level = (
|
self.level = (
|
||||||
None
|
None
|
||||||
|
@ -353,7 +361,10 @@ class NotifyBark(NotifyBase):
|
||||||
None if not self.include_image else self.image_url(notify_type)
|
None if not self.include_image else self.image_url(notify_type)
|
||||||
)
|
)
|
||||||
|
|
||||||
if image_url:
|
# Use custom icon if provided, otherwise use default image
|
||||||
|
if self.icon:
|
||||||
|
payload["icon"] = self.icon
|
||||||
|
elif image_url:
|
||||||
payload["icon"] = image_url
|
payload["icon"] = image_url
|
||||||
|
|
||||||
if self.sound:
|
if self.sound:
|
||||||
|
@ -488,6 +499,9 @@ class NotifyBark(NotifyBase):
|
||||||
if self.group:
|
if self.group:
|
||||||
params["group"] = self.group
|
params["group"] = self.group
|
||||||
|
|
||||||
|
if self.icon:
|
||||||
|
params["icon"] = self.icon
|
||||||
|
|
||||||
# Extend our parameters
|
# Extend our parameters
|
||||||
params.update(self.url_parameters(privacy=privacy, *args, **kwargs))
|
params.update(self.url_parameters(privacy=privacy, *args, **kwargs))
|
||||||
|
|
||||||
|
@ -588,4 +602,10 @@ class NotifyBark(NotifyBase):
|
||||||
results["qsd"].get("image", True)
|
results["qsd"].get("image", True)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Icon URL
|
||||||
|
if "icon" in results["qsd"] and results["qsd"]["icon"]:
|
||||||
|
results["icon"] = NotifyBark.unquote(
|
||||||
|
results["qsd"]["icon"].strip()
|
||||||
|
)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
|
@ -240,6 +240,20 @@ apprise_url_tests = (
|
||||||
"test_requests_exceptions": True,
|
"test_requests_exceptions": True,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"bark://192.168.0.6:8081/device_key/?icon=https://example.com/icon.png",
|
||||||
|
{
|
||||||
|
# set custom icon
|
||||||
|
"instance": NotifyBark,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"bark://192.168.0.6:8081/device_key/?icon=https://example.com/icon.png&image=no",
|
||||||
|
{
|
||||||
|
# set custom icon and disable default image
|
||||||
|
"instance": NotifyBark,
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue