minor filemanager bug fix

This commit is contained in:
usmannasir
2019-02-09 14:01:43 +05:00
parent d95b847d80
commit a8c4fc8f20
8 changed files with 49 additions and 33 deletions

View File

@@ -622,8 +622,10 @@ def changeAdminPassword(request):
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
os.remove(randomFile) os.remove(randomFile)
token = hashPassword.generateToken('admin', adminPass)
admin = Administrator.objects.get(userName="admin") admin = Administrator.objects.get(userName="admin")
admin.password = hashPassword.hash_password(adminPass) admin.password = hashPassword.hash_password(adminPass)
admin.token = token
admin.save() admin.save()
data_ret = {"changed": 1, data_ret = {"changed": 1,
'error_message': "None"} 'error_message': "None"}

View File

@@ -40,6 +40,7 @@ class FileManager:
counter = 0 counter = 0
for items in output: for items in output:
try:
currentFile = items.split(' ') currentFile = items.split(' ')
currentFile = filter(lambda a: a != '', currentFile) currentFile = filter(lambda a: a != '', currentFile)
if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total': if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total':
@@ -52,6 +53,8 @@ class FileManager:
lastModified = currentFile[5] + ' ' + currentFile[6] + ' ' + currentFile[7] lastModified = currentFile[5] + ' ' + currentFile[6] + ' ' + currentFile[7]
finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0], dirCheck] finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0], dirCheck]
counter = counter + 1 counter = counter + 1
except:
continue
json_data = json.dumps(finalData) json_data = json.dumps(finalData)
return HttpResponse(json_data) return HttpResponse(json_data)
@@ -69,6 +72,7 @@ class FileManager:
counter = 0 counter = 0
for items in output: for items in output:
try:
currentFile = items.split(' ') currentFile = items.split(' ')
currentFile = filter(lambda a: a != '', currentFile) currentFile = filter(lambda a: a != '', currentFile)
@@ -81,6 +85,8 @@ class FileManager:
finalData[str(counter)] = [currentFile[-1], self.data['completeStartingPath'] + '/' + currentFile[-1], dirCheck] finalData[str(counter)] = [currentFile[-1], self.data['completeStartingPath'] + '/' + currentFile[-1], dirCheck]
counter = counter + 1 counter = counter + 1
except:
continue
json_data = json.dumps(finalData) json_data = json.dumps(finalData)
return HttpResponse(json_data) return HttpResponse(json_data)

View File

@@ -780,7 +780,7 @@ class preFlightsChecks:
os.chdir(self.path) os.chdir(self.path)
command = "wget http://cyberpanel.sh/CyberPanel.1.8.0.tar.gz" command = "wget http://cyberpanel.sh/CyberPanel.1.8.1.tar.gz"
#command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz" #command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz"
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
'CyberPanel Download', 'CyberPanel Download',
@@ -789,7 +789,7 @@ class preFlightsChecks:
## ##
count = 0 count = 0
command = "tar zxf CyberPanel.1.8.0.tar.gz" command = "tar zxf CyberPanel.1.8.1.tar.gz"
#command = "tar zxf CyberPanelTemp.tar.gz" #command = "tar zxf CyberPanelTemp.tar.gz"
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
'Extract CyberPanel',1, 1, os.EX_OSERR) 'Extract CyberPanel',1, 1, os.EX_OSERR)

View File

@@ -848,6 +848,11 @@ WantedBy=multi-user.target"""
if items.find('containerization') > -1: if items.find('containerization') > -1:
containerization = 0 containerization = 0
manageServices = 1
for items in data:
if items.find('manageServices') > -1:
manageServices = 0
Upgrade.stdOut('Restoring settings file!') Upgrade.stdOut('Restoring settings file!')
@@ -871,6 +876,9 @@ WantedBy=multi-user.target"""
if containerization == 1: if containerization == 1:
writeToFile.writelines(" 'containerization',\n") writeToFile.writelines(" 'containerization',\n")
if manageServices == 1:
writeToFile.writelines(" 'manageServices',\n")
else: else:
writeToFile.writelines(items) writeToFile.writelines(items)

View File

@@ -96,7 +96,7 @@ class S3Backups(multi.Thread):
tempPath = '/home/cyberpanel/' + str(randint(10000, 99999)) tempPath = '/home/cyberpanel/' + str(randint(10000, 99999))
writeToFile = open(tempPath, 'w') writeToFile = open(tempPath, 'w')
writeToFile.write('* * * * * /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/s3Backups/s3Backups.py > /home/cyberpanel/error-logs.txt 2>&1\n') writeToFile.write('0 0 * * * /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/s3Backups/s3Backups.py > /home/cyberpanel/error-logs.txt 2>&1\n')
writeToFile.close() writeToFile.close()
command = 'sudo crontab -u cyberpanel ' + tempPath command = 'sudo crontab -u cyberpanel ' + tempPath

View File

@@ -569,12 +569,12 @@ app.controller('viewContainer', function ($scope, $http) {
$('#actionLoading').hide(); $('#actionLoading').hide();
} }
}) })
} };
$scope.addEnvField = function () { $scope.addEnvField = function () {
var countEnv = Object.keys($scope.envList).length; var countEnv = Object.keys($scope.envList).length;
$scope.envList[countEnv + 1] = {'name': '', 'value': ''}; $scope.envList[countEnv + 1] = {'name': '', 'value': ''};
} };
$scope.showTop = function () { $scope.showTop = function () {
$scope.topHead = []; $scope.topHead = [];
@@ -615,7 +615,7 @@ app.controller('viewContainer', function ($scope, $http) {
$scope.loadingTop = false; $scope.loadingTop = false;
} }
} };
$scope.cRemove = function () { $scope.cRemove = function () {
(new PNotify({ (new PNotify({
@@ -672,7 +672,7 @@ app.controller('viewContainer', function ($scope, $http) {
$('#actionLoading').hide(); $('#actionLoading').hide();
} }
}) })
} };
$scope.refreshStatus = function () { $scope.refreshStatus = function () {
url = "/docker/getContainerStatus"; url = "/docker/getContainerStatus";
@@ -784,7 +784,7 @@ app.controller('viewContainer', function ($scope, $http) {
$scope.rPolicy = "No"; $scope.rPolicy = "No";
} }
} };
$scope.cAction = function (action) { $scope.cAction = function (action) {
$('#actionLoading').show(); $('#actionLoading').show();
@@ -831,7 +831,7 @@ app.controller('viewContainer', function ($scope, $http) {
$('#actionLoading').hide(); $('#actionLoading').hide();
} }
} };
$scope.loadLogs = function (name) { $scope.loadLogs = function (name) {
$scope.logs = "Loading..."; $scope.logs = "Loading...";
@@ -865,7 +865,7 @@ app.controller('viewContainer', function ($scope, $http) {
console.log("not good"); console.log("not good");
$scope.logs = "Error loading log"; $scope.logs = "Error loading log";
} }
} };
}); });

View File

@@ -16,7 +16,7 @@
<div ng-controller="changeUserACLCTRL" class="panel"> <div ng-controller="changeUserACLCTRL" class="panel">
<div class="panel-body"> <div class="panel-body">
<h3 class="content-box-header"> <h3 class="content-box-header">
{% trans "Delete Website" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}"> {% trans "Change User ACL" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}">
</h3> </h3>
<div class="example-box-wrapper"> <div class="example-box-wrapper">