diff --git a/front/plugins/_publisher_apprise/apprise.py b/front/plugins/_publisher_apprise/apprise.py index e80a4c9a..967074ed 100755 --- a/front/plugins/_publisher_apprise/apprise.py +++ b/front/plugins/_publisher_apprise/apprise.py @@ -78,7 +78,7 @@ def main(): #------------------------------------------------------------------------------- def check_config(): - if get_setting_value('APPRISE_URL') == '' or get_setting_value('APPRISE_HOST') == '': + if get_setting_value('APPRISE_HOST') == '' or (get_setting_value('APPRISE_URL') == '' and get_setting_value('APPRISE_TAG') == ''): return False else: return True @@ -106,8 +106,11 @@ def send(html, text): # Define Apprise compatible payload (https://github.com/caronc/apprise-api#stateless-solution) + target_key = "tag" if get_setting_value('APPRISE_TARGETTYPE') == 'tag' else "urls" + target_value = get_setting_value('APPRISE_TAG') if target_key == 'tag' else get_setting_value('APPRISE_URL') + _json_payload = { - "urls": get_setting_value('APPRISE_URL'), + target_key: target_value, "title": "NetAlertX Notifications", "format": get_setting_value('APPRISE_PAYLOAD'), "body": payloadData diff --git a/front/plugins/_publisher_apprise/config.json b/front/plugins/_publisher_apprise/config.json index fb500de2..7731bfbe 100755 --- a/front/plugins/_publisher_apprise/config.json +++ b/front/plugins/_publisher_apprise/config.json @@ -422,6 +422,38 @@ } ] }, + { + "function": "TARGETTYPE", + "type": { + "dataType": "string", + "elements": [ + { "elementType": "select", "elementOptions": [], "transformers": [] } + ] + }, + "default_value": "url", + "options": ["url", "tag"], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Target type" + }, + { + "language_code": "es_es", + "string": "Tipo de alvo" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "Select the target type sent to Apprise." + }, + { + "language_code": "es_es", + "string": "Seleccione el tipo de alvo enviada a Apprise." + } + ] + }, { "function": "URL", "type": { @@ -454,6 +486,38 @@ } ] }, + { + "function": "TAG", + "type": { + "dataType": "string", + "elements": [ + { "elementType": "input", "elementOptions": [], "transformers": [] } + ] + }, + "default_value": "", + "options": [], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Apprise notification tag" + }, + { + "language_code": "es_es", + "string": "Tag de notificación de Apprise" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "Apprise notification target tag." + }, + { + "language_code": "es_es", + "string": "Informar de la tag de destino de la notificación." + } + ] + }, { "function": "PAYLOAD", "type": {