diff --git a/backup/backupManager.py b/backup/backupManager.py index f063e071e..78e50d573 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -31,6 +31,7 @@ from googleapiclient.discovery import build from websiteFunctions.models import NormalBackupDests, NormalBackupJobs, NormalBackupSites from plogical.IncScheduler import IncScheduler + class BackupManager: localBackupPath = '/home/cyberpanel/localBackupPath' @@ -56,6 +57,16 @@ class BackupManager: proc = httpProc(request, 'backup/backup.html', {'websiteList': websitesName}, 'createBackup') return proc.render() + def backupSiteV2(self, request=None, userID=None, data=None): + currentACL = ACLManager.loadedACL(userID) + websitesName = ACLManager.findAllSites(currentACL, userID) + + command = 'chmod 755 /home/backup' + ProcessUtilities.executioner(command) + + proc = httpProc(request, 'backup/backupV2.html', {'websiteList': websitesName}, 'createBackup') + return proc.render() + def RestoreV2backupSite(self, request=None, userID=None, data=None): if ACLManager.CheckForPremFeature('all'): BackupStat = 1 @@ -63,7 +74,8 @@ class BackupManager: BackupStat = 0 currentACL = ACLManager.loadedACL(userID) websitesName = ACLManager.findAllSites(currentACL, userID) - proc = httpProc(request, 'IncBackups/RestoreV2Backup.html', {'websiteList': websitesName, 'BackupStat': BackupStat}, 'createBackup') + proc = httpProc(request, 'IncBackups/RestoreV2Backup.html', + {'websiteList': websitesName, 'BackupStat': BackupStat}, 'createBackup') return proc.render() def CreateV2backupSite(self, request=None, userID=None, data=None): @@ -81,7 +93,8 @@ class BackupManager: currentACL = ACLManager.loadedACL(userID) websitesName = ACLManager.findAllSites(currentACL, userID) - proc = httpProc(request, 'IncBackups/ScheduleV2Backup.html', {'websiteList': websitesName, "BackupStat": BackupStat}, 'createBackup') + proc = httpProc(request, 'IncBackups/ScheduleV2Backup.html', + {'websiteList': websitesName, "BackupStat": BackupStat}, 'createBackup') return proc.render() def gDrive(self, request=None, userID=None, data=None): @@ -340,7 +353,6 @@ class BackupManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def changeFileRetention(self, request=None, userID=None, data=None): try: @@ -362,15 +374,13 @@ class BackupManager: else: return ACLManager.loadErrorJson('status', 0) - - conf = gD.auth # logging.CyberCPLogFileWriter.writeToFile("...... conf...%s " % conf) config = json.loads(conf) # logging.CyberCPLogFileWriter.writeToFile("...... config...%s " % config) config['FileRetentiontime'] = Retentiontime - gD.auth=json.dumps(config) + gD.auth = json.dumps(config) gD.save() data_ret = {'status': 1} @@ -435,6 +445,25 @@ class BackupManager: proc = httpProc(request, 'backup/restore.html', {'backups': all_files}, 'restoreBackup') return proc.render() + def restoreSiteV2(self, request=None, userID=None, data=None): + path = os.path.join("/home", "backup") + if not os.path.exists(path): + proc = httpProc(request, 'backup/restoreV2.html', None, 'restoreBackup') + return proc.render() + else: + all_files = [] + ext = ".tar.gz" + + command = 'sudo chown -R cyberpanel:cyberpanel ' + path + ACLManager.executeCall(command) + + files = os.listdir(path) + for filename in files: + if filename.endswith(ext): + all_files.append(filename) + proc = httpProc(request, 'backup/restoreV2.html', {'backups': all_files}, 'restoreBackup') + return proc.render() + def getCurrentBackups(self, userID=None, data=None): try: currentACL = ACLManager.loadedACL(userID) @@ -1495,7 +1524,6 @@ class BackupManager: recordsToShow = int(data['recordsToShow']) page = int(str(data['page']).strip('\n')) - if ACLManager.currentContextPermission(currentACL, 'scheduleBackups') == 0: return ACLManager.loadErrorJson('scheduleStatus', 0) @@ -1726,7 +1754,6 @@ class BackupManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - def deleteAccountNormal(self, request=None, userID=None, data=None): try: @@ -1838,7 +1865,7 @@ class BackupManager: json_data = json.dumps(data_ret) return HttpResponse(json_data) - #currentStatus:"cat: /home/cyberpanel/9219: No such file or directory" + # currentStatus:"cat: /home/cyberpanel/9219: No such file or directory" statusData = ProcessUtilities.outputExecutioner("cat " + statusFile).splitlines() @@ -1871,4 +1898,4 @@ class BackupManager: except BaseException as msg: data_ret = {'abort': 0, 'installStatus': 0, 'installationProgress': "0", 'error_message': str(msg)} json_data = json.dumps(data_ret) - return HttpResponse(json_data) \ No newline at end of file + return HttpResponse(json_data) diff --git a/backup/static/backup/backupV2.js b/backup/static/backup/backupV2.js new file mode 100644 index 000000000..e1885b6a6 --- /dev/null +++ b/backup/static/backup/backupV2.js @@ -0,0 +1,415 @@ +newapp.controller('backupWebsiteControlV2', function ($scope, $http, $timeout) { + + $(document).ready(function () { + $(".destinationHide").hide(); + $('#create-backup-select').select2(); + }); + + $('#create-backup-select').on('select2:select', function (e) { + var data = e.params.data; + $scope.websiteToBeBacked = data.text; + $(".destinationHide").show(); + getBackupStatus(); + populateCurrentRecords(); + $scope.destination = false; + $scope.runningBackup = true; + }); + + $scope.destination = true; + $scope.backupButton = true; + $scope.backupLoading = true; + $scope.runningBackup = true; + $scope.cancelButton = true; + + populateCurrentRecords(); + + $scope.cancelBackup = function () { + + var backupCancellationDomain = $scope.websiteToBeBacked; + + url = "/backup/cancelBackupCreation"; + + var data = { + backupCancellationDomain: backupCancellationDomain, fileName: $scope.fileName, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + }; + + $scope.fetchDetails = function () { + getBackupStatus(); + populateCurrentRecords(); + $scope.destination = false; + $scope.runningBackup = true; + + }; + + function getBackupStatus() { + + $scope.backupLoadingBottom = false; + + var websiteToBeBacked = $scope.websiteToBeBacked; + + url = "/backup/backupStatus"; + + var data = { + websiteToBeBacked: websiteToBeBacked, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.backupStatus === 1) { + + if (response.data.abort === 1) { + $timeout.cancel(); + $scope.backupLoadingBottom = true; + $scope.destination = false; + $scope.runningBackup = false; + $scope.cancelButton = true; + $scope.backupButton = false; + $scope.backupLoading = true; + $scope.fileName = response.data.fileName; + $scope.status = response.data.status; + populateCurrentRecords(); + return; + } else { + $scope.destination = true; + $scope.backupButton = true; + $scope.runningBackup = false; + $scope.cancelButton = false; + + $scope.fileName = response.data.fileName; + $scope.status = response.data.status; + $timeout(getBackupStatus, 2000); + + } + } else { + $timeout.cancel(); + $scope.backupLoadingBottom = true; + $scope.backupLoading = true; + $scope.cancelButton = true; + $scope.backupButton = false; + } + + } + + function cantLoadInitialDatas(response) { + } + + }; + + $scope.destinationSelection = function () { + $scope.backupButton = false; + }; + + function populateCurrentRecords() { + + var websiteToBeBacked = $scope.websiteToBeBacked; + + url = "/backup/getCurrentBackups"; + + var data = { + websiteToBeBacked: websiteToBeBacked, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.fetchStatus == 1) { + $scope.records = JSON.parse(response.data.data); + } + + + } + + function cantLoadInitialDatas(response) { + } + + }; + + $scope.createBackup = function () { + + var createBackupButton = document.getElementById("createBackup"); + createBackupButton.disabled = true; + var websiteToBeBacked = $scope.websiteToBeBacked; + $scope.backupLoading = false; + + + url = "/backup/submitBackupCreation"; + + var data = { + websiteToBeBacked: websiteToBeBacked, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + // console.log("-------------------") + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.metaStatus === 1) { + getBackupStatus(); + createBackupButton.disabled = false; + } + + } + + function cantLoadInitialDatas(response) { + createBackupButton.disabled = false; + } + + }; + + $scope.deleteBackup = function (id) { + + url = "/backup/deleteBackup"; + + var data = { + backupID: id, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.deleteStatus == 1) { + + populateCurrentRecords(); + + + } else { + + } + + } + + function cantLoadInitialDatas(response) { + + + } + + + }; + + +}); +$("#websiteDeleteFailure").hide(); +$("#websiteDeleteSuccess").hide(); + +newapp.controller('restoreWebsiteControlV2', function ($scope, $http, $timeout) { + + $scope.restoreLoading = true; + $scope.runningRestore = true; + $scope.restoreButton = true; + $scope.restoreFinished = false; + $scope.couldNotConnect = true; + $scope.backupError = true; + $scope.siteExists = true; + + // check to start time of status function + + var check = 1; + + + $scope.fetchDetails = function () { + $scope.restoreLoading = false; + getRestoreStatus(); + }; + + + function getRestoreStatus() { + + var backupFile = $scope.backupFile; + + url = "/backup/restoreStatus"; + + var data = { + backupFile: backupFile, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.restoreStatus === 1) { + + if (response.data.abort === 1) { + $scope.running = response.data.running; + $scope.fileName = $scope.backupFile; + $scope.restoreLoading = true; + $scope.status = response.data.status; + $scope.runningRestore = false; + $scope.restoreButton = false; + $scope.restoreFinished = true; + $timeout.cancel(); + return; + } else { + $scope.running = response.data.running; + $scope.fileName = $scope.backupFile; + $scope.restoreLoading = false; + $scope.status = response.data.status; + $scope.runningRestore = false; + $scope.restoreButton = true; + $timeout(getRestoreStatus, 2000); + } + } + + } + + function cantLoadInitialDatas(response) { + $scope.couldNotConnect = false; + + + } + + }; + + + $scope.restoreBackup = function () { + var restoreBackupButton = document.getElementById("restoreBackup"); + restoreBackupButton.disabled = true; + var backupFile = $scope.backupFile; + $scope.running = "Lets start.." + + url = "/backup/submitRestore"; + + var data = { + backupFile: backupFile, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + $scope.restoreLoading = true; + if (response.data.restoreStatus == 1) { + $scope.runningRestore = false; + $scope.running = "Running"; + $scope.fileName = $scope.backupFile; + $scope.status = "Just Started.."; + + getRestoreStatus(); + restoreBackupButton.disabled = false; + } else { + $scope.backupError = false; + $scope.errorMessage = response.data.error_message; + restoreBackupButton.disabled = false; + } + + } + + function cantLoadInitialDatas(response) { + $scope.couldNotConnect = false; + restoreBackupButton.disabled = false; + } + + }; + + + function createWebsite() { + + var backupFile = $scope.backupFile; + + url = "/websites/CreateWebsiteFromBackup"; + + var data = { + backupFile: backupFile, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + if (response.data.createWebSiteStatus == 1) { + getRestoreStatus(); + } else if (response.data.existsStatus == 1) { + $scope.backupError = false; + $scope.errorMessage = response.data.error_message; + $scope.restoreButton = true; + $scope.runningRestore = true; + } else { + $scope.websiteDomain = domainName; + $scope.backupError = false; + $scope.errorMessage = response.data.error_message; + } + + + } + + function cantLoadInitialDatas(response) { + $scope.couldNotConnect = false; + } + + + }; + + +}); \ No newline at end of file diff --git a/backup/templates/backup/backup.html b/backup/templates/backup/backup.html index e90e97ab0..be7f878ed 100755 --- a/backup/templates/backup/backup.html +++ b/backup/templates/backup/backup.html @@ -1,155 +1,131 @@ - {% extends "baseTemplate/index.html" %} {% load i18n %} {% block title %}{% trans "Backup Website" %}{% endblock %} {% block content %} -{% load static %} + {% load static %} -{% get_current_language as LANGUAGE_CODE %} - + {% get_current_language as LANGUAGE_CODE %} + -
-
-

{% trans "Backup Website" %} - {% trans "Backup Docs" %}

-

{% trans "This page can be used to Backup your websites" %}

-
+
+
+

{% trans "Backup Website" %} - {% trans "Backup Docs" %}

+

{% trans "This page can be used to Backup your websites" %}

+
-
-
-

- {% trans "Backup Website" %} -

-
- -
- - -
- -
- -
-
- -
- -
- -
-
- - - - -
- -
- - - - - - - - - - - - - - - - -
{% trans "File Name" %}{% trans "Status" %}
{% trans "Running" %}{$ fileName $}{$ status $}
-
-
- - - - -
- -
- -
-
- -
- -
- -
-
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - -
{% trans "ID" %}{% trans "File" %}{% trans "Date" %}{% trans "Size" %}{% trans "Status" %}{% trans "Delete" %}
-
-
- - - - -
- -
-
-

{% trans "Cannot delete website, Error message: " %}{$ errorMessage $}

+
+
+

+ {% trans "Backup Website" %} +

+
+ +
+ +
+
- -
-

Website {$ deletedWebsite $} {% trans "Successfully Deleted" %}

+
+
+ +
+
-
- - - +
+ +
+
+ + + + + + + + + + + + + + + +
{% trans "File Name" %}{% trans "Status" %}
{% trans "Running" %}{$ fileName $}{$ status $}
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
{% trans "ID" %}{% trans "File" %}{% trans "Date" %}{% trans "Size" %}{% trans "Status" %}{% trans "Delete" %}
+
+
+ +
+ +
+
+

{% trans "Cannot delete website, Error message: " %}{$ errorMessage $}

+
+
+

Website {$ deletedWebsite $} {% trans "Successfully Deleted" %} +

+
+
+
+
- - - - - - +
-
- - -
- - {% endblock %} \ No newline at end of file diff --git a/backup/templates/backup/backupV2.html b/backup/templates/backup/backupV2.html new file mode 100644 index 000000000..a9b4309a3 --- /dev/null +++ b/backup/templates/backup/backupV2.html @@ -0,0 +1,144 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + {% load static %} + +
+
+
+

Backup Website -

+ {% trans "Backup Docs" %} +
+
+

This page can be used to Backup your websites

+
+

Backup Website

+ +
+
+
+
+

Select Website

+
+
+ +
+
+
+
+

Destination

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + +
+ File Name + + Status +
+ Running + + {$ fileName $} + + {$ status $} +
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ ID + + File + + Date + + Size + + Status + + Delete +
+ + + + + + +
+
+
+
+
+

{% trans "Cannot delete website, Error message: " %}{$ errorMessage $}

+
+
+

Website {$ deletedWebsite $} {% trans "Successfully Deleted" %}

+
+
+
+
+{% endblock %} diff --git a/backup/templates/backup/restore.html b/backup/templates/backup/restore.html index b213b683f..9026746b6 100755 --- a/backup/templates/backup/restore.html +++ b/backup/templates/backup/restore.html @@ -3,114 +3,111 @@ {% block title %}{% trans "Restore Website - CyberPanel" %}{% endblock %} {% block content %} -{% load static %} - -{% get_current_language as LANGUAGE_CODE %} - - - -
-
-

{% trans "Restore Website" %} - {% trans "Backup Docs" %}

-

{% trans "This page can be used to restore your websites, Backup should be generated from CyberPanel Backup generation tool, it will detect all Backups under /home/backup." %}

-
- -
-
-

- {% trans "Restore Website" %} -

-
- - -
- - -
- -
- -
-
- - - -
- -
- - -
-
- - - - - -
- -
- - - - - - - - - - - - - - - - -
{% trans "Condition" %}{% trans "File Name" %}{% trans "Status" %}
{$ running $}{$ fileName $}{$ status $}
-
-
- - - - - - -
- -
-
-

{% trans "Error message:" %} {$ errorMessage $}

-
- -
-

{% trans "Site related to this Backup already exists." %}

-
- - -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
-
- - - -
- - -
+ {% load static %} + {% get_current_language as LANGUAGE_CODE %} + +
+
+

{% trans "Restore Website" %} - {% trans "Backup Docs" %} +

+

{% trans "This page can be used to restore your websites, Backup should be generated from CyberPanel Backup generation tool, it will detect all Backups under /home/backup." %}

+ +
+
+

+ {% trans "Restore Website" %} +

+
+ + +
+ + +
+ +
+ +
+
+ + +
+ +
+ + +
+
+ + + + +
+ +
+ + + + + + + + + + + + + + + + +
{% trans "Condition" %}{% trans "File Name" %}{% trans "Status" %}
{$ running $}{$ fileName $}{$ status $}
+
+
+ + + + + +
+ +
+
+

{% trans "Error message:" %} {$ errorMessage $}

+
+
+

{% trans "Site related to this Backup already exists." %}

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+ + +
+ + +
+ + +
+
+
+ +
-
- - -
{% endblock %} \ No newline at end of file diff --git a/backup/templates/backup/restoreV2.html b/backup/templates/backup/restoreV2.html new file mode 100644 index 000000000..592a74c44 --- /dev/null +++ b/backup/templates/backup/restoreV2.html @@ -0,0 +1,91 @@ +{% extends "baseTemplate/newBase.html" %} +{% load i18n %} +{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %} +{% block newContent %} + + {% load static %} + +
+
+
+

Restore Website -

+ {% trans "Backup Docs" %} +
+
+

This page can be used to restore your websites, Backup + should be generated from CyberPanel Backup generation tool, it will detect all Backups under /home/backup. +

+
+

Restore Website

+ +
+
+
+
+

Select Backup

+
+
+ +
+
+
+ +
+
+
+ + + + + + + + + + + + + + + +
+ Condition + + File Name + + Status +
+ {$ running $} + + {$ fileName $} + + {$ status $} +
+
+
+
+
+

{% trans "Error message:" %} {$ errorMessage $}

+
+
+

{% trans "Site related to this Backup already exists." %}

+
+
+

{% trans "Could not connect to server. Please refresh this page." %}

+
+
+
+
+{% endblock %} diff --git a/backup/urls.py b/backup/urls.py index 38cabfde6..abe492927 100755 --- a/backup/urls.py +++ b/backup/urls.py @@ -5,7 +5,9 @@ urlpatterns = [ url(r'^$', views.loadBackupHome, name='loadBackupHome'), url(r'^getCurrentBackups', views.getCurrentBackups, name='getCurrentBackups'), url(r'^backupSite', views.backupSite, name='backupSite'), + url(r'^V2/backupSiteV2', views.backupSiteV2, name='backupSiteV2'), url(r'^restoreSite', views.restoreSite, name='restoreSite'), + url(r'^V2/restoreSiteV2', views.restoreSiteV2, name='restoreSiteV2'), url(r'^gDrive$', views.gDrive, name='gDrive'), url(r'^gDriveSetup$', views.gDriveSetup, name='gDriveSetup'), url(r'^fetchgDriveSites$', views.fetchgDriveSites, name='fetchgDriveSites'), @@ -16,7 +18,6 @@ urlpatterns = [ url(r'^deleteSitegDrive$', views.deleteSitegDrive, name='deleteSitegDrive'), url(r'^fetchDriveLogs$', views.fetchDriveLogs, name='fetchDriveLogs'), - url(r'^submitBackupCreation', views.submitBackupCreation, name='submitBackupCreation'), url(r'^cancelBackupCreation', views.cancelBackupCreation, name='cancelBackupCreation'), url(r'^backupStatus', views.backupStatus, name='backupStatus'), @@ -42,10 +43,8 @@ urlpatterns = [ url(r'^submitBackupSchedule', views.submitBackupSchedule, name='submitBackupSchedule'), - url(r'^scheduleDelete', views.scheduleDelete, name='scheduleDelete'), - url(r'^remoteBackups', views.remoteBackups, name='remoteBackups'), url(r'^submitRemoteBackups', views.submitRemoteBackups, name='submitRemoteBackups'), url(r'^getRemoteTransferStatus', views.getRemoteTransferStatus, name='getRemoteTransferStatus'), @@ -67,4 +66,4 @@ urlpatterns = [ url(r'^deleteAccountNormal$', views.deleteAccountNormal, name='deleteAccountNormal'), url(r'^fetchNormalLogs$', views.fetchNormalLogs, name='fetchNormalLogs'), -] \ No newline at end of file +] diff --git a/backup/views.py b/backup/views.py index b20cfaa9d..59ec6d5df 100755 --- a/backup/views.py +++ b/backup/views.py @@ -14,6 +14,7 @@ from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from django.shortcuts import HttpResponse from django.views.decorators.csrf import csrf_exempt + def loadBackupHome(request): try: userID = request.session['userID'] @@ -22,6 +23,7 @@ def loadBackupHome(request): except KeyError: return redirect(loadLoginPage) + def backupSite(request): try: userID = request.session['userID'] @@ -30,6 +32,16 @@ def backupSite(request): except KeyError: return redirect(loadLoginPage) + +def backupSiteV2(request): + try: + userID = request.session['userID'] + bm = BackupManager() + return bm.backupSiteV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + + def gDrive(request): try: userID = request.session['userID'] @@ -38,6 +50,7 @@ def gDrive(request): except KeyError: return redirect(loadLoginPage) + def gDriveSetup(request): try: userID = request.session['userID'] @@ -46,6 +59,7 @@ def gDriveSetup(request): except KeyError: return redirect(loadLoginPage) + def fetchgDriveSites(request): try: userID = request.session['userID'] @@ -54,6 +68,7 @@ def fetchgDriveSites(request): except KeyError: return redirect(loadLoginPage) + def addSitegDrive(request): try: userID = request.session['userID'] @@ -62,6 +77,7 @@ def addSitegDrive(request): except KeyError: return redirect(loadLoginPage) + def deleteAccountgDrive(request): try: userID = request.session['userID'] @@ -70,6 +86,7 @@ def deleteAccountgDrive(request): except KeyError: return redirect(loadLoginPage) + def changeAccountFrequencygDrive(request): try: userID = request.session['userID'] @@ -78,6 +95,7 @@ def changeAccountFrequencygDrive(request): except KeyError: return redirect(loadLoginPage) + def changeFileRetention(request): try: userID = request.session['userID'] @@ -86,6 +104,7 @@ def changeFileRetention(request): except KeyError: return redirect(loadLoginPage) + def deleteSitegDrive(request): try: userID = request.session['userID'] @@ -94,6 +113,7 @@ def deleteSitegDrive(request): except KeyError: return redirect(loadLoginPage) + def fetchDriveLogs(request): try: userID = request.session['userID'] @@ -102,6 +122,7 @@ def fetchDriveLogs(request): except KeyError: return redirect(loadLoginPage) + def restoreSite(request): try: userID = request.session['userID'] @@ -111,6 +132,15 @@ def restoreSite(request): return redirect(loadLoginPage) +def restoreSiteV2(request): + try: + userID = request.session['userID'] + bm = BackupManager() + return bm.restoreSiteV2(request, userID) + except KeyError: + return redirect(loadLoginPage) + + def getCurrentBackups(request): try: userID = request.session['userID'] @@ -119,6 +149,7 @@ def getCurrentBackups(request): except KeyError: return redirect(loadLoginPage) + def submitBackupCreation(request): try: userID = request.session['userID'] @@ -128,7 +159,7 @@ def submitBackupCreation(request): return result wm = BackupManager() - coreResult = wm.submitBackupCreation(userID, json.loads(request.body)) + coreResult = wm.submitBackupCreation(userID, json.loads(request.body)) return coreResult @@ -226,6 +257,7 @@ def submitDestinationCreation(request): except KeyError: return redirect(loadLoginPage) + def getCurrentBackupDestinations(request): try: userID = request.session['userID'] @@ -234,6 +266,7 @@ def getCurrentBackupDestinations(request): except KeyError: return redirect(loadLoginPage) + def getConnectionStatus(request): try: userID = request.session['userID'] @@ -242,6 +275,7 @@ def getConnectionStatus(request): except KeyError: return redirect(loadLoginPage) + def deleteDestination(request): try: userID = request.session['userID'] @@ -260,6 +294,7 @@ def deleteDestination(request): except KeyError: return redirect(loadLoginPage) + def scheduleBackup(request): try: userID = request.session['userID'] @@ -268,6 +303,7 @@ def scheduleBackup(request): except KeyError: return redirect(loadLoginPage) + def getCurrentBackupSchedules(request): try: userID = request.session['userID'] @@ -276,6 +312,7 @@ def getCurrentBackupSchedules(request): except KeyError: return redirect(loadLoginPage) + def submitBackupSchedule(request): try: userID = request.session['userID'] @@ -294,6 +331,7 @@ def submitBackupSchedule(request): except KeyError: return redirect(loadLoginPage) + def scheduleDelete(request): try: userID = request.session['userID'] @@ -312,6 +350,7 @@ def scheduleDelete(request): except KeyError: return redirect(loadLoginPage) + def remoteBackups(request): try: userID = request.session['userID'] @@ -320,6 +359,7 @@ def remoteBackups(request): except KeyError: return redirect(loadLoginPage) + def submitRemoteBackups(request): try: userID = request.session['userID'] @@ -338,6 +378,7 @@ def submitRemoteBackups(request): except KeyError: return redirect(loadLoginPage) + def starRemoteTransfer(request): try: userID = request.session['userID'] @@ -356,6 +397,7 @@ def starRemoteTransfer(request): except KeyError: return redirect(loadLoginPage) + def getRemoteTransferStatus(request): try: userID = request.session['userID'] @@ -364,6 +406,7 @@ def getRemoteTransferStatus(request): except KeyError: return redirect(loadLoginPage) + def remoteBackupRestore(request): try: userID = request.session['userID'] @@ -382,6 +425,7 @@ def remoteBackupRestore(request): except KeyError: return redirect(loadLoginPage) + def localRestoreStatus(request): try: userID = request.session['userID'] @@ -390,6 +434,7 @@ def localRestoreStatus(request): except KeyError: return redirect(loadLoginPage) + def cancelRemoteBackup(request): try: userID = request.session['userID'] @@ -398,6 +443,7 @@ def cancelRemoteBackup(request): except KeyError: return redirect(loadLoginPage) + def backupLogs(request): try: userID = request.session['userID'] @@ -406,6 +452,7 @@ def backupLogs(request): except KeyError: return redirect(loadLoginPage) + def fetchLogs(request): try: userID = request.session['userID'] @@ -416,6 +463,7 @@ def fetchLogs(request): except KeyError: return redirect(loadLoginPage) + @csrf_exempt def localInitiate(request): try: @@ -428,6 +476,7 @@ def localInitiate(request): except BaseException as msg: logging.writeToFile(str(msg)) + def fetchgNormalSites(request): try: userID = request.session['userID'] @@ -436,6 +485,7 @@ def fetchgNormalSites(request): except KeyError: return redirect(loadLoginPage) + def fetchNormalJobs(request): try: userID = request.session['userID'] @@ -444,6 +494,7 @@ def fetchNormalJobs(request): except KeyError: return redirect(loadLoginPage) + def addSiteNormal(request): try: userID = request.session['userID'] @@ -452,6 +503,7 @@ def addSiteNormal(request): except KeyError: return redirect(loadLoginPage) + def deleteSiteNormal(request): try: userID = request.session['userID'] @@ -460,6 +512,7 @@ def deleteSiteNormal(request): except KeyError: return redirect(loadLoginPage) + def changeAccountFrequencyNormal(request): try: userID = request.session['userID'] @@ -468,6 +521,7 @@ def changeAccountFrequencyNormal(request): except KeyError: return redirect(loadLoginPage) + def deleteAccountNormal(request): try: userID = request.session['userID'] @@ -476,10 +530,11 @@ def deleteAccountNormal(request): except KeyError: return redirect(loadLoginPage) + def fetchNormalLogs(request): try: userID = request.session['userID'] wm = BackupManager() return wm.fetchNormalLogs(request, userID) except KeyError: - return redirect(loadLoginPage) \ No newline at end of file + return redirect(loadLoginPage) diff --git a/baseTemplate/templates/baseTemplate/newBase.html b/baseTemplate/templates/baseTemplate/newBase.html index 0b8162250..5602d4bf5 100644 --- a/baseTemplate/templates/baseTemplate/newBase.html +++ b/baseTemplate/templates/baseTemplate/newBase.html @@ -733,17 +733,17 @@