Skip to content

Commit

Permalink
Website App
Browse files Browse the repository at this point in the history
  • Loading branch information
zarakkhan209 committed Jan 17, 2024
2 parents 367693e + 31a3bfc commit 912746a
Show file tree
Hide file tree
Showing 17 changed files with 2,714 additions and 74 deletions.
15 changes: 8 additions & 7 deletions baseTemplate/templates/baseTemplate/newBase.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
Delete Database</a>
</li>
<li>
<a href="{% url 'phpMyAdminV2 ' %}"
<a href="{% url 'phpMyAdminV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
PHPMYAdmin</a>
</li>
Expand Down Expand Up @@ -593,27 +593,27 @@
Create NameServer</a>
</li>
<li>
<a href="#"
<a href="{% url 'configureDefaultNameServersV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
Create Default NameServer</a>
</li>
<li>
<a href="#"
<a href="{% url 'createDNSZoneV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
Create DNS Zone</a>
</li>
<li>
<a href="#"
<a href="{% url 'deleteDNSZoneV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
Delete Zone</a>
</li>
<li>
<a href="#"
<a href="{% url 'addDeleteDNSRecordsV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
Add/Delete Records</a>
</li>
<li>
<a href="#"
<a href="{% url 'addDeleteDNSRecordsCloudFlareV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
CloudFlare</a>
</li>
Expand Down Expand Up @@ -648,7 +648,7 @@
</div>
<ul id="dropdown-example-7" class="hidden py-2 space-y-2">
<li>
<a href="#"
<a href="{% url 'createEmailAccountV2' %}"
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">
Create Email</a>
</li>
Expand Down Expand Up @@ -1675,6 +1675,7 @@
<script src="{% static 'packages/packagesV2.js' %}"></script>
<script src="{% static 'databases/databasesV2.js' %}"></script>
<script src="{% static 'dns/dnsV2.js' %}"></script>
<script src="{% static 'mailServer/mailServerV2.js' %}"></script>
</body>

</html>
71 changes: 71 additions & 0 deletions dns/dnsManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,19 @@ def addDeleteDNSRecords(self, request=None, userID=None):
proc = httpProc(request, template, finalData, 'addDeleteRecords')
return proc.render()

def addDeleteDNSRecordsV2(self, request=None, userID=None):
currentACL = ACLManager.loadedACL(userID)

if not os.path.exists('/home/cyberpanel/powerdns'):
finalData = {"status": 0}
else:
finalData = {"status": 1}

finalData['domainsList'] = ACLManager.findAllDomains(currentACL, userID)
template = 'dns/addDeleteDNSRecordsV2.html'
proc = httpProc(request, template, finalData, 'addDeleteRecords')
return proc.render()

def getCurrentRecordsForDomain(self, userID=None, data=None):
try:

Expand Down Expand Up @@ -600,6 +613,38 @@ def configureDefaultNameServers(self, request=None, userID=None):
proc = httpProc(request, template, data, 'admin')
return proc.render()

def configureDefaultNameServersV2(self, request=None, userID=None):
currentACL = ACLManager.loadedACL(userID)

if not os.path.exists('/home/cyberpanel/powerdns'):
data = {"status": 0}
else:
data = {"status": 1}

data['domainsList'] = ACLManager.findAllDomains(currentACL, userID)
if os.path.exists(DNSManager.defaultNameServersPath):
nsData = open(DNSManager.defaultNameServersPath, 'r').readlines()
try:
data['firstNS'] = nsData[0].rstrip('\n')
except:
pass
try:
data['secondNS'] = nsData[1].rstrip('\n')
except:
pass
try:
data['thirdNS'] = nsData[2].rstrip('\n')
except:
pass
try:
data['forthNS'] = nsData[3].rstrip('\n')
except:
pass

template = 'dns/configureDefaultNameServersV2.html'
proc = httpProc(request, template, data, 'admin')
return proc.render()

def saveNSConfigurations(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
Expand Down Expand Up @@ -667,6 +712,32 @@ def addDeleteDNSRecordsCloudFlare(self, request=None, userID=None):
proc = httpProc(request, template, data, 'addDeleteRecords')
return proc.render()

def addDeleteDNSRecordsCloudFlareV2(self, request=None, userID=None):
currentACL = ACLManager.loadedACL(userID)
if not os.path.exists('/home/cyberpanel/powerdns'):
status = 0
else:
status = 1
admin = Administrator.objects.get(pk=userID)

CloudFlare = 0

cfPath = '%s%s' % (DNS.CFPath, admin.userName)

if os.path.exists(cfPath):
CloudFlare = 1
domainsList = ACLManager.findAllDomains(currentACL, userID)
self.admin = admin
self.loadCFKeys()
data = {"domainsList": domainsList, "status": status, 'CloudFlare': CloudFlare, 'cfEmail': self.email,
'cfToken': self.key}
else:
data = {"status": status, 'CloudFlare': CloudFlare}

template = 'dns/addDeleteDNSRecordsCloudFlareV2.html'
proc = httpProc(request, template, data, 'addDeleteRecords')
return proc.render()

def saveCFConfigs(self, userID=None, data=None):
try:
cfEmail = data['cfEmail']
Expand Down
Loading

0 comments on commit 912746a

Please sign in to comment.