mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
loca
This commit is contained in:
@@ -718,6 +718,24 @@ def ConfigureV2Backup(request):
|
|||||||
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
|
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
try:
|
||||||
|
req_data = {}
|
||||||
|
req_data['token'] = request.GET.get('t')
|
||||||
|
req_data['refresh_token'] = request.GET.get('r')
|
||||||
|
req_data['token_uri'] = request.GET.get('to')
|
||||||
|
req_data['scopes'] = request.GET.get('s')
|
||||||
|
req_data['name'] = request.GET.get('n')
|
||||||
|
|
||||||
|
cpbuv2 = CPBackupsV2(
|
||||||
|
{'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
|
||||||
|
'BackupEmails': 1, 'BackendName': 'testremote'})
|
||||||
|
|
||||||
|
# RcloneData = {"name": 'testremote', "host": "staging.cyberpanel.net", "user": "abcds2751", "port": "22",
|
||||||
|
# "password": "hosting", }
|
||||||
|
cpbuv2.SetupRcloneBackend(CPBackupsV2.GDrive, req_data)
|
||||||
|
except BaseException as msg:
|
||||||
|
logging.writeToFile(str(msg))
|
||||||
|
|
||||||
# websites = ACLManager.findAllSites(current_acl, user_id)
|
# websites = ACLManager.findAllSites(current_acl, user_id)
|
||||||
#
|
#
|
||||||
# destinations = _get_destinations(local=True)
|
# destinations = _get_destinations(local=True)
|
||||||
|
|||||||
@@ -98,14 +98,15 @@ pass = {ObsecurePassword}
|
|||||||
ProcessUtilities.executioner(command, self.website.externalApp)
|
ProcessUtilities.executioner(command, self.website.externalApp)
|
||||||
elif type == CPBackupsV2.GDrive:
|
elif type == CPBackupsV2.GDrive:
|
||||||
## config = {"name":, "host":, "user":, "port":, "path":, "password":,}
|
## config = {"name":, "host":, "user":, "port":, "path":, "password":,}
|
||||||
command = f'rclone obscure {config["password"]}'
|
#command = f'rclone obscure {config["password"]}'
|
||||||
ObsecurePassword = ProcessUtilities.outputExecutioner(command).rstrip('\n')
|
#ObsecurePassword = ProcessUtilities.outputExecutioner(command).rstrip('\n')
|
||||||
|
|
||||||
content = f'''[{config["name"]}]
|
content = f'''[{config["name"]}]
|
||||||
type = sftp
|
type = sftp
|
||||||
host = {config["host"]}
|
host = hey
|
||||||
user = {config["user"]}
|
user = hey
|
||||||
pass = {ObsecurePassword}
|
pass = hey
|
||||||
|
{str(self.config)}
|
||||||
'''
|
'''
|
||||||
command = f"echo '{content}' > {self.ConfigFilePath}"
|
command = f"echo '{content}' > {self.ConfigFilePath}"
|
||||||
ProcessUtilities.executioner(command, self.website.externalApp, True)
|
ProcessUtilities.executioner(command, self.website.externalApp, True)
|
||||||
|
|||||||
Reference in New Issue
Block a user