mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
Fixed download via File manager
This commit is contained in:
@@ -5,7 +5,7 @@ fileManager.config(['$interpolateProvider', function($interpolateProvider) {
|
|||||||
$interpolateProvider.endSymbol('$}');
|
$interpolateProvider.endSymbol('$}');
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader) {
|
fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $window) {
|
||||||
|
|
||||||
$( document.body ).click(function() {
|
$( document.body ).click(function() {
|
||||||
rightClickNode.style.display = "none";
|
rightClickNode.style.display = "none";
|
||||||
@@ -1383,45 +1383,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader) {
|
|||||||
$scope.downloadFile = function() {
|
$scope.downloadFile = function() {
|
||||||
|
|
||||||
url = "/filemanager/downloadFile";
|
url = "/filemanager/downloadFile";
|
||||||
|
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
|
||||||
var data = {
|
var indexPublicHTML = downloadURL.indexOf("public_html") + 11;
|
||||||
fileToDownload: $scope.currentPath + "/" + allFilesAndFolders[0],
|
$window.location.href = '/preview/' + domainName + downloadURL.slice(indexPublicHTML);
|
||||||
domainRandomSeed:domainRandomSeed,
|
|
||||||
domainName: domainName
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
var blob = new Blob([response.data]);
|
|
||||||
|
|
||||||
//IE case
|
|
||||||
if (!!window.navigator.msSaveBlob){
|
|
||||||
window.navigator.msSaveBlob(blob, allFilesAndFolders[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//create blob and url
|
|
||||||
var url = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
//create invisible acnhor, to specify the file name
|
|
||||||
var a = document.createElement('a');
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.style = "display: none";
|
|
||||||
a.href = url;
|
|
||||||
a.download = allFilesAndFolders[0];
|
|
||||||
a.click();
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,8 @@ application.controller('loginSystem', function($scope,$http,$window) {
|
|||||||
|
|
||||||
|
|
||||||
function ListInitialData(response) {
|
function ListInitialData(response) {
|
||||||
console.log(response.data)
|
|
||||||
|
|
||||||
if (response.data.loginStatus == 0)
|
if (response.data.loginStatus === 0)
|
||||||
{
|
{
|
||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
$("#loginFailed").fadeIn();
|
$("#loginFailed").fadeIn();
|
||||||
@@ -89,9 +88,7 @@ application.controller('loginSystem', function($scope,$http,$window) {
|
|||||||
|
|
||||||
$("#verifyingLogin").hide();
|
$("#verifyingLogin").hide();
|
||||||
}
|
}
|
||||||
function cantLoadInitialData(response) {
|
function cantLoadInitialData(response) {}
|
||||||
console.log("not good");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,5 +174,9 @@ class backupSchedule:
|
|||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [prepare]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [prepare]")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
backupSchedule.prepare()
|
||||||
|
|
||||||
backupSchedule.prepare()
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -37,5 +37,9 @@ class backupScheduleLocal:
|
|||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
backupScheduleLocal.prepare()
|
||||||
|
|
||||||
backupScheduleLocal.prepare()
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -5,7 +5,7 @@ fileManager.config(['$interpolateProvider', function($interpolateProvider) {
|
|||||||
$interpolateProvider.endSymbol('$}');
|
$interpolateProvider.endSymbol('$}');
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader) {
|
fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader, $window) {
|
||||||
|
|
||||||
$( document.body ).click(function() {
|
$( document.body ).click(function() {
|
||||||
rightClickNode.style.display = "none";
|
rightClickNode.style.display = "none";
|
||||||
@@ -1383,45 +1383,9 @@ fileManager.controller('fileManagerCtrl', function($scope,$http,FileUploader) {
|
|||||||
$scope.downloadFile = function() {
|
$scope.downloadFile = function() {
|
||||||
|
|
||||||
url = "/filemanager/downloadFile";
|
url = "/filemanager/downloadFile";
|
||||||
|
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
|
||||||
var data = {
|
var indexPublicHTML = downloadURL.indexOf("public_html") + 11;
|
||||||
fileToDownload: $scope.currentPath + "/" + allFilesAndFolders[0],
|
$window.location.href = '/preview/' + domainName + downloadURL.slice(indexPublicHTML);
|
||||||
domainRandomSeed:domainRandomSeed,
|
|
||||||
domainName: domainName
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
var blob = new Blob([response.data]);
|
|
||||||
|
|
||||||
//IE case
|
|
||||||
if (!!window.navigator.msSaveBlob){
|
|
||||||
window.navigator.msSaveBlob(blob, allFilesAndFolders[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//create blob and url
|
|
||||||
var url = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
//create invisible acnhor, to specify the file name
|
|
||||||
var a = document.createElement('a');
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.style = "display: none";
|
|
||||||
a.href = url;
|
|
||||||
a.download = allFilesAndFolders[0];
|
|
||||||
a.click();
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,8 @@ application.controller('loginSystem', function($scope,$http,$window) {
|
|||||||
|
|
||||||
|
|
||||||
function ListInitialData(response) {
|
function ListInitialData(response) {
|
||||||
console.log(response.data)
|
|
||||||
|
|
||||||
if (response.data.loginStatus == 0)
|
if (response.data.loginStatus === 0)
|
||||||
{
|
{
|
||||||
$scope.errorMessage = response.data.error_message;
|
$scope.errorMessage = response.data.error_message;
|
||||||
$("#loginFailed").fadeIn();
|
$("#loginFailed").fadeIn();
|
||||||
@@ -89,9 +88,7 @@ application.controller('loginSystem', function($scope,$http,$window) {
|
|||||||
|
|
||||||
$("#verifyingLogin").hide();
|
$("#verifyingLogin").hide();
|
||||||
}
|
}
|
||||||
function cantLoadInitialData(response) {
|
function cantLoadInitialData(response) {}
|
||||||
console.log("not good");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ app.controller('createACLCTRL', function($scope,$http) {
|
|||||||
var data = {
|
var data = {
|
||||||
|
|
||||||
aclName : $scope.aclName,
|
aclName : $scope.aclName,
|
||||||
makeAdmin : $scope.makeAdmin = true,
|
makeAdmin : $scope.makeAdmin,
|
||||||
|
|
||||||
//
|
//
|
||||||
versionManagement : $scope.versionManagement,
|
versionManagement : $scope.versionManagement,
|
||||||
|
|||||||
Reference in New Issue
Block a user