From 031a8e785184bb4e4ecab49b6b72ee52f2b4cff6 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 27 Apr 2025 15:28:50 +0500 Subject: [PATCH] bug fix: to wp install, improved file manager and custom ssl implementation --- .../static/filemanager/css/fileManager.css | 206 ++-- install/install.py | 18 + manageSSL/static/manageSSL/manageSSL.js | 106 +- manageSSL/templates/manageSSL/manageSSL.html | 24 +- .../templates/manageSSL/v2ManageSSL.html | 25 +- manageSSL/urls.py | 1 + manageSSL/views.py | 70 ++ plogical/customAcme.py | 934 ++++++++++++++++++ plogical/renew.py | 209 ++-- plogical/sslUtilities.py | 424 ++++---- plogical/upgrade.py | 20 + 11 files changed, 1578 insertions(+), 459 deletions(-) create mode 100644 plogical/customAcme.py diff --git a/filemanager/static/filemanager/css/fileManager.css b/filemanager/static/filemanager/css/fileManager.css index b69fd4538..2c07d5f34 100755 --- a/filemanager/static/filemanager/css/fileManager.css +++ b/filemanager/static/filemanager/css/fileManager.css @@ -1,5 +1,6 @@ -#logo{ - width: 25%; +#logo { + width: 200px; + height: auto; } /*#navBar{ @@ -8,23 +9,24 @@ background: -o-linear-gradient(#a4dbf5, #8cc5e0); }*/ #navBar { - background: #0daeff; /* Old browsers */ - background: -moz-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* FF3.6-15 */ - background: -webkit-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* Chrome10-25,Safari5.1-6 */ - background: linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3939ad', endColorstr='#0daeff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ + background: linear-gradient(135deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%); + box-shadow: 0 2px 4px rgba(0,0,0,0.1); + padding: 0.5rem 0; } .navbar-brand { - margin: 0 1rem 0 1rem; + margin: 0 1rem; + color: #fff !important; + font-weight: 500; } -#mainRow{ - margin: 1%; +#mainRow { + margin: 2rem 1.5rem; } -#tableHead{ - background: -moz-linear-gradient(#a4dbf5, #8cc5e0); - background: -webkit-linear-gradient(#a4dbf5, #8cc5e0); - background: -o-linear-gradient(#a4dbf5, #8cc5e0); +#tableHead { + background: #f8f9fa; + color: #2c3e50; + font-weight: 500; + border-radius: 8px 8px 0 0; } #uploadBoxLabel,#htmlEditorLable{ @@ -34,12 +36,23 @@ } .my-drop-zone { - border: dotted 3px lightgray; + border: 2px dashed #cbd5e0; + border-radius: 8px; + padding: 2rem; + background: #f7fafc; + transition: all 0.3s ease; margin-bottom: 2%; } -#queueProg{ +.my-drop-zone:hover { + border-color: #4158D0; + background: #f0f5ff; +} + +#queueProg { margin-bottom: 2%; + height: 6px; + border-radius: 3px; } #htmlEditorContent{ @@ -98,10 +111,14 @@ } a.nav-link { - color: #add8e6; + color: rgba(255,255,255,0.9) !important; + font-weight: 500; + padding: 0.5rem 1rem; + transition: all 0.2s ease; } a.nav-link:hover { - color: #E4F2F7; + color: #ffffff !important; + transform: translateY(-1px); } .point-events { @@ -115,62 +132,141 @@ a.nav-link:hover { border-bottom: none; } .form-control { - padding: 0 .5rem; - border: 1px solid #eeeeee; - color: #777; - font-size: .95em; + padding: 0.5rem 1rem; + border: 1px solid #e2e8f0; + border-radius: 6px; + color: #4a5568; + font-size: 0.95rem; + transition: all 0.3s ease; } - .form-control[readonly] { - background-color: transparent; +.form-control:focus { + border-color: #4158D0; + box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15); +} +.form-control[readonly] { + background-color: #f8f9fa; } a { - color: #6C6CA4; - text-decoration: none; - background-color: transparent; - -webkit-text-decoration-skip: objects; + color: #4158D0; + transition: color 0.2s ease; } a:hover { - color: #8989B6; - text-decoration: none; - background-color: transparent; - -webkit-text-decoration-skip: objects; + color: #C850C0; } -#tableHead { - background: #8989B6; - color: #E1E1EC; +.table { + background: white; + border-radius: 8px; + box-shadow: 0 0 20px rgba(0,0,0,0.05); + margin-bottom: 2rem; } .table td, .table th { - padding: .15em; - vertical-align: top; - border-top: 1px solid #e9ecef; + padding: .75rem; + vertical-align: middle; + border-top: 1px solid #edf2f7; } .table thead th { - vertical-align: bottom; - border-bottom: 1px solid #e9ecef; - font-weight: 400; + border-bottom: 2px solid #edf2f7; + font-weight: 600; + font-size: 0.875rem; + text-transform: uppercase; + letter-spacing: 0.5px; } .table td { - font-size: 14px; - color: #666666; + font-size: 0.9rem; + color: #4a5568; } .list-group-item { - padding: .2em 1.25rem; + padding: 0.75rem 1.25rem; + border: 1px solid #edf2f7; + margin-bottom: -1px; + background-color: white; + transition: all 0.2s ease; +} +.list-group-item:hover { + background-color: #f7fafc; } -i.fa.fa-file { - color: #6C6CA4 !important; -} -i.fa.fa-minus { - color: #6C6CA4 !important; -} +i.fa.fa-file, +i.fa.fa-minus, i.fa.fa-plus { - color: #6C6CA4 !important; -} -.list-group-item { - background-color: transparent; + color: #4158D0 !important; } .bg-lightgray { - background: #F9F9FA; + background: #f8f9fa; + border-radius: 8px; +} + +.progress-bar { + background: linear-gradient(135deg, #4158D0 0%, #C850C0 100%); +} + +/* Card styles */ +.card { + border: none; + border-radius: 8px; + box-shadow: 0 0 20px rgba(0,0,0,0.05); +} + +.card-header { + background: #f8f9fa; + border-bottom: 1px solid #edf2f7; + padding: 1rem 1.25rem; + font-weight: 500; + border-radius: 8px 8px 0 0; +} + +/* Navigation link styles */ +a.nav-link { + color: rgba(255,255,255,0.9) !important; + font-weight: 500; + padding: 0.5rem 1rem; + transition: all 0.2s ease; +} + +a.nav-link:hover { + color: #ffffff !important; + transform: translateY(-1px); +} + +/* Utility classes */ +.bg-lightgray { + background: #f8f9fa; + border-radius: 8px; +} + +/* Custom scrollbar */ +::-webkit-scrollbar { + width: 8px; +} + +::-webkit-scrollbar-track { + background: #f1f1f1; +} + +::-webkit-scrollbar-thumb { + background: #c8c8c8; + border-radius: 4px; +} + +::-webkit-scrollbar-thumb:hover { + background: #a8a8a8; +} + +.btn { + padding: 0.5rem 1rem; + border-radius: 6px; + font-weight: 500; + transition: all 0.3s ease; +} + +.btn-primary { + background: linear-gradient(135deg, #4158D0 0%, #C850C0 100%); + border: none; +} + +.btn-primary:hover { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(65, 88, 208, 0.15); } diff --git a/install/install.py b/install/install.py index dec901953..42603eb43 100755 --- a/install/install.py +++ b/install/install.py @@ -2329,8 +2329,26 @@ milter_default_action = accept command = "chmod +x /usr/local/CyberCP/cli/cyberPanel.py" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + def setupPHPSymlink(self): + try: + # Remove existing PHP symlink if it exists + if os.path.exists('/usr/bin/php'): + os.remove('/usr/bin/php') + + # Create symlink to PHP 8.0 + command = 'ln -s /usr/local/lsws/lsphp80/bin/php /usr/bin/php' + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + logging.InstallLog.writeToFile("[setupPHPSymlink] PHP symlink created successfully.") + + except OSError as msg: + logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [setupPHPSymlink]") + return 0 + def setupPHPAndComposer(self): try: + # First setup the PHP symlink + self.setupPHPSymlink() if self.distro == ubuntu: if not os.access('/usr/local/lsws/lsphp70/bin/php', os.R_OK): diff --git a/manageSSL/static/manageSSL/manageSSL.js b/manageSSL/static/manageSSL/manageSSL.js index 0a4e406d2..0f3de8365 100755 --- a/manageSSL/static/manageSSL/manageSSL.js +++ b/manageSSL/static/manageSSL/manageSSL.js @@ -12,21 +12,54 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = true; + $scope.sslDetails = null; $scope.showbtn = function () { $scope.issueSSLBtn = false; + $scope.fetchSSLDetails(); + }; + + $scope.fetchSSLDetails = function() { + if (!$scope.virtualHost) return; + + var url = "/manageSSL/getSSLDetails"; + var data = { + virtualHost: $scope.virtualHost + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(function(response) { + if (response.data.status === 1) { + $scope.sslDetails = response.data; + } else { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); + } + }, function(response) { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: 'Could not fetch SSL details', + type: 'error' + }); + }); }; $scope.issueSSL = function () { $scope.manageSSLLoading = false; var url = "/manageSSL/issueSSL"; - - var data = { virtualHost: $scope.virtualHost, }; - var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -35,22 +68,16 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - - if (response.data.SSL == 1) { - $scope.sslIssueCtrl = true; $scope.manageSSLLoading = true; $scope.issueSSLBtn = false; $scope.canNotIssue = true; $scope.sslIssued = false; $scope.couldNotConnect = true; - $scope.sslDomain = $scope.virtualHost; - - + $scope.fetchSSLDetails(); // Refresh SSL details after issuing } else { $scope.sslIssueCtrl = true; $scope.manageSSLLoading = true; @@ -59,10 +86,7 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.sslIssued = true; $scope.couldNotConnect = true; $scope.errorMessage = response.data.error_message; - } - - } function cantLoadInitialDatas(response) { @@ -72,10 +96,7 @@ app.controller('sslIssueCtrl', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = false; - } - - }; }); @@ -85,21 +106,54 @@ app.controller('sslIssueCtrl', function ($scope, $http) { app.controller('sslIssueCtrlV2', function ($scope, $http) { $scope.manageSSLLoading = true; + $scope.sslDetails = null; $scope.showbtn = function () { $scope.issueSSLBtn = false; + $scope.fetchSSLDetails(); + }; + + $scope.fetchSSLDetails = function() { + if (!$scope.virtualHost) return; + + var url = "/manageSSL/getSSLDetails"; + var data = { + virtualHost: $scope.virtualHost + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(function(response) { + if (response.data.status === 1) { + $scope.sslDetails = response.data; + } else { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); + } + }, function(response) { + $scope.sslDetails = null; + new PNotify({ + title: 'Error', + text: 'Could not fetch SSL details', + type: 'error' + }); + }); }; $scope.issueSSL = function () { $scope.manageSSLLoading = false; var url = "/manageSSL/v2IssueSSL"; - - var data = { virtualHost: $scope.virtualHost, }; - var config = { headers: { 'X-CSRFToken': getCookie('csrftoken') @@ -108,24 +162,16 @@ app.controller('sslIssueCtrlV2', function ($scope, $http) { $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.manageSSLLoading = true; - - if (response.data.SSL === 1) { - $scope.sslStatus = 'Issued.'; $scope.sslLogs = response.data.sslLogs; - + $scope.fetchSSLDetails(); // Refresh SSL details after issuing } else { $scope.sslStatus = 'Failed.'; $scope.sslLogs = response.data.sslLogs; - } - - } function cantLoadInitialDatas(response) { @@ -135,12 +181,8 @@ app.controller('sslIssueCtrlV2', function ($scope, $http) { $scope.canNotIssue = true; $scope.sslIssued = true; $scope.couldNotConnect = false; - } - - }; - }); /* Java script code to issue SSL V2 ends here */ diff --git a/manageSSL/templates/manageSSL/manageSSL.html b/manageSSL/templates/manageSSL/manageSSL.html index 2b3f41e78..8efaf8311 100755 --- a/manageSSL/templates/manageSSL/manageSSL.html +++ b/manageSSL/templates/manageSSL/manageSSL.html @@ -14,7 +14,7 @@ style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title="">{% trans "SSL Docs" %} -

{% trans "This page can be used to issue Let’s Encrypt SSL for existing websites on server." %}

+

{% trans "This page can be used to issue Let's Encrypt SSL for existing websites on server." %}

@@ -39,6 +39,28 @@
+
+
+
+
+

SSL Details

+
+
+
+

Status: Active

+

Issued By: {$ sslDetails.authority $}

+

Expiry Date: {$ sslDetails.expiryDate $}

+

Days Remaining: {$ sslDetails.days $}

+
+
+

Status: No SSL Certificate

+

Error: {$ sslDetails.error_message $}

+
+
+
+
+
+
diff --git a/manageSSL/templates/manageSSL/v2ManageSSL.html b/manageSSL/templates/manageSSL/v2ManageSSL.html index 36440c3f4..182432207 100755 --- a/manageSSL/templates/manageSSL/v2ManageSSL.html +++ b/manageSSL/templates/manageSSL/v2ManageSSL.html @@ -66,7 +66,7 @@