From b7b5117f2f3378c3881fc39f1770cbb966e2bb02 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 19 Apr 2024 00:10:30 +0400 Subject: [PATCH] bug fix with backups v2 --- IncBackups/static/IncBackups/IncBackups.js | 2 +- .../IncBackups/ConfigureV2Backup.html | 17 +++++++++ IncBackups/views.py | 6 +++- plogical/Backupsv2.py | 2 ++ plogical/test.py | 36 ------------------- 5 files changed, 25 insertions(+), 38 deletions(-) diff --git a/IncBackups/static/IncBackups/IncBackups.js b/IncBackups/static/IncBackups/IncBackups.js index 77782fe8e..07815a432 100644 --- a/IncBackups/static/IncBackups/IncBackups.js +++ b/IncBackups/static/IncBackups/IncBackups.js @@ -1864,7 +1864,7 @@ app.controller('ConfigureV2Backup', function ($scope, $http, $timeout) { $scope.setupAccount = function () { - window.open("https://platform.cyberpersons.com/gDrive?name=" + $scope.accountName + '&server=' + window.location.href + 'Setup&domain=' + $scope.selwebsite); + window.open("https://platform.cyberpersons.com/gDrive?name=" + $scope.accountName + '&client_id=' + $scope.client_id + '&client_secret=' + $scope.client_secret + '&server=' + window.location.href + 'Setup&domain=' + $scope.selwebsite); }; $scope.ConfigerSFTP = function () { diff --git a/IncBackups/templates/IncBackups/ConfigureV2Backup.html b/IncBackups/templates/IncBackups/ConfigureV2Backup.html index 06db25c44..867953312 100644 --- a/IncBackups/templates/IncBackups/ConfigureV2Backup.html +++ b/IncBackups/templates/IncBackups/ConfigureV2Backup.html @@ -69,6 +69,23 @@ +
+

Learn how to create this.. These field can be left empty but backups may not work then.

+ +
+ +
+
+ +
+ +
+ +
+
+ diff --git a/IncBackups/views.py b/IncBackups/views.py index 1d347fd25..283b8b056 100644 --- a/IncBackups/views.py +++ b/IncBackups/views.py @@ -747,6 +747,8 @@ def ConfigureV2BackupSetup(request): req_data['token_uri'] = request.GET.get('to') req_data['scopes'] = request.GET.get('s') req_data['accountname'] = request.GET.get('n') + req_data['client_id'] = request.GET.get('client_id') + req_data['client_secret'] = request.GET.get('client_secret') website = request.GET.get('d') # logging.writeToFile('domainname is ====%s'%(request.GET.get)) @@ -770,7 +772,9 @@ def ConfigureV2BackupSetup(request): except BaseException as msg: logging.writeToFile("Error configure"+str(msg)) - return redirect(loadLoginPage) + data_ret = {'status': 0, 'error_message': str(msg) + request.get_raw_uri() } + json_data = json.dumps(data_ret) + return HttpResponse(json_data) def CreateV2Backup(request): try: diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 0924f1454..f3871b6a7 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -203,6 +203,8 @@ port = {config["sshPort"]} [{config["accountname"]}] type = drive scope = drive +client_id={config["client_id"]} +client_secret={config["client_secret"]} token = {token} team_drive = ''' diff --git a/plogical/test.py b/plogical/test.py index a380f501a..e69de29bb 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -1,36 +0,0 @@ -import sys -sys.path.append('/usr/local/CyberCP') -from plogical.processUtilities import ProcessUtilities - - -def findPHPVersions(): - # distro = ProcessUtilities.decideDistro() - # if distro == ProcessUtilities.centos: - # return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # elif distro == ProcessUtilities.cent8: - # return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # elif distro == ProcessUtilities.ubuntu20: - # return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - # else: - # return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - - try: - - # Run the shell command and capture the output - result = ProcessUtilities.outputExecutioner('ls -la /usr/local/lsws') - - # Get the lines containing 'lsphp' in the output - lsphp_lines = [line for line in result.split('\n') if 'lsphp' in line] - print(lsphp_lines) - - # Extract the version from the lines and format it as 'PHP x.y' - php_versions = ['PHP ' + line.split()[8][5] + '.' + line.split()[8][6:] for line in lsphp_lines] - print(php_versions) - - # Now php_versions contains the formatted PHP versions - return php_versions - except BaseException as msg: - print(str(msg)) - return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1'] - -findPHPVersions() \ No newline at end of file