From ab9c940d01c2a054215cb92ba52055d140f22524 Mon Sep 17 00:00:00 2001 From: Douglas Maitelli Date: Sun, 27 Jul 2025 22:29:19 +0000 Subject: [PATCH] Add support for Apprise Tags --- front/php/templates/language/de_de.json | 8 ----- front/php/templates/language/en_us.json | 10 ++++++ front/plugins/_publisher_apprise/apprise.py | 10 +++++- front/plugins/_publisher_apprise/config.json | 32 ++++++++++++++++++++ 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index ef4a2417..d9f75dd1 100644 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -5,14 +5,6 @@ "API_TOKEN_name": "API-Schlüssel", "API_display_name": "API", "API_icon": "", - "APPRISE_HOST_description": "Apprise host URL starting with http:// or https://. (do not forget to include /notify at the end)", - "APPRISE_HOST_name": "Apprise host URL", - "APPRISE_PAYLOAD_description": "Select the payload type sent to Apprise. For example html works well with emails, text with chat apps, such as Telegram.", - "APPRISE_PAYLOAD_name": "Payload type", - "APPRISE_SIZE_description": "The maximum size of the apprise payload as number of characters in the passed string. If above limit, it will be truncated and a (text was truncated) message is appended.", - "APPRISE_SIZE_name": "Max payload size", - "APPRISE_URL_description": "Apprise notification target URL. For example for Telegram it would be tgram://{bot_token}/{chat_id}.", - "APPRISE_URL_name": "Apprise notification URL", "About_Design": "Entworfen für:", "About_Exit": "Abmelden", "About_Title": "Netzwerksicherheitsscanner und Benachrichtigungsframework", diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index 37cea711..f34113c0 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -5,6 +5,16 @@ "API_TOKEN_name": "API token", "API_display_name": "API", "API_icon": "", + "APPRISE_HOST_description": "Apprise host URL starting with http:// or https://. (do not forget to include /notify at the end)", + "APPRISE_HOST_name": "Apprise host URL", + "APPRISE_PAYLOAD_description": "Select the payload type sent to Apprise. For example html works well with emails, text with chat apps, such as Telegram.", + "APPRISE_PAYLOAD_name": "Payload type", + "APPRISE_SIZE_description": "The maximum size of the apprise payload as number of characters in the passed string. If above limit, it will be truncated and a (text was truncated) message is appended.", + "APPRISE_SIZE_name": "Max payload size", + "APPRISE_TAG_description": "Apprise notification target type.", + "APPRISE_TAG_name": "Apprise notification target type", + "APPRISE_URL_description": "Apprise notification target URL. For example for Telegram it would be tgram://{bot_token}/{chat_id}.", + "APPRISE_URL_name": "Apprise notification URL", "About_Design": "Designed for:", "About_Exit": "Sign out", "About_Title": "Network security scanner & notification framework", diff --git a/front/plugins/_publisher_apprise/apprise.py b/front/plugins/_publisher_apprise/apprise.py index e80a4c9a..8ab047c6 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') == '': return False else: return True @@ -113,6 +113,14 @@ def send(html, text): "body": payloadData } + if get_setting_value('APPRISE_TARGETTYPE') == 'tag': + _json_payload = { + "tags": get_setting_value('APPRISE_URL'), + "title": "NetAlertX Notifications", + "format": get_setting_value('APPRISE_PAYLOAD'), + "body": payloadData + } + try: # try runnning a subprocess p = subprocess.Popen(["curl","-i","-X", "POST" ,"-H", "Content-Type:application/json" ,"-d", json.dumps(_json_payload), get_setting_value('APPRISE_HOST')], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) diff --git a/front/plugins/_publisher_apprise/config.json b/front/plugins/_publisher_apprise/config.json index fb500de2..c3bc9e3d 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": {