From 308a73a04f2d6d7b7af9a164852b89fc6f9d7d75 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 8 Mar 2022 20:04:44 +0500 Subject: [PATCH 1/7] bug fix: issues --- .../baseTemplate/custom-js/system-status.js | 65 ++++++++++++++++--- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index b24357fb4..affffe87d 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -98,21 +98,21 @@ app.filter('getwebsitename', function () { }; }); -function getWebsiteName(domain){ +function getWebsiteName(domain) { if (domain !== undefined) { - domain = domain.replace(/-/g, ''); + domain = domain.replace(/-/g, ''); - var domainName = domain.split("."); + var domainName = domain.split("."); - var finalDomainName = domainName[0]; + var finalDomainName = domainName[0]; - if (finalDomainName.length > 5) { - finalDomainName = finalDomainName.substring(0, 4); - } - - return finalDomainName; + if (finalDomainName.length > 5) { + finalDomainName = finalDomainName.substring(0, 4); } + + return finalDomainName; + } } app.controller('systemStatusInfo', function ($scope, $http, $timeout) { @@ -655,3 +655,50 @@ app.controller('versionManagment', function ($scope, $http, $timeout) { }); + +app.controller('designtheme', function ($scope, $http, $timeout) { + + $scope.themeloading = true; + + + $scope.getthemedata = function () { + $scope.themeloading = false; + + url = "/base/getthemedata"; + + var data = { + package: "helo world", + Themename: $('#stheme').val(), + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(Listgetthemedata, cantgetthemedata); + + + function Listgetthemedata(response) { + $scope.themeloading = true; + + if (response.data.status === 1) { + document.getElementById('appendthemedata').innerHTML = ""; + $("#appendthemedata").val(response.data.csscontent) + } else { + alert(response.data.error_message) + } + } + + function cantgetthemedata(response) { + $scope.themeloading = true; + console.log(response); + } + + //$timeout(getStuff, 2000); + + }; +}); + + From f35e6e4aa8d2bcba75fcb6686e38f0bff7799645 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 8 Mar 2022 20:10:53 +0500 Subject: [PATCH 2/7] bug fix: issues --- baseTemplate/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/baseTemplate/views.py b/baseTemplate/views.py index 04cd9ca5a..ebca03522 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -262,6 +262,11 @@ def getthemedata(request): currentACL = ACLManager.loadedACL(val) data = json.loads(request.body) + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('reboot', 0) + #logging.CyberCPLogFileWriter.writeToFile(str(data) + " [themedata]") url = "https://raw.githubusercontent.com/usmannasir/CyberPanel-Themes/main/%s/design.css" % data['Themename'] From a1d6b53c88439df2edc8a17158c52b7b5342572a Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 16 Mar 2022 14:56:06 +0500 Subject: [PATCH 3/7] bug fix: cPanel importer --- plogical/cPanelImporter.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index 3283ff268..d9344419d 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -279,7 +279,19 @@ class cPanelImporter: message = 'Restoring document root files for %s.' % (DomainName) logging.statusWriter(self.logFile, message, 1) - self.homeDir = self.MainSite[4].replace('/home/%s/' % (self.MainSite[0]), '') + message = 'self.MainSite[4] %s.' % (self.MainSite[4]) + logging.statusWriter(self.logFile, message, 1) + + message = 'self.MainSite[0] %s.' % (self.MainSite[0]) + logging.statusWriter(self.logFile, message, 1) + + if self.MainSite[4].find('home/') > -1: + self.homeDir = self.MainSite[4].replace('/home/%s/' % (self.MainSite[0]), '') + else: + self.homeDir = self.MainSite[4].replace('/home2/%s/' % (self.MainSite[0]), '') + + message = 'self.homeDir %s.' % (self.homeDir) + logging.statusWriter(self.logFile, message, 1) nowPath = '/home/%s/public_html' % (DomainName) if os.path.exists(nowPath): From 141c0bab8e03c226cda0e650a76cc76be6a3c887 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 16 Mar 2022 16:19:06 +0500 Subject: [PATCH 4/7] bug fix: cpanel importer --- plogical/cPanelImporter.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index d9344419d..d88cc7477 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -399,7 +399,23 @@ class cPanelImporter: message = 'Restoring document root files for %s.' % (items) logging.statusWriter(self.logFile, message, 1) - ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + + message = 'self.OtherDomains[counter][4] %s.' % (self.OtherDomains[counter][4]) + logging.statusWriter(self.logFile, message, 1) + + message = 'self.MainSite[0] %s.' % (self.MainSite[0]) + logging.statusWriter(self.logFile, message, 1) + + if self.OtherDomains[counter][4].find('home/') > -1: + ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + else: + ChildDocRoot = self.OtherDomains[counter][4].replace('/home2/%s/' % (self.MainSite[0]), '') + + + #ChildDocRoot = self.OtherDomains[counter][4].replace('/home/%s/' % (self.MainSite[0]), '') + + message = 'ChildDocRoot %s.' % (ChildDocRoot) + logging.statusWriter(self.logFile, message, 1) if os.path.exists(path): shutil.rmtree(path) @@ -875,7 +891,7 @@ class cPanelImporter: if self.createCronJobs(): pass else: - return 0 + pass self.RestoreEmails() self.FixPermissions() From e6ed5094489aef122f29fbee8d1c1dd7a51a3786 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 18 Mar 2022 14:04:15 +0500 Subject: [PATCH 5/7] bug fix: https://community.cyberpanel.net/t/cyberpanel-delete-all-files-and-directors-public-html/31577/91 --- plogical/backupUtilities.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 287657797..80128b3b1 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -368,11 +368,14 @@ class backupUtilities: ## Stop making archive of document_root and copy instead - # copy_tree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) - command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html' + from shutil import copytree - if ProcessUtilities.normalExecutioner(command) == 0: - raise BaseException(f'Failed to run {command}.') + + copytree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) + #command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html' + + # if ProcessUtilities.normalExecutioner(command) == 0: + # raise BaseException(f'Failed to run {command}.') # make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) From 6e40f53f1e3b4ea2991da3f603617b3479059cad Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sun, 20 Mar 2022 12:00:29 +0500 Subject: [PATCH 6/7] bug fix: https://community.cyberpanel.net/t/cyberpanel-delete-all-files-and-directors-public-html/31577/91 --- plogical/backupUtilities.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 80128b3b1..23127abcf 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -371,11 +371,11 @@ class backupUtilities: from shutil import copytree - copytree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) - #command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html' + #copytree('/home/%s/public_html' % domainName, '%s/%s' % (tempStoragePath, 'public_html')) + command = f'cp -R /home/{domainName}/public_html {tempStoragePath}/public_html' - # if ProcessUtilities.normalExecutioner(command) == 0: - # raise BaseException(f'Failed to run {command}.') + if ProcessUtilities.normalExecutioner(command) == 0: + raise BaseException(f'Failed to run cp command during backup generation.') # make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) From 3dcc57e82ed78dd13a7d47f50d5c13c92602df45 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sun, 20 Mar 2022 20:04:55 +0500 Subject: [PATCH 7/7] bug fix: https://community.cyberpanel.net/t/making-sub-domain-gives-wrong-permission/33235/3 --- plogical/vhost.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plogical/vhost.py b/plogical/vhost.py index 24127a088..8bfa8bd9a 100755 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -910,9 +910,10 @@ class vhost: else: groupName = 'nogroup' - command = 'sudo -u %s chown %s:%s %s' % (virtualHostUser, virtualHostUser, groupName, path) + command = 'sudo -g %s -u %s chown %s:%s %s' % (groupName, virtualHostUser, virtualHostUser, groupName, path) ProcessUtilities.normalExecutioner(command) + command = "sudo -u %s chmod 750 %s" % (virtualHostUser, path) cmd = shlex.split(command) subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)