Review Code

This commit is contained in:
Zarak Khan
2024-02-22 11:35:06 +05:00
parent 8b4c0ffc3b
commit 2fab5982a4
75 changed files with 11067 additions and 1022 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
{% if BackupStat %}
<div ng-controller="ConfigureV2BackupV2" class="p-8">
<div class="flex items-center py-4">
<p class="text-xl font-bold">Configure v2 Backup Destinations</p>
<img ng-hide="cyberpanelLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Website</p>
</div>
<div>
<select id="selwebsite" ng-change="selectwebsite()" ng-model="selwebsite"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in websiteList %}
<option value="{{ items }}">{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Backup Type</p>
</div>
<div>
<select ng-change="selectbackuptype()" ng-model="v2backuptype"
class="w-80 bg-gray-100 rounded px-2 py-1">
<option>SFTP</option>
<option>GDrive</option>
</select>
</div>
</div>
{# <div>#}
{# <div class="flex justify-center mt-6 mb-2">#}
{# <button id="CreateV2BackupButton" ng-click="CreateV2BackupButton()"#}
{# class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">#}
{# Create Backup#}
{# </button>#}
{# </div>#}
{# </div>#}
{# <div ng-hide="installationProgress">#}
{# <div class="col-sm-7">#}
{# <div class="flex justify-center font-bold text-xl">#}
{# <h2>{$ currentStatus $}</h2>#}
{# </div>#}
{# <div class="w-full bg-gray-100 rounded-full mt-3">#}
{# <div id="installProgress"#}
{# class="bg-green-600 text-xs font-medium text-white text-center p-2 leading-none rounded-full"#}
{# style="width:0%">#}
{# </div>#}
{# </div>#}
{# <div ng-hide="errorMessageBox"#}
{# class="flex justify-center bg-red-500 rounded-lg text-white px-2 py-1 font-semibold">#}
{# <p>{% trans "Error message:" %} {$ errorMessage $}</p>#}
{# </div>#}
{# <div ng-hide="success" class="flex justify-center bg-green-500 px-2 rounded-lg py-1 font-semibold">#}
{# <p>{% trans "Backup succesfully." %}</p>#}
{# </div>#}
{# <div ng-hide="couldNotConnect"#}
{# class="flex justify-center bg-red-500 rounded-lg text-white px-2 py-1 font-semibold">#}
{# <p>{% trans "Could not connect to server. Please refresh this page." %}</p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# <div ng-hide="installationProgress" class="flex justify-center mt-3">#}
{# <div class="col-sm-4">#}
{# <button type="button" ng-disabled="goBackDisable" ng-click="goBack()"#}
{# class="bg-blue-500 px-3 py-2 rounded-lg text-xl font-semibold text-white">{% trans "Go Back" %}</button>#}
{# </div>#}
{# </div>#}
</div>
{% else %}
<style>
.feturecard {
width: 30%;
padding: 46px;
margin: 15px
}
</style>
<div class="container">
<div id="page-title" align="center">
<h1 style="color: black"><strong>Backups v2 - Incremental Backups! </strong></h1>
<p style="font-size: 15px; color: black; margin-top: 1%">Is your website's data protection strategy up
to par? Are you tired of dealing with slow and unreliable backup solutions that don't offer the
level of robustness you need? <br><br>
Introducing CyberPanel's latest feature, Backups v2! With Backups v2, you can ensure that your
website's data is protected like never before. Our advanced incremental backup system utilizes
rclone, a powerful backup tool that supports over 30+ backends, including popular cloud storage
providers like Google Drive, Dropbox, Amazon S3, and more!<br><br>
Gone are the days of slow and cumbersome full backups. With Backups v2, you can take advantage of
incremental backups that only capture changes to your data, making the process lightning-fast and
highly efficient. This means you can save time and bandwidth while still maintaining the highest
level of data integrity.<br><br>
Whether you have a small blog or a large e-commerce website, Backups v2 is tailored to meet your
needs. With its robustness and versatility, you can have peace of mind knowing that your website's
data is backed up securely and can be easily restored whenever you need it.
<br></p>
</div>
<p align="center">
<iframe width="788.54" height="443" src="https://www.youtube.com/embed/7dI1013xvUc"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</p>
<div style="margin-top: 2%">
<stripe-pricing-table pricing-table-id="prctbl_1MQtdYJMfY1fWGMszc4tx78j"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
<stripe-pricing-table pricing-table-id="prctbl_1LpSqSJMfY1fWGMsxSNhPLsc"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
<stripe-pricing-table pricing-table-id="prctbl_1M6WpCJMfY1fWGMsQXFlZWcW"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
</div>
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,133 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="CreateV2BackupV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Create V2 Backup -</p>
<a target="_blank" href="http://go.cyberpanel.net/backup"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Backup Docs" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">This page can be used to create your backup
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Create v2 Backup</p>
<img ng-hide="backupLoading" src="{% static 'images/loading.gif' %}">
<a class="ml-2 font-semibold text-gray-500" href="{% url 'RestoreV2backupSite' %}">- Restore Backups</a>
</div>
<hr>
<p class="border" align="center" style="margin-top: 2%; margin-bottom: 2%">
<iframe width="788.54" height="443" src="https://www.youtube.com/embed/7dI1013xvUc"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</p>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Website</p>
</div>
<div>
<select id="create-backup-select" ng-change="selectwebsite()" ng-model="selwebsite"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in websiteList %}
<option value="{{ items }}">{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Repo</p>
</div>
<div>
<select id="reposelectbox" ng-change="selectrepo()" ng-model="testhabbi"
class="w-80 bg-gray-100 rounded px-2 py-1">
</select>
</div>
</div>
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Backup Content</p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteData" type="checkbox" value="">
Data
</label>
</div>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteDatabases" type="checkbox" value="">
Databases
</label>
</div>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteEmails" type="checkbox" value="">
Emails
</label>
</div>
</div>
</div>
<div>
<div class="flex justify-center mt-6 mb-2">
<button id="CreateV2BackupButton" ng-click="CreateV2BackupButton()"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Create Backup
</button>
</div>
</div>
<div ng-hide="installationProgress">
<div class="col-sm-7">
<div class="flex justify-center font-bold text-xl">
<h2>{$ currentStatus $}</h2>
</div>
<div class="w-full bg-gray-100 rounded-full mt-3">
<div id="installProgress"
class="bg-green-600 text-xs font-medium text-white text-center p-2 leading-none rounded-full"
style="width:0%">
</div>
</div>
<div ng-hide="errorMessageBox"
class="flex justify-center bg-red-500 rounded-lg text-white px-2 py-1 font-semibold">
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="success" class="flex justify-center bg-green-500 px-2 rounded-lg py-1 font-semibold">
<p>{% trans "Backup succesfully." %}</p>
</div>
<div ng-hide="couldNotConnect"
class="flex justify-center bg-red-500 rounded-lg text-white px-2 py-1 font-semibold">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>
<div ng-hide="installationProgress" class="flex justify-center mt-3">
<div class="col-sm-4">
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()"
class="bg-blue-500 px-3 py-2 rounded-lg text-xl font-semibold text-white">{% trans "Go Back" %}</button>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,229 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
{% if BackupStat %}
<div ng-controller="ScheduleV2BackupV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Schedule V2 Backup -</p>
<a target="_blank" href="http://go.cyberpanel.net/backup"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Backup Docs" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">This page can be used to schedule your backups.
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Schedule v2 Backup</p>
<img ng-hide="backupLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Website</p>
</div>
<div>
<select id="create-backup-select" ng-change="selectwebsite()" ng-model="selwebsite"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in websiteList %}
<option value="{{ items }}">{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Backup Frequency</p>
</div>
<div>
<select id="create-backup-select" ng-model="frequency"
class="w-80 bg-gray-100 rounded px-2 py-1">
<option>30 Minutes</option>
<option>1 Hour</option>
<option>6 Hours</option>
<option>12 Hours</option>
<option>1 Day</option>
<option>3 Days</option>
<option>1 Week</option>
</select>
</div>
</div>
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Select Repo</p>
</div>
<div>
<select id="reposelectbox" ng-change="selectrepo()" ng-model="testhabbi"
class="w-80 bg-gray-100 rounded px-2 py-1">
</select>
</div>
</div>
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Backup Retention</p>
</div>
<div>
<select id="create-backup-select" ng-model="retention"
class="w-80 bg-gray-100 rounded px-2 py-1">
<option value="1">1 Day</option>
<option value="3">3 Days</option>
<option value="30">30 Days</option>
</select>
</div>
</div>
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Backup Content</p>
</div>
<div>
<label>
<input ng-model="websiteData" type="checkbox" value="">
Data
</label>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteDatabases" type="checkbox" value="">
Databases
</label>
</div>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteEmails" type="checkbox" value="">
Emails
</label>
</div>
</div>
</div>
<div>
<div class="flex justify-center mt-6 mb-2">
<button id="CreateV2BackupButton" ng-click="CreateScheduleV2()"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Create Schedule
</button>
</div>
</div>
<div class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
Repo
</th>
<th scope="col" class="px-6 py-3">
Frequency
</th>
<th scope="col" class="px-6 py-3">
Retention
</th>
<th scope="col" class="px-6 py-3">
Backup Websites?
</th>
<th scope="col" class="px-6 py-3">
Backup Databases?
</th>
<th scope="col" class="px-6 py-3">
Backup Emails?
</th>
<th scope="col" class="px-6 py-3">
Last Run
</th>
<th scope="col" class="px-6 py-3">
Delete
</th>
</tr>
</thead>
<tbody ng-repeat="record in records track by $index"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.repo" class="px-6 py-4">
</td>
<td ng-bind="record.frequency" class="px-6 py-4">
</td>
<td ng-bind="record.retention" class="px-6 py-4">
</td>
<td ng-bind="record.websiteData" class="px-6 py-4">
</td>
<td ng-bind="record.websiteDatabases" class="px-6 py-4">
</td>
<td ng-bind="record.websiteEmails" class="px-6 py-4">
</td>
<td ng-bind="record.lastRun" class="px-6 py-4">
</td>
<td class="px-6 py-4">
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% else %}
<style>
.feturecard {
width: 30%;
padding: 46px;
margin: 15px
}
</style>
<div class="container">
<div id="page-title" align="center">
<h1 style="color: black"><strong>Backups v2 - Incremental Backups! </strong></h1>
<p style="font-size: 15px; color: black; margin-top: 1%">Is your website's data protection strategy up
to par? Are you tired of dealing with slow and unreliable backup solutions that don't offer the
level of robustness you need? <br><br>
Introducing CyberPanel's latest feature, Backups v2! With Backups v2, you can ensure that your
website's data is protected like never before. Our advanced incremental backup system utilizes
rclone, a powerful backup tool that supports over 30+ backends, including popular cloud storage
providers like Google Drive, Dropbox, Amazon S3, and more!<br><br>
Gone are the days of slow and cumbersome full backups. With Backups v2, you can take advantage of
incremental backups that only capture changes to your data, making the process lightning-fast and
highly efficient. This means you can save time and bandwidth while still maintaining the highest
level of data integrity.<br><br>
Whether you have a small blog or a large e-commerce website, Backups v2 is tailored to meet your
needs. With its robustness and versatility, you can have peace of mind knowing that your website's
data is backed up securely and can be easily restored whenever you need it.
<br></p>
</div>
<p align="center">
<iframe width="788.54" height="443" src="https://www.youtube.com/embed/7dI1013xvUc"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</p>
<div style="margin-top: 2%">
<stripe-pricing-table pricing-table-id="prctbl_1MQtdYJMfY1fWGMszc4tx78j"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
<stripe-pricing-table pricing-table-id="prctbl_1LpSqSJMfY1fWGMsxSNhPLsc"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
<stripe-pricing-table pricing-table-id="prctbl_1M6WpCJMfY1fWGMsQXFlZWcW"
publishable-key="pk_live_51ITXBmJMfY1fWGMs2G0LAydJweIDMp2WaYocM0xyzdn03WaHUbMw6uxfVuktAkgpRyUql7tz7gF5OwdccEZLd6Ot00XX6tGoZx">
</stripe-pricing-table>
</div>
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,193 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="scheduleBackupIncV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Schedule Backup -</p>
<a target="_blank" href="https://cyberpanel.net/"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Remote Backups" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">On this page you can schedule Backups to localhost or remote
server (If you have added one).
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Schedule Backup</p>
<img ng-hide="cyberpanelLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Destination</p>
</div>
<div>
<select ng-change="scheduleFreqView()" ng-model="backupDest" class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in destinations %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div>
<div ng-hide="scheduleFreq" class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Frequency</p>
</div>
<div>
<select ng-change="scheduleBtnView()" ng-model="backupFreq"
class="w-80 bg-gray-100 rounded px-2 py-1">
<option>Daily</option>
<option>Weekly</option>
</select>
</div>
</div>
<div ng-hide="scheduleRetention" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Select Backup Retention. Leave 0 for no limit</p>
</div>
<div>
<input ng-model="backupRetention" type="number" class="w-80 bg-gray-100 rounded px-2 py-1"
value="0">
</div>
</div>
<div ng-hide="scheduleFreq">
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Backup Content</p>
</div>
<div>
<label>
<input ng-model="websiteData" type="checkbox" value="">
Data
</label>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<label>
<input ng-model="websiteDatabases" type="checkbox" value="">
Databases
</label>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<div class="checkbox">
<label>
<input ng-model="websiteEmails" type="checkbox" value="">
Emails
</label>
</div>
</div>
</div>
</div>
<div ng-hide="scheduleFreq">
<div class="flex justify-center mt-6 mb-2">
<button ng-click="addSchedule()"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Add Destination
</button>
</div>
</div>
</div>
<div ng-hide="scheduleFreq" class="form-group">
<div class="col-sm-12">
<input type="text" ng-model="accountsSearch"
placeholder="{% trans 'Search Accounts..' %}"
class="w-full bg-gray-100 rounded px-2 py-1">
</div>
</div>
<div ng-hide="scheduleFreq" class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
Select sites to be included in this job
</th>
<th scope="col" class="px-6 py-3">
<input ng-model="webSiteStatus" ng-change="allChecked(webSiteStatus)"
type="checkbox" value="">
</th>
</tr>
</thead>
<tbody ng-repeat="web in WebSitesList | filter:accountsSearch"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="web.domain" class="px-6 py-4">
</td>
<td ng-click="" class="px-6 py-4">
<input ng-model="webSiteStatus"
ng-change="addRemoveWebsite(web.domain,webSiteStatus)"
type="checkbox" value="">
</td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-sm-4 col-sm-offset-8">
<nav aria-label="Page navigation">
<ul class="pagination">
<li ng-repeat="page in pagination"
ng-click="getFurtherWebsitesFromDB($index+1)" id="webPages"><a
href="">{$ $index + 1 $}</a></li>
</ul>
</nav>
</div>
</div>
<div class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
ID
</th>
<th scope="col" class="px-6 py-3">
Destination
</th>
<th scope="col" class="px-6 py-3">
Frequency
</th>
<th scope="col" class="px-6 py-3">
Sites
</th>
<th scope="col" class="px-6 py-3">
Delete
</th>
</tr>
</thead>
<tbody ng-repeat="record in records track by $index"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.id" class="px-6 py-4">
</td>
<td ng-bind="record.destination" class="px-6 py-4">
</td>
<td ng-bind="record.frequency" class="px-6 py-4">
</td>
<td ng-bind="record.numberOfSites" class="px-6 py-4">
</td>
<td class="px-6 py-4">
Delete Edit
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,140 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="createIncrementalBackupsV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Backup Website -</p>
<a target="_blank" href="https://cyberpanel.net/docs/2-create-restore-incremental-backups/"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Backup Docs" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">This page can be used to create incremental backups for your
websites.
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Backup Website</p>
<img ng-hide="cyberpanelLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Website</p>
</div>
<div>
<select ng-change="fetchDetails()" ng-model="websiteToBeBacked"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in websiteList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="destination">
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Destination</p>
</div>
<div>
<select ng-change="destinationSelection()" ng-model="backupDestinations"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in destinations %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Backup Content</p>
</div>
<div>
<label>
<input ng-model="websiteData" type="checkbox" value="">
Data
</label>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<label>
<input ng-model="websiteDatabases" type="checkbox" value="">
Databases
</label>
</div>
</div>
<div class="flex px-6">
<div>
<p class="font-semibold w-60"></p>
</div>
<div>
<label>
<input ng-model="websiteEmails" type="checkbox" value="">
Emails
</label>
</div>
</div>
</div>
<div ng-hide="runningBackup" class="border">
<div>
<div>
<textarea ng-model="status" class="w-full" rows="10"></textarea>
</div>
</div>
</div>
<div ng-hide="backupButton">
<div class="flex justify-center mt-6 mb-2">
<button ng-click="createBackup()"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Create Backup
</button>
</div>
</div>
<div class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
ID
</th>
<th scope="col" class="px-6 py-3">
Date
</th>
<th scope="col" class="px-6 py-3">
Restore
</th>
<th scope="col" class="px-6 py-3">
Delete
</th>
</tr>
</thead>
<tbody ng-repeat="record in records track by $index"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.id" class="px-6 py-4">
</td>
<td ng-bind="record.date" class="px-6 py-4">
</td>
<td class="px-6 py-4">
Restore
</td>
<td ng-click="deleteBackup(record.id)" class="px-6 py-4">
<img class="ml-2 cursor-pointer" src="{% static 'images/delete.png' %}">
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,156 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="incrementalDestinationsV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Set up Incremental Backup Destinations -</p>
<a target="_blank"
href="https://cyberpanel.net/docs/1-add-remove-destinations-for-incremental-backups/"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Remote Backups" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">On this page you can set up your Backup destinations. (SFTP
and AWS)
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Set up Backup Destinations.</p>
<img ng-hide="cyberpanelLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Type</p>
</div>
<div>
<select ng-change="fetchDetails()" ng-model="destinationType"
class="w-80 bg-gray-100 rounded px-2 py-1">
{# <option>SFTP</option>#}
<option>AWS</option>
</select>
</div>
</div>
<div>
<div ng-hide="sftpHide" class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">IP Address</p>
</div>
<div>
<input type="text" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="IPAddress" required>
</div>
</div>
<div ng-hide="sftpHide" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Password</p>
</div>
<div>
<input placeholder="" type="password" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="password"
required>
</div>
</div>
<div ng-hide="sftpHide" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Port</p>
</div>
<div>
<input placeholder="{% trans "Backup server SSH Port, leave empty for 22." %}"
type="text" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="backupSSHPort" required>
</div>
</div>
<div ng-hide="sftpHide">
<div class="flex justify-center mt-6 mb-2">
<button ng-click="addDestination('SFTP')"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Add Destination
</button>
</div>
</div>
</div>
<div ng-hide="sftpHide" class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
IP
</th>
<th scope="col" class="px-6 py-3">
Port
</th>
<th scope="col" class="px-6 py-3">
Delete
</th>
</tr>
</thead>
<tbody ng-repeat="record in records track by $index"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.ip" class="px-6 py-4">
</td>
<td ng-bind="record.port" class="px-6 py-4">
</td>
<td ng-click="removeDestination('SFTP',record.ip)" class="px-6 py-4">
<img class="ml-2 cursor-pointer" src="{% static 'images/delete.png' %}">
</td>
</tr>
</tbody>
</table>
</div>
<div ng-hide="awsHide" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">AWS_ACCESS_KEY_ID</p>
</div>
<div>
<input type="text" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="AWS_ACCESS_KEY_ID" required>
</div>
</div>
<div ng-hide="awsHide" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">AWS_SECRET_ACCESS_KEY</p>
</div>
<div>
<input placeholder="" type="password" class="w-80 bg-gray-100 rounded px-2 py-1"
ng-model="AWS_SECRET_ACCESS_KEY" required>
</div>
</div>
<div ng-hide="awsHide">
<div class="flex justify-center mt-6 mb-2">
<button ng-click="addDestination('AWS')"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Add Destination
</button>
</div>
</div>
<div ng-hide="awsHide" class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
AWS_ACCESS_KEY_ID
</th>
<th scope="col" class="px-6 py-3">
Delete
</th>
</tr>
</thead>
<tbody ng-repeat="record in records track by $index"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.AWS_ACCESS_KEY_ID" class="px-6 py-4">
</td>
<td ng-click="removeDestination('AWS', record.AWS_ACCESS_KEY_ID)" class="px-6 py-4">
<img class="ml-2 cursor-pointer" src="{% static 'images/delete.png' %}">
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,125 @@
{% extends "baseTemplate/newBase.html" %}
{% load i18n %}
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block newContent %}
{% load static %}
<div ng-controller="restoreRemoteBackupsIncV2" class="p-8">
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
<div class="flex items-center">
<p class="text-4xl font-bold">Restore Remote Incremental Backups -</p>
<a target="_blank"
href="https://cyberpanel.net/docs/3-restore-backups-from-remote-destination/"
style="height: 23px;line-height: 21px;"
class="bg-blue-200 px-2 font-bold mt-2 ml-3"
title=""><span>{% trans "Backup Docs" %}</span></a>
</div>
</div>
<p class="text-xs text-gray-600 py-2 font-semibold">This page can be used to restore remote incremental backups
for your websites.
</p>
<div class="flex items-center py-4">
<p class="text-xl font-bold">Backup Website</p>
<img ng-hide="cyberpanelLoading"
src="{% static 'images/loading.gif' %}">
</div>
<hr>
<div class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Select Website</p>
</div>
<div>
<select ng-change="showThings()" ng-model="websiteToBeBacked"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in websiteList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div>
<div ng-hide="destination" class="flex mt-4 py-2 px-6">
<div>
<p class="font-semibold w-60">Destination</p>
</div>
<div>
<select ng-model="backupDestinations"
class="w-80 bg-gray-100 rounded px-2 py-1">
{% for items in destinations %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="destination" class="flex mt-4 px-6">
<div>
<p class="font-semibold w-60">Encrypted Backup Password</p>
</div>
<div>
<input type="password" name="password" class="w-80 bg-gray-100 rounded px-2 py-1"
ng-model="password"
required>
</div>
</div>
<div ng-hide="destination">
<div class="flex justify-center mt-6 mb-2">
<button ng-click="fetchDetails()"
class="bg-orange-500 text-white font-bold px-4 py-2 text-xl">
Fetch Restore Points
</button>
<img ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
</div>
</div>
</div>
<div ng-hide="runningBackup" class="form-group">
<div class="border">
<div class="col-sm-12">
<textarea ng-model="status" class="w-full" rows="10"></textarea>
</div>
</div>
</div>
<div class="relative py-5 overflow-x-auto">
<table class="w-full text-sm text-left rtl:text-right">
<thead>
<tr class="bg-gray-200 mt-6 w-full rounded-t-lg border-b-2 border-gray-400">
<th scope="col" class="px-6 py-3">
Snapshot ID
</th>
<th scope="col" class="px-6 py-3">
Date
</th>
<th scope="col" class="px-6 py-3">
Host
</th>
<th scope="col" class="px-6 py-3">
Path
</th>
<th scope="col" class="px-6 py-3">
Actions
</th>
</tr>
</thead>
<tbody ng-repeat="web in WebSitesList | filter:accountsSearch"
class="border shadow-lg py-3 px-6 rounded-b-lg">
<tr>
<td ng-bind="record.id" class="px-6 py-4">
</td>
<td ng-bind="record.date" class="px-6 py-4">
</td>
<td ng-bind="record.host" class="px-6 py-4">
</td>
<td ng-bind="record.path" class="px-6 py-4">
</td>
<td class="px-6 py-4">
<a ng-click="restorePoint(record.id, record.path)"
class=""
title=""><span>Restore</span></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -3,8 +3,11 @@ from . import views
urlpatterns = [
url(r'^createBackup$', views.create_backup, name='createBackupInc'),
url(r'^V2/createBackupV2$', views.create_backupV2, name='createBackupIncV2'),
url(r'^restoreRemoteBackups$', views.restore_remote_backups, name='restoreRemoteBackupsInc'),
url(r'^V2/restoreRemoteBackupsV2$', views.restore_remote_backupsV2, name='restoreRemoteBackupsIncV2'),
url(r'^backupDestinations$', views.backup_destinations, name='backupDestinationsInc'),
url(r'^V2/backupDestinationsV2$', views.backup_destinationsV2, name='backupDestinationsIncV2'),
url(r'^addDestination$', views.add_destination, name='addDestinationInc'),
url(r'^populateCurrentRecords$', views.populate_current_records, name='populateCurrentRecordsInc'),
url(r'^removeDestination$', views.remove_destination, name='removeDestinationInc'),
@@ -15,6 +18,7 @@ urlpatterns = [
url(r'^fetchRestorePoints$', views.fetch_restore_points, name='fetchRestorePointsInc'),
url(r'^restorePoint$', views.restore_point, name='restorePointInc'),
url(r'^scheduleBackups$', views.schedule_backups, name='scheduleBackupsInc'),
url(r'^V2/scheduleBackupsV2$', views.schedule_backupsV2, name='scheduleBackupsIncV2'),
url(r'^submitBackupSchedule$', views.submit_backup_schedule, name='submitBackupScheduleInc'),
url(r'^scheduleDelete$', views.schedule_delete, name='scheduleDeleteInc'),
url(r'^getCurrentBackupSchedules$', views.get_current_backup_schedules, name='getCurrentBackupSchedulesInc'),
@@ -24,7 +28,9 @@ urlpatterns = [
url(r'^addWebsite$', views.add_website, name='addWebsite'),
### V2 Backups URls
url(r'^CreateV2Backup$', views.CreateV2Backup, name='CreateV2Backup'),
url(r'^V2/CreateV2BackupV2$', views.CreateV2BackupV2, name='CreateV2BackupV2'),
url(r'^ConfigureV2Backup$', views.ConfigureV2Backup, name='ConfigureV2Backup'),
url(r'^V2/ConfigureV2BackupV2$', views.ConfigureV2BackupV2, name='ConfigureV2BackupV2'),
url(r'^ConfigureV2BackupSetup$', views.ConfigureV2BackupSetup, name='ConfigureV2BackupSetup'),
url(r'^RestoreV2backupSite$', views.RestoreV2backupSite, name='RestoreV2backupSite'),
url(r'^selectwebsiteRetorev2$', views.selectwebsiteRetorev2, name='selectwebsiteRetorev2'),
@@ -36,7 +42,8 @@ urlpatterns = [
url(r'^ConfigureSftpV2Backup$', views.ConfigureSftpV2Backup, name='ConfigureSftpV2Backup'),
url(r'^schedulev2Backups$', views.schedulev2Backups, name='schedulev2Backups'),
url(r'^V2/schedulev2BackupsV2$', views.schedulev2BackupsV2, name='schedulev2BackupsV2'),
url(r'^DeleteScheduleV2$', views.DeleteScheduleV2, name='DeleteScheduleV2'),
url(r'^CreateScheduleV2$', views.CreateScheduleV2, name='CreateScheduleV2'),
]
]

View File

@@ -23,8 +23,6 @@ from .IncBackupsControl import IncJobs
from .models import IncJob, BackupJob, JobSites
def def_renderer(request, templateName, args, context=None):
proc = httpProc(request, templateName,
args, context)
@@ -53,10 +51,7 @@ def _get_user_acl(request):
return user_id, current_acl
def create_backup(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
@@ -73,6 +68,23 @@ def create_backup(request):
return redirect(loadLoginPage)
def create_backupV2(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
return ACLManager.loadError()
websites = ACLManager.findAllSites(current_acl, user_id)
destinations = _get_destinations(local=True)
return def_renderer(request, 'IncBackups/createBackupV2.html',
{'websiteList': websites, 'destinations': destinations}, 'createBackup')
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def backup_destinations(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -85,6 +97,18 @@ def backup_destinations(request):
return redirect(loadLoginPage)
def backup_destinationsV2(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'addDeleteDestinations') == 0:
return ACLManager.loadError()
return def_renderer(request, 'IncBackups/incrementalDestinationsV2.html', {}, 'addDeleteDestinations')
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def add_destination(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -219,6 +243,7 @@ def populate_current_records(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def remove_destination(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -246,6 +271,7 @@ def remove_destination(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def fetch_current_backups(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -291,6 +317,7 @@ def fetch_current_backups(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def submit_backup_creation(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -329,6 +356,7 @@ def submit_backup_creation(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def get_backup_status(request):
try:
data = json.loads(request.body)
@@ -392,6 +420,7 @@ def get_backup_status(request):
logging.writeToFile(str(msg) + " [backupStatus]")
return HttpResponse(final_json)
def delete_backup(request):
try:
@@ -422,6 +451,7 @@ def delete_backup(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def fetch_restore_points(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -456,6 +486,7 @@ def fetch_restore_points(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def restore_point(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -519,6 +550,23 @@ def schedule_backups(request):
return redirect(loadLoginPage)
def schedule_backupsV2(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'scheduleBackups') == 0:
return ACLManager.loadError()
websites = ACLManager.findAllSites(current_acl, user_id)
destinations = _get_destinations(local=True)
return def_renderer(request, 'IncBackups/backupScheduleV2.html',
{'websiteList': websites, 'destinations': destinations}, 'scheduleBackups')
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def submit_backup_schedule(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -638,6 +686,23 @@ def restore_remote_backups(request):
return redirect(loadLoginPage)
def restore_remote_backupsV2(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
return ACLManager.loadError()
websites = ACLManager.findAllSites(current_acl, user_id)
destinations = _get_destinations()
return def_renderer(request, 'IncBackups/restoreRemoteBackupsV2.html',
{'websiteList': websites, 'destinations': destinations}, 'createBackup')
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def save_changes(request):
try:
user_id, current_acl = _get_user_acl(request)
@@ -712,6 +777,7 @@ def add_website(request):
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
#### Backups v2
def ConfigureV2Backup(request):
@@ -729,18 +795,44 @@ def ConfigureV2Backup(request):
websites = ACLManager.findAllSites(current_acl, user_id)
#
# destinations = _get_destinations(local=True)
proc = httpProc(request, 'IncBackups/ConfigureV2Backup.html', {'websiteList': websites, 'BackupStat': BackupStat})
proc = httpProc(request, 'IncBackups/ConfigureV2Backup.html',
{'websiteList': websites, 'BackupStat': BackupStat})
return proc.render()
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def ConfigureV2BackupV2(request):
try:
user_id, current_acl = _get_user_acl(request)
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
return ACLManager.loadError()
if ACLManager.CheckForPremFeature('all'):
BackupStat = 1
else:
BackupStat = 0
websites = ACLManager.findAllSites(current_acl, user_id)
#
# destinations = _get_destinations(local=True)
proc = httpProc(request, 'IncBackups/ConfigureV2BackupV2.html',
{'websiteList': websites, 'BackupStat': BackupStat})
return proc.render()
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
def ConfigureV2BackupSetup(request):
try:
userID = request.session['userID']
req_data={}
req_data = {}
req_data['name'] = 'GDrive'
req_data['token'] = request.GET.get('t')
req_data['refresh_token'] = request.GET.get('r')
@@ -754,7 +846,6 @@ def ConfigureV2BackupSetup(request):
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
if ACLManager.checkOwnership(website, admin, currentACL) == 1:
pass
else:
@@ -769,9 +860,10 @@ def ConfigureV2BackupSetup(request):
return ConfigureV2Backup(request)
except BaseException as msg:
logging.writeToFile("Error configure"+str(msg))
logging.writeToFile("Error configure" + str(msg))
return redirect(loadLoginPage)
def CreateV2Backup(request):
try:
userID = request.session['userID']
@@ -780,6 +872,16 @@ def CreateV2Backup(request):
except KeyError:
return redirect(loadLoginPage)
def CreateV2BackupV2(request):
try:
userID = request.session['userID']
bm = BackupManager()
return bm.CreateV2backupSiteV2(request, userID)
except KeyError:
return redirect(loadLoginPage)
def CreateV2BackupButton(request):
try:
userID = request.session['userID']
@@ -787,7 +889,6 @@ def CreateV2BackupButton(request):
Selectedwebsite = data['Selectedwebsite']
Selectedrepo = data['Selectedrepo']
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
@@ -796,7 +897,6 @@ def CreateV2BackupButton(request):
else:
return ACLManager.loadError()
extra_args = {}
extra_args['function'] = 'InitiateBackup'
extra_args['website'] = Selectedwebsite
@@ -816,7 +916,7 @@ def CreateV2BackupButton(request):
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', }
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -825,6 +925,7 @@ def CreateV2BackupButton(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def CreateV2BackupStatus(request):
try:
userID = request.session['userID']
@@ -833,6 +934,7 @@ def CreateV2BackupStatus(request):
except KeyError:
return redirect(loadLoginPage)
def RestoreV2backupSite(request):
try:
userID = request.session['userID']
@@ -841,6 +943,7 @@ def RestoreV2backupSite(request):
except KeyError:
return redirect(loadLoginPage)
def RestorePathV2(request):
try:
userID = request.session['userID']
@@ -870,14 +973,13 @@ def RestorePathV2(request):
# extra_args['BackupEmails'] = data['websiteEmails'] if 'websiteEmails' in data else False
# extra_args['BackupDatabase'] = data['websiteDatabases'] if 'websiteDatabases' in data else False
background = CPBackupsV2(extra_args)
background.start()
# vm = CPBackupsV2({'domain': Selectedwebsite, 'BackendName': Selectedrepo, "function": "", 'BasePath': '/home/backup'})
# status = vm.InitiateRestore(SnapShotId, Path)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', }
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -886,6 +988,7 @@ def RestorePathV2(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def selectwebsiteRetorev2(request):
import re
try:
@@ -901,11 +1004,11 @@ def selectwebsiteRetorev2(request):
else:
return ACLManager.loadError()
obj = Websites.objects.get(domain = str(Selectedwebsite))
#/home/cyberpanel.net/.config/rclone/rclone.conf
path = '/home/%s/.config/rclone/rclone.conf' %(obj.domain)
obj = Websites.objects.get(domain=str(Selectedwebsite))
# /home/cyberpanel.net/.config/rclone/rclone.conf
path = '/home/%s/.config/rclone/rclone.conf' % (obj.domain)
command = 'cat %s'%(path)
command = 'cat %s' % (path)
result = pu.outputExecutioner(command)
if result.find('type') > -1:
@@ -917,7 +1020,6 @@ def selectwebsiteRetorev2(request):
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': 'Could not Find repo'})
return HttpResponse(final_json)
# final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": 1})
# return HttpResponse(final_json)
except BaseException as msg:
@@ -925,6 +1027,7 @@ def selectwebsiteRetorev2(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def ConfigureSftpV2Backup(request):
try:
userID = request.session['userID']
@@ -949,7 +1052,6 @@ def ConfigureSftpV2Backup(request):
req_data['password'] = sfptpasswd
req_data['Repo_Name'] = Repo_Name
cpbuv2 = CPBackupsV2(
{'domain': Selectedwebsite, 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
'BackupEmails': 1, 'BackendName': 'SFTP', 'function': None})
@@ -967,6 +1069,7 @@ def ConfigureSftpV2Backup(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def selectwebsiteCreatev2(request):
import re
try:
@@ -982,16 +1085,15 @@ def selectwebsiteCreatev2(request):
else:
return ACLManager.loadError()
obj = Websites.objects.get(domain = str(Selectedwebsite))
#/home/cyberpanel.net/.config/rclone/rclone.conf
path = '/home/%s/.config/rclone/rclone.conf' %(obj.domain)
obj = Websites.objects.get(domain=str(Selectedwebsite))
# /home/cyberpanel.net/.config/rclone/rclone.conf
path = '/home/%s/.config/rclone/rclone.conf' % (obj.domain)
command = 'cat %s'%(path)
command = 'cat %s' % (path)
CurrentContent = pu.outputExecutioner(command)
status, currentSchedules = CPBackupsV2.FetchCurrentSchedules(str(Selectedwebsite))
if CurrentContent.find('No such file or directory') > -1:
LocalRclonePath = f'/home/{obj.domain}/.config/rclone'
command = f'mkdir -p {LocalRclonePath}'
@@ -1010,7 +1112,8 @@ def selectwebsiteCreatev2(request):
if result.find('type') > -1:
pattern = r'\[(.*?)\]'
matches = re.findall(pattern, result)
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": matches, 'currentSchedules': currentSchedules})
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": matches,
'currentSchedules': currentSchedules})
return HttpResponse(final_json)
else:
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': 'Could not Find repo'})
@@ -1022,13 +1125,14 @@ def selectwebsiteCreatev2(request):
if result.find('type') > -1:
pattern = r'\[(.*?)\]'
matches = re.findall(pattern, result)
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": matches, 'currentSchedules': currentSchedules})
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": matches,
'currentSchedules': currentSchedules})
return HttpResponse(final_json)
else:
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': 'Could not Find repo', 'currentSchedules': currentSchedules})
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': 'Could not Find repo',
'currentSchedules': currentSchedules})
return HttpResponse(final_json)
# logging.writeToFile(str(CurrentContent))
# final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": None})
# return HttpResponse(final_json)
@@ -1040,12 +1144,13 @@ def selectwebsiteCreatev2(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def selectreporestorev2(request):
try:
userID = request.session['userID']
data = json.loads(request.body)
Selectedrepo = data['Selectedrepo']
Selectedwebsite= data['Selectedwebsite']
Selectedwebsite = data['Selectedwebsite']
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
@@ -1054,12 +1159,11 @@ def selectreporestorev2(request):
else:
return ACLManager.loadError()
# f'rustic -r testremote snapshots --password "" --json 2>/dev/null'
# final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': Selectedrepo })
# return HttpResponse(final_json)
vm = CPBackupsV2({'domain': Selectedwebsite, 'BackendName': Selectedrepo, "function":""})
vm = CPBackupsV2({'domain': Selectedwebsite, 'BackendName': Selectedrepo, "function": ""})
status, data = vm.FetchSnapShots()
if status == 1:
@@ -1067,7 +1171,7 @@ def selectreporestorev2(request):
return HttpResponse(final_json)
else:
# final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': ac,})
final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': 'Cannot Find!',})
final_json = json.dumps({'status': 0, 'fetchStatus': 1, 'error_message': 'Cannot Find!', })
return HttpResponse(final_json)
@@ -1076,6 +1180,7 @@ def selectreporestorev2(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def schedulev2Backups(request):
try:
userID = request.session['userID']
@@ -1084,6 +1189,16 @@ def schedulev2Backups(request):
except KeyError:
return redirect(loadLoginPage)
def schedulev2BackupsV2(request):
try:
userID = request.session['userID']
bm = BackupManager()
return bm.schedulev2BackupsV2(request, userID)
except KeyError:
return redirect(loadLoginPage)
def DeleteScheduleV2(request):
try:
userID = request.session['userID']
@@ -1103,8 +1218,8 @@ def DeleteScheduleV2(request):
else:
return ACLManager.loadError()
status, message = CPBackupsV2.DeleteSchedule(Selectedwebsite, repo, frequency, websiteData, websiteDatabases, websiteEmails)
status, message = CPBackupsV2.DeleteSchedule(Selectedwebsite, repo, frequency, websiteData, websiteDatabases,
websiteEmails)
final_dic = {'status': 1, 'error_message': message}
final_json = json.dumps(final_dic)
@@ -1119,6 +1234,7 @@ def DeleteScheduleV2(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
def CreateScheduleV2(request):
try:
userID = request.session['userID']
@@ -1144,8 +1260,8 @@ def CreateScheduleV2(request):
else:
return ACLManager.loadError()
status, message = CPBackupsV2.CreateScheduleV2(Selectedwebsite, repo, frequency, websiteData, websiteDatabases, websiteEmails, retention)
status, message = CPBackupsV2.CreateScheduleV2(Selectedwebsite, repo, frequency, websiteData, websiteDatabases,
websiteEmails, retention)
final_dic = {'status': 1, 'error_message': message}
final_json = json.dumps(final_dic)
@@ -1158,4 +1274,4 @@ def CreateScheduleV2(request):
except BaseException as msg:
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
return HttpResponse(final_json)