mirror of https://github.com/caronc/apprise
Add supplementary url support for pushover (#468)
parent
e2ebdbdcf8
commit
e8add7b95a
|
@ -196,6 +196,14 @@ class NotifyPushover(NotifyBase):
|
||||||
'regex': (r'^[a-z]{1,12}$', 'i'),
|
'regex': (r'^[a-z]{1,12}$', 'i'),
|
||||||
'default': PushoverSound.PUSHOVER,
|
'default': PushoverSound.PUSHOVER,
|
||||||
},
|
},
|
||||||
|
'url': {
|
||||||
|
'name': _('URL'),
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
'url_title': {
|
||||||
|
'name': _('URL Title'),
|
||||||
|
'type': 'string'
|
||||||
|
},
|
||||||
'retry': {
|
'retry': {
|
||||||
'name': _('Retry'),
|
'name': _('Retry'),
|
||||||
'type': 'int',
|
'type': 'int',
|
||||||
|
@ -215,7 +223,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, **kwargs):
|
sound=None, retry=None, expire=None, url=None,
|
||||||
|
url_title=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Initialize Pushover Object
|
Initialize Pushover Object
|
||||||
"""
|
"""
|
||||||
|
@ -241,6 +250,10 @@ class NotifyPushover(NotifyBase):
|
||||||
if len(self.targets) == 0:
|
if len(self.targets) == 0:
|
||||||
self.targets = (PUSHOVER_SEND_TO_ALL, )
|
self.targets = (PUSHOVER_SEND_TO_ALL, )
|
||||||
|
|
||||||
|
# Setup supplemental url
|
||||||
|
self.supplemental_url = url
|
||||||
|
self.supplemental_url_title = url_title
|
||||||
|
|
||||||
# Setup our sound
|
# Setup our sound
|
||||||
self.sound = NotifyPushover.default_pushover_sound \
|
self.sound = NotifyPushover.default_pushover_sound \
|
||||||
if not isinstance(sound, six.string_types) else sound.lower()
|
if not isinstance(sound, six.string_types) else sound.lower()
|
||||||
|
@ -319,6 +332,8 @@ 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.notify_format == NotifyFormat.HTML:
|
if self.notify_format == NotifyFormat.HTML:
|
||||||
|
@ -569,6 +584,12 @@ class NotifyPushover(NotifyBase):
|
||||||
results['sound'] = \
|
results['sound'] = \
|
||||||
NotifyPushover.unquote(results['qsd']['sound'])
|
NotifyPushover.unquote(results['qsd']['sound'])
|
||||||
|
|
||||||
|
# Get the supplementary url
|
||||||
|
if 'url' in results['qsd'] and len(results['qsd']['url']):
|
||||||
|
results['url'] = NotifyPushover.unquote(results['qsd']['url'])
|
||||||
|
if 'url_title' in results['qsd'] and len(results['qsd']['url_title']):
|
||||||
|
results['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']):
|
||||||
results['expire'] = results['qsd']['expire']
|
results['expire'] = results['qsd']['expire']
|
||||||
|
|
|
@ -3581,6 +3581,10 @@ TEST_URLS = (
|
||||||
('pover://%s@%s?sound=spacealarm' % ('u' * 30, 'a' * 30), {
|
('pover://%s@%s?sound=spacealarm' % ('u' * 30, 'a' * 30), {
|
||||||
'instance': plugins.NotifyPushover,
|
'instance': plugins.NotifyPushover,
|
||||||
}),
|
}),
|
||||||
|
# API Key + valid url_title with url
|
||||||
|
('pover://%s@%s?url=my-url&url_title=title' % ('u' * 30, 'a' * 30), {
|
||||||
|
'instance': plugins.NotifyPushover,
|
||||||
|
}),
|
||||||
# API Key + Valid User
|
# API Key + Valid User
|
||||||
('pover://%s@%s' % ('u' * 30, 'a' * 30), {
|
('pover://%s@%s' % ('u' * 30, 'a' * 30), {
|
||||||
'instance': plugins.NotifyPushover,
|
'instance': plugins.NotifyPushover,
|
||||||
|
|
Loading…
Reference in New Issue