From 46c972571523bba697e93197276d211f2de4961e Mon Sep 17 00:00:00 2001 From: master3395 Date: Sat, 11 Apr 2026 00:21:14 +0200 Subject: [PATCH] fix(emailPremium): Rspamd admin UI Angular binding and panel proxy URL Pass rspamd_ui_url from Rspamd view; safe machineIP read; bootstrap window.app before controllers; replace invalid {$ errorMessage $} with ng-bind; fix textareas; clarify HTTPS UI via CyberPanel proxy vs SSH tunnel localhost. --- .../static/emailPremium/emailPremium.js | 20 + .../templates/emailPremium/Rspamd.html | 28 +- emailPremium/views.py | 22 +- public/static/emailPremium/emailPremium.js | 1053 ++++++++++++++++- static/emailPremium/emailPremium.js | 20 + 5 files changed, 1123 insertions(+), 20 deletions(-) diff --git a/emailPremium/static/emailPremium/emailPremium.js b/emailPremium/static/emailPremium/emailPremium.js index 1facd756c..d5f38b6ab 100644 --- a/emailPremium/static/emailPremium/emailPremium.js +++ b/emailPremium/static/emailPremium/emailPremium.js @@ -2,6 +2,26 @@ * Created by usman on 6/22/18. */ +/* Ensure CyberCP Angular module exists (system-status.js normally sets window.app in ) */ +(function () { + if (typeof window === 'undefined' || typeof angular === 'undefined') { + return; + } + if (typeof window.app !== 'undefined' && window.app) { + return; + } + try { + window.app = angular.module('CyberCP'); + } catch (e) { + try { + window.app = angular.module('CyberCP', []); + } catch (e2) { + return; + } + } +})(); +var app = window.app; + /* Java script code to list accounts */ app.controller('listDomains', function ($scope, $http) { diff --git a/emailPremium/templates/emailPremium/Rspamd.html b/emailPremium/templates/emailPremium/Rspamd.html index 1769eb3bc..f052f992e 100644 --- a/emailPremium/templates/emailPremium/Rspamd.html +++ b/emailPremium/templates/emailPremium/Rspamd.html @@ -611,7 +611,7 @@
- {% trans "Failed to start installation. Error message:" %} {$ errorMessage $} + {% trans "Failed to start installation. Error message:" %}
@@ -621,7 +621,7 @@
- {% trans "Installation failed." %} {$ errorMessage $} + {% trans "Installation failed." %}
@@ -637,7 +637,7 @@

{% trans "Installation Progress" %}

- +
{% else %} @@ -663,20 +663,20 @@

- {% trans "Opens the official Rspamd web interface in a new tab (path /emailPremium/Rspamd/ui/ — proxied through CyberPanel, admin session required)." %} + {% trans "Opens the Rspamd controller UI over HTTPS using the same hostname and port as CyberPanel (path /emailPremium/Rspamd/ui/). Rspamd itself only speaks HTTP on 127.0.0.1:11334; the panel reverse-proxies it so you do not need https://YOUR_SERVER_IP:11334 (that URL is not served by Rspamd)." %}

{% trans "Alternative: SSH tunnel" %}

- {% trans "If the proxied UI misbehaves, connect to port 11334 on the server via SSH and use your local browser." %} + {% trans "If the proxied UI misbehaves, forward port 11334 to your machine and open the link below (HTTP on localhost only — not HTTPS)." %}

ssh -N -L 11334:127.0.0.1:11334 root@{{ ipAddress }}

- {% trans "Open Rspamd UI (when tunnel is active)" %} + {% trans "Open Rspamd UI (when tunnel is active — http://127.0.0.1:11334/)" %}

@@ -772,7 +772,7 @@
- {% trans "Failed to save RSPAMD configurations. Error message:" %} {$ errorMessage $} + {% trans "Failed to save RSPAMD configurations. Error message:" %}
@@ -848,7 +848,7 @@
- {% trans "Failed to save ClamAV configurations. Error message:" %} {$ errorMessage $} + {% trans "Failed to save ClamAV configurations. Error message:" %}
@@ -906,7 +906,7 @@
- {% trans "Failed to save Postfix configurations. Error message:" %} {$ errorMessage $} + {% trans "Failed to save Postfix configurations. Error message:" %}
@@ -964,7 +964,7 @@
- {% trans "Failed to save Redis configurations. Error message:" %} {$ errorMessage $} + {% trans "Failed to save Redis configurations. Error message:" %}
@@ -989,7 +989,7 @@
- {% trans "Failed to start uninstallation. Error message:" %} {$ errorMessage $} + {% trans "Failed to start uninstallation. Error message:" %}
@@ -999,7 +999,7 @@
- {% trans "Installation failed." %} {$ errorMessage $} + {% trans "Installation failed." %}
@@ -1015,7 +1015,7 @@

{% trans "Uninstallation Progress" %}

- +
@@ -1052,7 +1052,7 @@