bugfix with pushover url parameter (#477)

This commit is contained in:
Spencer Phillip Young 2021-11-10 05:24:12 -08:00 committed by GitHub
parent d248012d8b
commit a9ce6b3556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,10 +198,12 @@ class NotifyPushover(NotifyBase):
}, },
'url': { 'url': {
'name': _('URL'), 'name': _('URL'),
'map_to': 'supplemental_url',
'type': 'string', 'type': 'string',
}, },
'url_title': { 'url_title': {
'name': _('URL Title'), 'name': _('URL Title'),
'map_to': 'supplemental_url_title',
'type': 'string' 'type': 'string'
}, },
'retry': { 'retry': {
@ -223,8 +225,8 @@ class NotifyPushover(NotifyBase):
}) })
def __init__(self, user_key, token, targets=None, priority=None, def __init__(self, user_key, token, targets=None, priority=None,
sound=None, retry=None, expire=None, url=None, sound=None, retry=None, expire=None, supplemental_url=None,
url_title=None, **kwargs): supplemental_url_title=None, **kwargs):
""" """
Initialize Pushover Object Initialize Pushover Object
""" """
@ -251,8 +253,8 @@ class NotifyPushover(NotifyBase):
self.targets = (PUSHOVER_SEND_TO_ALL, ) self.targets = (PUSHOVER_SEND_TO_ALL, )
# Setup supplemental url # Setup supplemental url
self.supplemental_url = url self.supplemental_url = supplemental_url
self.supplemental_url_title = url_title self.supplemental_url_title = supplemental_url_title
# Setup our sound # Setup our sound
self.sound = NotifyPushover.default_pushover_sound \ self.sound = NotifyPushover.default_pushover_sound \
@ -332,10 +334,13 @@ class NotifyPushover(NotifyBase):
'message': body, 'message': body,
'device': device, 'device': device,
'sound': self.sound, 'sound': self.sound,
'url': self.supplemental_url,
'url_title': self.supplemental_url_title
} }
if self.supplemental_url:
payload['url'] = self.supplemental_url
if self.supplemental_url_title:
payload['url_title'] = self.supplemental_url_title
if self.notify_format == NotifyFormat.HTML: if self.notify_format == NotifyFormat.HTML:
# https://pushover.net/api#html # https://pushover.net/api#html
payload['html'] = 1 payload['html'] = 1
@ -586,9 +591,11 @@ class NotifyPushover(NotifyBase):
# Get the supplementary url # Get the supplementary url
if 'url' in results['qsd'] and len(results['qsd']['url']): if 'url' in results['qsd'] and len(results['qsd']['url']):
results['url'] = NotifyPushover.unquote(results['qsd']['url']) results['supplemental_url'] = NotifyPushover.unquote(
results['qsd']['url']
)
if 'url_title' in results['qsd'] and len(results['qsd']['url_title']): if 'url_title' in results['qsd'] and len(results['qsd']['url_title']):
results['url_title'] = results['qsd']['url_title'] results['supplemental_url_title'] = results['qsd']['url_title']
# Get expire and retry # Get expire and retry
if 'expire' in results['qsd'] and len(results['qsd']['expire']): if 'expire' in results['qsd'] and len(results['qsd']['expire']):