From fb3620a378331e7d2a729b5fa3ac642299080eb5 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Tue, 11 Nov 2025 22:31:58 +1100 Subject: [PATCH 1/5] BE: Better upgrade message formating Signed-off-by: jokob-sk --- server/initialise.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/initialise.py b/server/initialise.py index 891ad452..4389ebb3 100755 --- a/server/initialise.py +++ b/server/initialise.py @@ -673,7 +673,7 @@ def importConfigs(pm, db, all_plugins): # Check if app was upgraded buildTimestamp, new_version = getBuildTimeStampAndVersion() - prev_version = conf.VERSION + prev_version = conf.VERSION if conf.VERSION != '' else "unknown" mylog('debug', [f"[Config] buildTimestamp | prev_version | .VERSION file: '{buildTimestamp}|{prev_version}|{new_version}'"]) @@ -684,7 +684,7 @@ def importConfigs(pm, db, all_plugins): # ccd(key, default, config_dir, name, inputtype, options, group, events=None, desc="", setJsonMetadata=None, overrideTemplate=None, forceDefault=False) ccd('VERSION', new_version , c_d, '_KEEP_', '_KEEP_', '_KEEP_', '_KEEP_', None, "_KEEP_", None, None, True) - write_notification(f'[Upgrade] : App upgraded from {prev_version} to {new_version} 🚀 Please clear the cache:
  1. Click OK below
  2. Clear the browser cache (shift + browser refresh button)
  3. Clear app cache with the (reload) button in the header
  4. Go to Settings and click Save
Check out new features and what has changed in the 📓 release notes.', 'interrupt', timeNowDB()) + write_notification(f'[Upgrade] : App upgraded from {prev_version} to {new_version} 🚀 Please clear the cache:
  1. Click OK below
  2. Clear the browser cache (shift + browser refresh button)
  3. Clear app cache with the (reload) button in the header
  4. Go to Settings and click Save
Check out new features and what has changed in the 📓 release notes.', 'interrupt', timeNowDB()) # ----------------- From b659a0f06dcbfdea7676daf6b523a122b69328e9 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Tue, 11 Nov 2025 23:09:28 +1100 Subject: [PATCH 2/5] BE: link to server in reports #1267 Signed-off-by: jokob-sk --- front/report_templates/report_template.html | 20 +++---- front/report_templates/report_template.txt | 17 +++--- server/models/notification_instance.py | 62 +++++++++------------ 3 files changed, 45 insertions(+), 54 deletions(-) diff --git a/front/report_templates/report_template.html b/front/report_templates/report_template.html index 7be350b5..2ee21506 100755 --- a/front/report_templates/report_template.html +++ b/front/report_templates/report_template.html @@ -20,11 +20,11 @@ - - - - - + NEW_DEVICES_TABLE + DOWN_DEVICES_TABLE + DOWN_RECONNECTED_TABLE + EVENTS_TABLE + PLUGINS_TABLE @@ -34,11 +34,11 @@
- - | Sent: - | Server: - | Built: - | Version: + NEW_VERSION + | Sent: REPORT_DATE + | Server: SERVER_NAME + | Built: BUILD_DATE + | Version: BUILD_VERSION
diff --git a/front/report_templates/report_template.txt b/front/report_templates/report_template.txt index 8be4447b..c0fabe6f 100755 --- a/front/report_templates/report_template.txt +++ b/front/report_templates/report_template.txt @@ -1,9 +1,10 @@ - - - - - +NEW_DEVICES_TABLE +DOWN_DEVICES_TABLE +DOWN_RECONNECTED_TABLE +EVENTS_TABLE +PLUGINS_TABLE -Report Date: -Server: - \ No newline at end of file +Report Date: REPORT_DATE +Server: SERVER_NAME +Link: REPORT_DASHBOARD_URL +NEW_VERSION \ No newline at end of file diff --git a/server/models/notification_instance.py b/server/models/notification_instance.py index 09c78efd..c4367c67 100755 --- a/server/models/notification_instance.py +++ b/server/models/notification_instance.py @@ -14,6 +14,7 @@ from helper import ( removeDuplicateNewLines, write_file, get_setting_value, + getBuildTimeStampAndVersion, ) from messaging.in_app import write_notification from utils.datetime_utils import timeNowDB, get_timezone_offset @@ -25,6 +26,7 @@ from utils.datetime_utils import timeNowDB, get_timezone_offset class NotificationInstance: def __init__(self, db): self.db = db + self.serverUrl = get_setting_value("REPORT_DASHBOARD_URL") # Create Notifications table if missing self.db.sql.execute("""CREATE TABLE IF NOT EXISTS "Notifications" ( @@ -108,83 +110,71 @@ class NotificationInstance: if conf.newVersionAvailable: newVersionText = "🚀A new version is available." - mail_text = mail_text.replace("", newVersionText) - mail_html = mail_html.replace("", newVersionText) + mail_text = mail_text.replace("NEW_VERSION", newVersionText) + mail_html = mail_html.replace("NEW_VERSION", newVersionText) # Report "REPORT_DATE" in Header & footer timeFormated = timeNowDB() - mail_text = mail_text.replace('', timeFormated) - mail_html = mail_html.replace('', timeFormated) + mail_text = mail_text.replace("REPORT_DATE", timeFormated) + mail_html = mail_html.replace("REPORT_DATE", timeFormated) # Report "SERVER_NAME" in Header & footer - mail_text = mail_text.replace("", socket.gethostname()) - mail_html = mail_html.replace("", socket.gethostname()) + mail_text = mail_text.replace("SERVER_NAME", socket.gethostname()) + mail_html = mail_html.replace("SERVER_NAME", socket.gethostname()) # Report "VERSION" in Header & footer - try: - VERSIONFILE = subprocess.check_output( - ["php", applicationPath + "/front/php/templates/version.php"], - timeout=5, - ).decode("utf-8") - except Exception as e: - mylog("debug", [f"[Notification] Unable to read version.php: {e}"]) - VERSIONFILE = "unknown" + buildTimestamp, newBuildVersion = getBuildTimeStampAndVersion() - mail_text = mail_text.replace("", VERSIONFILE) - mail_html = mail_html.replace("", VERSIONFILE) + mail_text = mail_text.replace("BUILD_VERSION", newBuildVersion) + mail_html = mail_html.replace("BUILD_VERSION", newBuildVersion) # Report "BUILD" in Header & footer - try: - BUILDFILE = subprocess.check_output( - ["php", applicationPath + "/front/php/templates/build.php"], - timeout=5, - ).decode("utf-8") - except Exception as e: - mylog("debug", [f"[Notification] Unable to read build.php: {e}"]) - BUILDFILE = "unknown" + mail_text = mail_text.replace("BUILD_DATE", str(buildTimestamp)) + mail_html = mail_html.replace("BUILD_DATE", str(buildTimestamp)) - mail_text = mail_text.replace("", BUILDFILE) - mail_html = mail_html.replace("", BUILDFILE) + # Report "REPORT_DASHBOARD_URL" in footer + mail_text = mail_text.replace("REPORT_DASHBOARD_URL", self.serverUrl) + mail_html = mail_html.replace("REPORT_DASHBOARD_URL", self.serverUrl) # Start generating the TEXT & HTML notification messages # new_devices # --- html, text = construct_notifications(self.JSON, "new_devices") - mail_text = mail_text.replace("", text + "\n") - mail_html = mail_html.replace("", html) + mail_text = mail_text.replace("NEW_DEVICES_TABLE", text + "\n") + mail_html = mail_html.replace("NEW_DEVICES_TABLE", html) mylog("verbose", ["[Notification] New Devices sections done."]) # down_devices # --- html, text = construct_notifications(self.JSON, "down_devices") - mail_text = mail_text.replace("", text + "\n") - mail_html = mail_html.replace("", html) + mail_text = mail_text.replace("DOWN_DEVICES_TABLE", text + "\n") + mail_html = mail_html.replace("DOWN_DEVICES_TABLE", html) mylog("verbose", ["[Notification] Down Devices sections done."]) # down_reconnected # --- html, text = construct_notifications(self.JSON, "down_reconnected") - mail_text = mail_text.replace("", text + "\n") - mail_html = mail_html.replace("", html) + mail_text = mail_text.replace("DOWN_RECONNECTED_TABLE", text + "\n") + mail_html = mail_html.replace("DOWN_RECONNECTED_TABLE", html) mylog("verbose", ["[Notification] Reconnected Down Devices sections done."]) # events # --- html, text = construct_notifications(self.JSON, "events") - mail_text = mail_text.replace("", text + "\n") - mail_html = mail_html.replace("", html) + mail_text = mail_text.replace("EVENTS_TABLE", text + "\n") + mail_html = mail_html.replace("EVENTS_TABLE", html) mylog("verbose", ["[Notification] Events sections done."]) # plugins # --- html, text = construct_notifications(self.JSON, "plugins") - mail_text = mail_text.replace("", text + "\n") - mail_html = mail_html.replace("", html) + mail_text = mail_text.replace("PLUGINS_TABLE", text + "\n") + mail_html = mail_html.replace("PLUGINS_TABLE", html) mylog("verbose", ["[Notification] Plugins sections done."]) From 62852f1b2f8f3eb84a0c1973f98e55786403938d Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Tue, 11 Nov 2025 23:18:20 +1100 Subject: [PATCH 3/5] BE: link to server in reports #1267 Signed-off-by: jokob-sk --- front/report_templates/report_sample.txt | 1 + front/report_templates/report_template.html | 9 --------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/front/report_templates/report_sample.txt b/front/report_templates/report_sample.txt index e476e5da..4c8526ce 100755 --- a/front/report_templates/report_sample.txt +++ b/front/report_templates/report_sample.txt @@ -44,3 +44,4 @@ More Info: Report Date: 2021-12-08 12:30 Server: Synology-NAS +Link: netalertx.com diff --git a/front/report_templates/report_template.html b/front/report_templates/report_template.html index 2ee21506..920d9156 100755 --- a/front/report_templates/report_template.html +++ b/front/report_templates/report_template.html @@ -1,12 +1,3 @@ - - From ac7b912b45421f040046b33c6fdb83d36548a318 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Tue, 11 Nov 2025 23:33:57 +1100 Subject: [PATCH 4/5] BE: link to server in reports #1267, new /tmp/api path for SYNC plugin Signed-off-by: jokob-sk --- front/report_templates/report_template.html | 4 ++-- server/api_server/sync_endpoint.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/front/report_templates/report_template.html b/front/report_templates/report_template.html index 920d9156..58c600bd 100755 --- a/front/report_templates/report_template.html +++ b/front/report_templates/report_template.html @@ -26,8 +26,8 @@ NEW_VERSION - | Sent: REPORT_DATE - | Server: SERVER_NAME + | Sent: REPORT_DATE + | Server: SERVER_NAME | Built: BUILD_DATE | Version: BUILD_VERSION diff --git a/server/api_server/sync_endpoint.py b/server/api_server/sync_endpoint.py index 883a8645..d756d286 100755 --- a/server/api_server/sync_endpoint.py +++ b/server/api_server/sync_endpoint.py @@ -11,7 +11,11 @@ INSTALL_PATH = os.getenv("NETALERTX_APP", "/app") def handle_sync_get(): """Handle GET requests for SYNC (NODE → HUB).""" - file_path = INSTALL_PATH + "/api/table_devices.json" + + # get all dwevices from the api endpoint + api_path = os.environ.get('NETALERTX_API', '/tmp/api') + + file_path = f"/{api_path}/table_devices.json" try: with open(file_path, "rb") as f: From 84cc01566d6be60022f61a68a0f883fc03e6cf76 Mon Sep 17 00:00:00 2001 From: HAMAD ABDULLA Date: Mon, 10 Nov 2025 21:43:39 +0100 Subject: [PATCH 5/5] Translated using Weblate (Arabic) Currently translated at 88.0% (671 of 762 strings) Translation: NetAlertX/core Translate-URL: https://hosted.weblate.org/projects/pialert/core/ar/ --- front/php/templates/language/ar_ar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 front/php/templates/language/ar_ar.json diff --git a/front/php/templates/language/ar_ar.json b/front/php/templates/language/ar_ar.json old mode 100755 new mode 100644 index e0b87213..b4d6caef --- a/front/php/templates/language/ar_ar.json +++ b/front/php/templates/language/ar_ar.json @@ -761,4 +761,4 @@ "settings_system_label": "تسمية النظام", "settings_update_item_warning": "تحذير تحديث العنصر", "test_event_tooltip": "تلميح اختبار الحدث" -} \ No newline at end of file +}