dns replication

This commit is contained in:
usmannasir
2019-02-04 01:03:18 +05:00
parent 095fa6743b
commit 75c9ef9da9
51 changed files with 1230 additions and 634 deletions

View File

@@ -15,6 +15,7 @@ from models import Domains,Records
from re import match,I,M
from plogical.mailUtilities import mailUtilities
from plogical.acl import ACLManager
from manageServices.models import PDNSStatus
class DNSManager:
@@ -56,7 +57,16 @@ class DNSManager:
secondNSIP = data['secondNSIP']
if Domains.objects.filter(name=domainForNS).count() == 0:
try:
pdns = PDNSStatus.objects.get(pk=1)
if pdns.type == 'MASTER':
newZone = Domains(admin=admin, name=domainForNS, type="MASTER")
else:
newZone = Domains(admin=admin, name=domainForNS, type="NATIVE")
except:
newZone = Domains(admin=admin, name=domainForNS, type="NATIVE")
newZone.save()
content = "ns1." + domainForNS + " hostmaster." + domainForNS + " 1 10800 3600 604800 3600"

View File

@@ -1,10 +1,3 @@
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from __future__ import unicode_literals
from django.db import models
@@ -91,10 +84,3 @@ class Tsigkeys(models.Model):
class Meta:
db_table = 'tsigkeys'
unique_together = (('name', 'algorithm'),)
class DNSMaster:
type = models.CharField(max_length=5, default='NATIVE')
allow_axfr_ips = models.CharField(max_length=500, default='')
also_notify = models.CharField(max_length=500, default='')

View File

@@ -4,3 +4,9 @@ from __future__ import unicode_literals
from django.db import models
# Create your models here.
class PDNSStatus(models.Model):
serverStatus = models.IntegerField(default=1)
type = models.CharField(max_length=6, default='NATIVE')
allow_axfr_ips = models.CharField(max_length=500, default='')
also_notify = models.CharField(max_length=500, default='')

View File

@@ -0,0 +1,87 @@
import subprocess, shlex
from random import randint
from plogical.processUtilities import ProcessUtilities
class ServiceManager:
def __init__(self, extraArgs):
self.extraArgs = extraArgs
def managePDNS(self):
type = self.extraArgs['type']
path = '/etc/pdns/pdns.conf'
data = subprocess.check_output(shlex.split('sudo cat ' + path)).splitlines()
if type == 'MASTER':
counter = 0
slaveIPData = self.extraArgs['slaveIPData']
ipsString = slaveIPData.replace(',', '/32,')
for items in data:
if items.find('allow-axfr-ips') > -1:
data[counter] = '#' + data[counter]
if items.find('also-notify') > -1:
data[counter] = '#' + data[counter]
if items.find('daemon=') > -1:
data[counter] = '#' + data[counter]
if items.find('disable-axfr') > -1:
data[counter] = '#' + data[counter]
if items.find('slave') > -1:
data[counter] = '#' + data[counter]
counter = counter + 1
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')
for items in data:
writeToFile.writelines(items + '\n')
writeToFile.writelines('allow-axfr-ips=' + ipsString + '\n')
writeToFile.writelines('also-notify=' + slaveIPData + '\n')
writeToFile.writelines('daemon=no\n')
writeToFile.writelines('disable-axfr=no\n')
writeToFile.writelines('master=yes\n')
writeToFile.close()
else:
counter = 0
for items in data:
if items.find('allow-axfr-ips') > -1:
data[counter] = '#' + data[counter]
if items.find('also-notify') > -1:
data[counter] = '#' + data[counter]
if items.find('daemon=') > -1:
data[counter] = '#' + data[counter]
if items.find('disable-axfr') > -1:
data[counter] = '#' + data[counter]
if items.find('slave') > -1:
data[counter] = '#' + data[counter]
counter = counter + 1
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')
for items in data:
writeToFile.writelines(items + '\n')
writeToFile.writelines('slave=yes\n')
writeToFile.writelines('daemon=no\n')
writeToFile.close()
command = 'sudo mv ' + tempPath + ' ' + path
ProcessUtilities.executioner(command)

View File

@@ -5,22 +5,23 @@
/* Java script code */
app.controller('powerDNS', function($scope, $http, $timeout, $window) {
app.controller('powerDNS', function ($scope, $http, $timeout, $window) {
$scope.pdnsLoading = true;
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
$scope.slaveIPs = true;
var pdnsStatus = false;
$('#pdnsStatus').change(function() {
$('#pdnsStatus').change(function () {
pdnsStatus = $(this).prop('checked');
});
fetchPDNSStatus('powerdns');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.pdnsLoading = false;
@@ -29,30 +30,32 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.pdnsLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#pdnsStatus').bootstrapToggle('on');
}
}else{
$scope.slaveIPData = response.data.slaveIPData;
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -62,6 +65,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.pdnsLoading = true;
$scope.failedToFetch = true;
@@ -71,7 +75,6 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
$scope.saveStatus = function (service) {
$scope.pdnsLoading = false;
@@ -80,36 +83,43 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
if (service === 'powerdns') {
var data = {
status:pdnsStatus,
status: pdnsStatus,
service: service,
dnsMode: $scope.dnsMode,
slaveIPData: $scope.slaveIPData
};
}else {
var data = {
status: pdnsStatus,
service: service
};
}
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.pdnsLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -118,6 +128,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.policyServerLoading = true;
$scope.failedToFetch = true;
@@ -128,6 +139,15 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
};
$scope.modeChange = function () {
if ($scope.dnsMode === 'MASTER') {
$scope.slaveIPs = false;
} else {
$scope.slaveIPs = true;
}
}
});
@@ -137,7 +157,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
/* Java script code */
app.controller('postfix', function($scope, $http, $timeout, $window) {
app.controller('postfix', function ($scope, $http, $timeout, $window) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -148,12 +168,12 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
var serviceStatus = false;
$('#serviceStatus').change(function() {
$('#serviceStatus').change(function () {
serviceStatus = $(this).prop('checked');
});
fetchPDNSStatus('postfix');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.serviceLoading = false;
@@ -162,30 +182,30 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#serviceStatus').bootstrapToggle('on');
}
}else{
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -195,6 +215,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -213,36 +234,34 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
var data = {
status:serviceStatus,
status: serviceStatus,
service: service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -251,6 +270,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -268,7 +288,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
/* Java script code */
app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
app.controller('pureFTPD', function ($scope, $http, $timeout, $window) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -279,12 +299,12 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
var serviceStatus = false;
$('#serviceStatus').change(function() {
$('#serviceStatus').change(function () {
serviceStatus = $(this).prop('checked');
});
fetchPDNSStatus('pureftpd');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.serviceLoading = false;
@@ -293,30 +313,30 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#serviceStatus').bootstrapToggle('on');
}
}else{
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -326,6 +346,7 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -344,36 +365,34 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
var data = {
status:serviceStatus,
status: serviceStatus,
service: service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -382,6 +401,7 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;

View File

@@ -3,16 +3,19 @@
{% block title %}{% trans "Manage PowerDNS - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Manage PowerDNS!" %} - <a target="_blank" href="https://go.cyberpanel.net/manage-services" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Services Docs" %}</span></a> </h2>
<div class="container">
<div id="page-title">
<h2>{% trans "Manage PowerDNS!" %} - <a target="_blank" href="https://go.cyberpanel.net/manage-services"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Services Docs" %}</span></a></h2>
<p>{% trans "Enable or disable DNS services. " %}</p>
</div>
</div>
{% if status %}
@@ -35,10 +38,29 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Function Mode" %}</label>
<div class="col-sm-6">
<select ng-change="modeChange()" ng-model="dnsMode" class="form-control">
<option>MASTER</option>
<option>SLAVE</option>
</select>
</div>
<div class="current-pack">{% trans 'Default is Slave Mode' %}</div>
</div>
<div ng-hide="slaveIPs" class="form-group">
<label class="col-sm-3 control-label">{% trans "Slave IPs" %}</label>
<div class="col-sm-6">
<input placeholder="Comma separated listed of Slave Server IPs." type="text" class="form-control" ng-model="slaveIPData" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-click="saveStatus('powerdns')" class="btn btn-primary btn-lg">{% trans "Save changes" %}</button>
<button type="button" ng-click="saveStatus('powerdns')"
class="btn btn-primary btn-lg">{% trans "Save changes" %}</button>
</div>
</div>
@@ -67,7 +89,6 @@
</div>
</div>
</div>
</div>
@@ -82,7 +103,7 @@
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -10,11 +10,11 @@ import json
from plogical.mailUtilities import mailUtilities
import subprocess, shlex
from plogical.acl import ACLManager
from models import PDNSStatus
from .serviceManager import ServiceManager
# Create your views here.
# Create your views here.
def managePowerDNS(request):
try:
userID = request.session['userID']
@@ -90,12 +90,18 @@ def fetchStatus(request):
service = data['service']
if service == 'powerdns':
if os.path.exists('/home/cyberpanel/powerdns'):
data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
else:
data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 0}
data_ret = {}
data_ret['status'] = 1
try:
pdns = PDNSStatus.objects.get(pk=1)
data_ret['installCheck'] = pdns.serverStatus
data_ret['slaveIPData'] = pdns.also_notify
except:
PDNSStatus(serverStatus=1).save()
data_ret['installCheck'] = 0
data_ret['slaveIPData'] = ''
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -151,26 +157,40 @@ def saveStatus(request):
if service == 'powerdns':
servicePath = '/home/cyberpanel/powerdns'
if status == True:
writeToFile = open(servicePath, 'w+')
writeToFile.close()
pdns = PDNSStatus.objects.get(pk=1)
pdns.serverStatus = 1
pdns.allow_axfr_ips = data['slaveIPData'].replace(',', '/32,')
pdns.also_notify = data['slaveIPData']
pdns.type = data['dnsMode']
pdns.save()
extraArgs = {}
extraArgs['type'] = data['dnsMode']
extraArgs['slaveIPData'] = data['slaveIPData']
sm = ServiceManager(extraArgs)
sm.managePDNS()
command = 'sudo systemctl start pdns'
subprocess.call(shlex.split(command))
command = 'sudo systemctl enable pdns'
subprocess.call(shlex.split(command))
else:
pdns = PDNSStatus.objects.get(pk=1)
pdns.serverStatus = 0
pdns.save()
command = 'sudo systemctl stop pdns'
subprocess.call(shlex.split(command))
command = 'sudo systemctl disable pdns'
subprocess.call(shlex.split(command))
try:
os.remove(servicePath)
except:
pass
elif service == 'postfix':

View File

@@ -9,6 +9,7 @@ import subprocess
import shlex
from dns.models import Domains,Records
from processUtilities import ProcessUtilities
from manageServices.models import PDNSStatus
class DNS:
@@ -36,7 +37,16 @@ class DNS:
if len(subDomain) == 0:
if Domains.objects.filter(name=topLevelDomain).count() == 0:
try:
pdns = PDNSStatus.objects.get(pk=1)
if pdns.type == 'MASTER':
zone = Domains(admin=admin, name=topLevelDomain, type="MASTER")
else:
zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE")
except:
zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE")
zone.save()
content = "ns1." + topLevelDomain + " hostmaster." + topLevelDomain + " 1 10800 3600 604800 3600"
@@ -155,8 +165,14 @@ class DNS:
record.save()
else:
if Domains.objects.filter(name=topLevelDomain).count() == 0:
try:
pdns = PDNSStatus.objects.get(pk=1)
if pdns.type == 'MASTER':
zone = Domains(admin=admin, name=topLevelDomain, type="MASTER")
else:
zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE")
except:
zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE")
zone.save()
content = "ns1." + topLevelDomain + " hostmaster." + topLevelDomain + " 1 10800 3600 604800 3600"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -169,9 +169,13 @@ app.controller('runContainer', function ($scope, $http) {
};
try {
$.each($scope.portType, function (port, protocol) {
data[port + "/" + protocol] = $scope.eport[port];
});
}
catch (err) {
}
var config = {
headers: {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -2,12 +2,21 @@
width: 25%;
}
#navBar{
/*#navBar{
background: -moz-linear-gradient(#a4dbf5, #8cc5e0);
background: -webkit-linear-gradient(#a4dbf5, #8cc5e0);
background: -o-linear-gradient(#a4dbf5, #8cc5e0);
}*/
#navBar {
background: #0daeff; /* Old browsers */
background: -moz-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3939ad', endColorstr='#0daeff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
.navbar-brand {
margin: 0 1rem 0 1rem;
}
#mainRow{
margin: 1%;
}
@@ -42,3 +51,126 @@
margin-bottom: 2%;
margin-top: 2%;
}
.flex-wrap {
display: flex;
flex-wrap: wrap;
}
.mt-5 {
margin-top: 5px !important;
}
.mt-10 {
margin-top: 10px;
}
.mt-20 {
margin-top: 20px;
}
.mt-30 {
margin-top: 30px;
}
.mr-10 {
margin-right: 10px;
}
.mb-10 {
margin-bottom: 10px;
}
.ml-10 {
margin-left: 10px;
}
.my-10 {
margin-top: 10px;
margin-bottom: 10px;
}
.mx-5 {
margin-left: 5px;
margin-right: 5px;
}
.mx-10 {
margin-left: 10px;
margin-right: 10px;
}
.header-logo {
width: 315px;
/* text-align: center;*/
font-size: 16px;
float: left;
position: relative;
}
a.nav-link {
color: #add8e6;
}
a.nav-link:hover {
color: #E4F2F7;
}
.point-events {
pointer-events: all;
}
.card-header {
padding: .75rem 1.25rem;
margin-bottom: 0;
background-color: transparent;
border-bottom: none;
}
.form-control {
padding: 0 .5rem;
border: 1px solid #eeeeee;
color: #777;
font-size: .95em;
}
.form-control[readonly] {
background-color: transparent;
}
a {
color: #6C6CA4;
text-decoration: none;
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
a:hover {
color: #8989B6;
text-decoration: none;
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
#tableHead {
background: #8989B6;
color: #E1E1EC;
}
.table td, .table th {
padding: .15em;
vertical-align: top;
border-top: 1px solid #e9ecef;
}
.table thead th {
vertical-align: bottom;
border-bottom: 1px solid #e9ecef;
font-weight: 400;
}
.table td {
font-size: 14px;
color: #666666;
}
.list-group-item {
padding: .2em 1.25rem;
}
i.fa.fa-file {
color: #6C6CA4 !important;
}
i.fa.fa-minus {
color: #6C6CA4 !important;
}
i.fa.fa-plus {
color: #6C6CA4 !important;
}
.list-group-item {
background-color: transparent;
}
.bg-lightgray {
background: #F9F9FA;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -711,6 +711,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
function findFileExtension(fileName) {
return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined;
}
$scope.fetchForTableSecondary(null, "startPoint");
// html editor
@@ -1569,5 +1570,3 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -17,8 +17,6 @@ app.controller('sslIssueCtrl', function($scope,$http) {
$scope.issueSSLBtn = false;
};
$scope.issueSSL = function(){
$scope.manageSSLLoading = false;

View File

@@ -5,22 +5,23 @@
/* Java script code */
app.controller('powerDNS', function($scope, $http, $timeout, $window) {
app.controller('powerDNS', function ($scope, $http, $timeout, $window) {
$scope.pdnsLoading = true;
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
$scope.slaveIPs = true;
var pdnsStatus = false;
$('#pdnsStatus').change(function() {
$('#pdnsStatus').change(function () {
pdnsStatus = $(this).prop('checked');
});
fetchPDNSStatus('powerdns');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.pdnsLoading = false;
@@ -29,30 +30,32 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.pdnsLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#pdnsStatus').bootstrapToggle('on');
}
}else{
$scope.slaveIPData = response.data.slaveIPData;
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -62,6 +65,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.pdnsLoading = true;
$scope.failedToFetch = true;
@@ -71,7 +75,6 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
$scope.saveStatus = function (service) {
$scope.pdnsLoading = false;
@@ -80,36 +83,43 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
if (service === 'powerdns') {
var data = {
status:pdnsStatus,
status: pdnsStatus,
service: service,
dnsMode: $scope.dnsMode,
slaveIPData: $scope.slaveIPData
};
}else {
var data = {
status: pdnsStatus,
service: service
};
}
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.pdnsLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -118,6 +128,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.policyServerLoading = true;
$scope.failedToFetch = true;
@@ -128,6 +139,15 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
};
$scope.modeChange = function () {
if ($scope.dnsMode === 'MASTER') {
$scope.slaveIPs = false;
} else {
$scope.slaveIPs = true;
}
}
});
@@ -137,7 +157,7 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) {
/* Java script code */
app.controller('postfix', function($scope, $http, $timeout, $window) {
app.controller('postfix', function ($scope, $http, $timeout, $window) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -148,12 +168,12 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
var serviceStatus = false;
$('#serviceStatus').change(function() {
$('#serviceStatus').change(function () {
serviceStatus = $(this).prop('checked');
});
fetchPDNSStatus('postfix');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.serviceLoading = false;
@@ -162,30 +182,30 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#serviceStatus').bootstrapToggle('on');
}
}else{
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -195,6 +215,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -213,36 +234,34 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
var data = {
status:serviceStatus,
status: serviceStatus,
service: service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -251,6 +270,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -268,7 +288,7 @@ app.controller('postfix', function($scope, $http, $timeout, $window) {
/* Java script code */
app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
app.controller('pureFTPD', function ($scope, $http, $timeout, $window) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -279,12 +299,12 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
var serviceStatus = false;
$('#serviceStatus').change(function() {
$('#serviceStatus').change(function () {
serviceStatus = $(this).prop('checked');
});
fetchPDNSStatus('pureftpd');
function fetchPDNSStatus(service){
function fetchPDNSStatus(service) {
$scope.serviceLoading = false;
@@ -293,30 +313,30 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
url = "/manageservices/fetchStatus";
var data = {
'service' : service
'service': service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
if (response.data.installCheck === 1) {
$('#serviceStatus').bootstrapToggle('on');
}
}else{
} else {
$scope.failedToFetch = false;
$scope.couldNotConnect = true;
$scope.changesApplied = true;
@@ -326,6 +346,7 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;
@@ -344,36 +365,34 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
$scope.changesApplied = true;
url = "/manageservices/saveStatus";
var data = {
status:serviceStatus,
status: serviceStatus,
service: service
};
var config = {
headers : {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.serviceLoading = true;
if(response.data.status === 1){
if (response.data.status === 1) {
$scope.failedToFetch = true;
$scope.couldNotConnect = true;
$scope.changesApplied = false;
}
else{
else {
$scope.errorMessage = response.data.error_message;
$scope.failedToFetch = false;
@@ -382,6 +401,7 @@ app.controller('pureFTPD', function($scope, $http, $timeout, $window) {
}
}
function cantLoadInitialDatas(response) {
$scope.serviceLoading = true;
$scope.failedToFetch = true;

View File

@@ -10,3 +10,230 @@
border-radius: 25px;
border-color:#3498db
}
.table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>th {
color: #777777;
font-weight: 400;
border-color: #cccccc;
border-width: 1px;
background-color: transparent;
}
.table {
font-size: 14px;
width: 100%;
border-spacing: 0;
border-collapse: separate;
border-radius: 5px;
background: #fdfdfd;
padding: 0px 12px;
margin: 10px 12px;
}
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
/* padding: 10px; */
border-top-width: 1px;
border-top-style: solid;
text-align: left;
}
.mt-5 {
margin-top: 5px;
}
.mt-10 {
margin-top: 10px;
}
.mt-20 {
margin-top: 20px;
}
.mt-30 {
margin-top: 30px;
}
.mr-10 {
margin-right: 10px;
}
.mb-10 {
margin-bottom: 10px;
}
.ml-10 {
margin-left: 10px;
}
.my-10 {
margin-top: 10px;
margin-bottom: 10px;
}
.mx-5 {
margin-left: 5px;
margin-right: 5px;
}
.mx-10 {
margin-left: 10px;
margin-right: 10px;
}
.title-hero {
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 0 0 15px;
padding: 0;
text-transform: none;
font-size: 14px;
opacity: 1;
color: #777777;
font-weight: 400;
}
.bs-badge {
font-size: 11px;
font-weight: 400;
line-height: 19px;
display: inline-block;
min-width: 20px;
padding: 0 5px 0 4px;
border-radius: 2px;
}
.row-title {
color: #778899;
}
/*span.h4 {
white-space: nowrap;
}*/
.panel-body {
white-space: nowrap;
}
.bg-gradient-9 {
background: #0daeff; /* Old browsers */
background: -moz-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3939ad', endColorstr='#0daeff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
#page-header .user-account-btn>a.user-profile .glyph-icon, .logo-bg {
background-color: rgba(0,0,0,.15);
}
a:hover {
text-decoration: none;
}
.text-success {
color: #29A329 !important;
}
.alert-success, .alert-success a, .parsley-success {
color: #1e620f;
border-color: #7cd362;
background: #E4FFE4;
}
.flex {
display: flex;
}
.align-center {
margin: 0 auto;
}
.text-bold {
font-weight: 600;
}
.tile-box-shortcut .tile-header {
background: 0 0;
padding: 25px;
position: absolute;
font-size: 18px;
font-weight: 400;
left: 3em;
bottom: 0px;
}
.tile-box-shortcut .tile-content-wrapper>.glyph-icon {
position: absolute;
left: 25px;
top: 40px;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: 2.25em;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: absolute;
left: 25px;
top: 28px;
}
.bs-badge {
font-size: 18px;
font-weight: 100;
line-height: 19px;
display: inline-block;
min-width: 20px;
padding: 0 5px 0 4px;
border-radius: 2px;
color: #afeeee;
}
.tile-box-shortcut .bs-badge {
left: auto;
right: 10px;
top: 30px;
background: transparent;
}
#sidebar-menu {
background: #EAEAF1;
}
#page-sidebar ul li a .glyph-icon {
color: #191970;
}
#header-logo .logo-content-big, .logo-content-small {
height: 40px;
left: 15px;
}
#mobile-navigation .logo-content-small {
width: 50px;
display: block;
left: 75px;
}
#header-nav-left {
margin: 0 20px;
}
#page-content {
background: #ffffff;
}
.service-panel {
background: #A1BDC6 !important;
}
.serviceImg img {
box-shadow: 0 0 2px 1px rgba(0,0,0,.05);
}
.btn-icon {
top: 0px;
left: 0px;
margin: 0px auto;
position: relative;
font-size: 16px;
}
.tab-mod {
color: #777777;
background: transparent;
border-color: #dddddd;
}
.btn-primary {
background: #33ADFF;
border-color: #0099FF;
}
.btn-primary:hover,.btn-primary:focus {
background: #5CBDFF;
border-color: #33ADFF;
}
.btn-min-width {
min-width: 350px;
}

View File

@@ -247,10 +247,8 @@ app.controller('listWebsites', function ($scope, $http) {
}
function cantLoadInitialData(response) {
console.log("not good");
}
$scope.getFurtherWebsitesFromDB = function (pageNumber) {
var config = {
@@ -287,6 +285,58 @@ app.controller('listWebsites', function ($scope, $http) {
}
};
$scope.cyberPanelLoading = true;
$scope.issueSSL = function (virtualHost) {
$scope.cyberPanelLoading = false;
var url = "/manageSSL/issueSSL";
var data = {
virtualHost: virtualHost
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberPanelLoading = true;
if (response.data.SSL === 1) {
new PNotify({
title: 'Success!',
text: 'SSL successfully issued.',
type: 'success'
});
}
else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
};
});