From 0ed7f4184805fc22b88d89856c67b4ee4083a3ee Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 2 Feb 2019 12:44:29 +0530 Subject: [PATCH] web app: implemented import and export UI options for allowed zones and custom blocked zones. Added about tab. --- DnsServerCore/www/css/main.css | 5 ++ DnsServerCore/www/img/logo.png | Bin 0 -> 325 bytes DnsServerCore/www/index.html | 86 +++++++++++++++++++++++++++- DnsServerCore/www/js/main.js | 101 +++++++++++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 DnsServerCore/www/img/logo.png diff --git a/DnsServerCore/www/css/main.css b/DnsServerCore/www/css/main.css index 9c14d155..101fdc46 100644 --- a/DnsServerCore/www/css/main.css +++ b/DnsServerCore/www/css/main.css @@ -281,3 +281,8 @@ label { font-size: 12px; font-weight: bold; } + +.about p { + color: rgb(119, 119, 119); + text-align: center; +} diff --git a/DnsServerCore/www/img/logo.png b/DnsServerCore/www/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1bdbde1a8cc14b2b984322a685d09ff082ee85d5 GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!;4M!V$B+!?x04O|SQL4f-*5fCyjpj;$TSUu z?yZhGYut-Oy-$k#tf^o6W==87JeOJp=3?$M4CY_o9lFD0e86|_ZUcMw1eKmJb8Vh8 zx&m8vMJ6WH{bZhT|7}Whtr&-!)y;(YtW6XB%x~wrAd~5?;rd z9Pb7m3a}F6c-1G=c4?zSK=~AdDd%>xY&r}S+#%d{X{X2uw%=9OQ~Ov$Hmu(s{4&CU z6~sOFlWE3zj>T6~Hy)U45EU!t`M~pm8uuC|^T-6z9WP}XV>j<~(5%1c$+`3FyyEjf PUov>Q`njxgN@xNAP1|}U literal 0 HcmV?d00001 diff --git a/DnsServerCore/www/index.html b/DnsServerCore/www/index.html index 59fadf16..d1bcf05d 100644 --- a/DnsServerCore/www/index.html +++ b/DnsServerCore/www/index.html @@ -98,6 +98,7 @@ +
@@ -610,6 +611,8 @@
technitium.com
+ +
@@ -647,6 +650,8 @@
technitium.com
+ +
@@ -1084,9 +1089,36 @@
- - +
+
+ Technitium Logo +

Technitium DNS Server

+

Version

+

+ Copyright (C) 2019 Shreyas Zare (shreyas@technitium.com)
+ This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.
+

+

Source code available under GNU General Public License v3.0 on  GitHub

+ +

Contact

+

For support, send an email to support@technitium.com.

+

+ Follow @technitium on Twitter.
+ Checkout Technitium Blog. +

+ +

Become A Patron

+

Make contribution to Technitium by becoming a Patron and help making new software, updates, and features possible.

+

+ Become A Patron Now! +

+
+ +
+ + + @@ -1159,6 +1191,56 @@ + + + + \ No newline at end of file diff --git a/DnsServerCore/www/js/main.js b/DnsServerCore/www/js/main.js index 7fe7744e..2dccc8dc 100644 --- a/DnsServerCore/www/js/main.js +++ b/DnsServerCore/www/js/main.js @@ -510,6 +510,7 @@ function loadDnsSettings() { url: "/api/getDnsSettings?token=" + token, success: function (responseJSON) { document.title = "Technitium DNS Server " + responseJSON.response.version + " - " + responseJSON.response.serverDomain; + $("#lblAboutVersion").text(responseJSON.response.version); $("#txtServerDomain").val(responseJSON.response.serverDomain); $("#lblServerDomain").text(" - " + responseJSON.response.serverDomain); @@ -2761,3 +2762,103 @@ function deleteLog() { return false; } + +function resetImportAllowedZonesModal() { + + $("#divImportAllowedZonesAlert").html(""); + $("#txtImportAllowedZones").val(""); + + return false; +} + +function importAllowedZones() { + var divImportAllowedZonesAlert = $("#divImportAllowedZonesAlert"); + var allowedZones = cleanTextList($("#txtImportAllowedZones").val()); + + if ((allowedZones.length === 0) || (allowedZones === ",")) { + showAlert("warning", "Missing!", "Please enter allowed zones to import.", divImportAllowedZonesAlert); + return false; + } + + var btn = $("#btnImportAllowedZones").button('loading'); + + HTTPRequest({ + url: "/api/importAllowedZones?token=" + token, + data: "allowedZones=" + allowedZones, + success: function (responseJSON) { + $("#modalImportAllowedZones").modal("hide"); + btn.button('reset'); + + showAlert("success", "Imported!", "Domain names were imported to allowed zone successfully."); + }, + error: function () { + btn.button('reset'); + }, + invalidToken: function () { + btn.button('reset'); + showPageLogin(); + }, + objAlertPlaceholder: divImportAllowedZonesAlert + }); + + return false; +} + +function exportAllowedZones() { + + window.open("/api/exportAllowedZones?token=" + token, "_blank"); + + showAlert("success", "Exported!", "Allowed zones were exported successfully."); + + return false; +} + +function resetImportCustomBlockedZonesModal() { + + $("#divImportCustomBlockedZonesAlert").html(""); + $("#txtImportCustomBlockedZones").val(""); + + return false; +} + +function importCustomBlockedZones() { + var divImportCustomBlockedZonesAlert = $("#divImportCustomBlockedZonesAlert"); + var blockedZones = cleanTextList($("#txtImportCustomBlockedZones").val()); + + if ((blockedZones.length === 0) || (blockedZones === ",")) { + showAlert("warning", "Missing!", "Please enter custom blocked zones to import.", divImportCustomBlockedZonesAlert); + return false; + } + + var btn = $("#btnImportCustomBlockedZones").button('loading'); + + HTTPRequest({ + url: "/api/importCustomBlockedZones?token=" + token, + data: "blockedZones=" + blockedZones, + success: function (responseJSON) { + $("#modalImportCustomBlockedZones").modal("hide"); + btn.button('reset'); + + showAlert("success", "Imported!", "Domain names were imported to custom blocked zone successfully."); + }, + error: function () { + btn.button('reset'); + }, + invalidToken: function () { + btn.button('reset'); + showPageLogin(); + }, + objAlertPlaceholder: divImportCustomBlockedZonesAlert + }); + + return false; +} + +function exportCustomBlockedZones() { + + window.open("/api/exportCustomBlockedZones?token=" + token, "_blank"); + + showAlert("success", "Exported!", "Custom blocked zones were exported successfully."); + + return false; +} \ No newline at end of file