From fbed705f3538ecad16c0c8acd41b1acfcb3bc697 Mon Sep 17 00:00:00 2001 From: conlan0 Date: Thu, 7 Nov 2024 18:20:16 -0500 Subject: [PATCH 1/2] feat: add custom cert expiry notification message --- api/tacticalrmm/core/views.py | 3 ++- api/tacticalrmm/tacticalrmm/utils.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/tacticalrmm/core/views.py b/api/tacticalrmm/core/views.py index d2915fa9bd..d12a943115 100644 --- a/api/tacticalrmm/core/views.py +++ b/api/tacticalrmm/core/views.py @@ -107,7 +107,7 @@ def clear_cache(request): @api_view() def dashboard_info(request): from core.utils import token_is_expired - from tacticalrmm.utils import get_latest_trmm_ver, runcmd_placeholder_text + from tacticalrmm.utils import get_latest_trmm_ver, runcmd_placeholder_text, certexpiry_notification_text core_settings = get_core_settings() return Response( @@ -135,6 +135,7 @@ def dashboard_info(request): "dash_negative_color": request.user.dash_negative_color, "dash_warning_color": request.user.dash_warning_color, "run_cmd_placeholder_text": runcmd_placeholder_text(), + "certexpiry_notification_text": certexpiry_notification_text(), "server_scripts_enabled": core_settings.server_scripts_enabled, "web_terminal_enabled": core_settings.web_terminal_enabled, } diff --git a/api/tacticalrmm/tacticalrmm/utils.py b/api/tacticalrmm/tacticalrmm/utils.py index 6c7be4152a..91a42f5016 100644 --- a/api/tacticalrmm/tacticalrmm/utils.py +++ b/api/tacticalrmm/tacticalrmm/utils.py @@ -468,3 +468,6 @@ def runcmd_placeholder_text() -> dict[str, str]: ), } return ret + +def certexpiry_notification_text() -> str: + return getattr(settings, "CERTEXPIRY_NOTIFICATION_TEXT", "") \ No newline at end of file From 1c647e10e0124ba7e7364e8c9d9f62d2c69c39b0 Mon Sep 17 00:00:00 2001 From: conlan0 Date: Fri, 8 Nov 2024 20:22:15 -0500 Subject: [PATCH 2/2] blacked --- api/tacticalrmm/core/views.py | 6 +++++- api/tacticalrmm/tacticalrmm/utils.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/tacticalrmm/core/views.py b/api/tacticalrmm/core/views.py index d12a943115..80fbeeab6e 100644 --- a/api/tacticalrmm/core/views.py +++ b/api/tacticalrmm/core/views.py @@ -107,7 +107,11 @@ def clear_cache(request): @api_view() def dashboard_info(request): from core.utils import token_is_expired - from tacticalrmm.utils import get_latest_trmm_ver, runcmd_placeholder_text, certexpiry_notification_text + from tacticalrmm.utils import ( + get_latest_trmm_ver, + runcmd_placeholder_text, + certexpiry_notification_text, + ) core_settings = get_core_settings() return Response( diff --git a/api/tacticalrmm/tacticalrmm/utils.py b/api/tacticalrmm/tacticalrmm/utils.py index 91a42f5016..c78caef902 100644 --- a/api/tacticalrmm/tacticalrmm/utils.py +++ b/api/tacticalrmm/tacticalrmm/utils.py @@ -469,5 +469,6 @@ def runcmd_placeholder_text() -> dict[str, str]: } return ret + def certexpiry_notification_text() -> str: - return getattr(settings, "CERTEXPIRY_NOTIFICATION_TEXT", "") \ No newline at end of file + return getattr(settings, "CERTEXPIRY_NOTIFICATION_TEXT", "")