webapp: ui enhancements done. added OISD block list.

This commit is contained in:
Shreyas Zare
2020-06-20 14:02:35 +05:30
parent 1351c43ca2
commit f88717e731
3 changed files with 57 additions and 6 deletions

View File

@@ -582,6 +582,7 @@
<option>ANY</option>
<option>AXFR</option>
<option>ANAME</option>
<option>FWD</option>
</select>
</div>
@@ -823,6 +824,8 @@
<option value="https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt">Disconnect.me [tracking] (https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt)</option>
<option value="https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt">Disconnect.me [ads] (https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt)</option>
<option value="https://dbl.oisd.nl/">OISD Block List by sjhgvr (https://dbl.oisd.nl/)</option>
</select>
<div style="margin-top: 10px;">Enter block list URL one below another in the above text field or use the Quick Add list to add known block list URLs.</div>
@@ -1726,6 +1729,7 @@
</div>
</div>
<div id="divAddEditRecordDataForwarder" style="display: none;">
<div class="form-group">
<label class="col-sm-4 control-label">Protocol</label>
@@ -1771,7 +1775,6 @@
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" id="btnAddEditRecord" data-loading-text="Saving...">Save</button>

View File

@@ -1,6 +1,6 @@
/*
Technitium DNS Server
Copyright (C) 2019 Shreyas Zare (shreyas@technitium.com)
Copyright (C) 2020 Shreyas Zare (shreyas@technitium.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ function refreshDhcpLeases() {
var tableHtmlRows = "";
for (var i = 0; i < dhcpLeases.length; i++)
tableHtmlRows += "<tr><td>" + htmlEncode(dhcpLeases[i].scope) + "</td><td>" + dhcpLeases[i].hardwareAddress + "</td><td>" + dhcpLeases[i].address + "</td><td><span class=\"label label-default\">" + dhcpLeases[i].type + "</span></td><td>" + htmlEncode(dhcpLeases[i].hostName) + "</td><td>" + dhcpLeases[i].leaseObtained + "</td><td>" + dhcpLeases[i].leaseExpires + "</td></tr>";
tableHtmlRows += "<tr><td>" + htmlEncode(dhcpLeases[i].scope) + "</td><td>" + dhcpLeases[i].hardwareAddress + "</td><td>" + dhcpLeases[i].address + "</td><td><span class=\"label label-" + (dhcpLeases[i].type === "Reserved" ? "default" : "primary") + "\">" + dhcpLeases[i].type + "</span></td><td>" + htmlEncode(dhcpLeases[i].hostName) + "</td><td>" + dhcpLeases[i].leaseObtained + "</td><td>" + dhcpLeases[i].leaseExpires + "</td></tr>";
$("#tableDhcpLeasesBody").html(tableHtmlRows);

View File

@@ -46,6 +46,27 @@ $(function () {
}
});
$("input[type=radio][name=rdAddZoneForwarderProtocol]").change(function () {
var protocol = $('input[name=rdAddZoneForwarderProtocol]:checked').val();
switch (protocol) {
case "Udp":
case "Tcp":
$("#txtAddZoneForwarder").attr("placeholder", "8.8.8.8 or [2620:fe::10]")
break;
case "Tls":
$("#txtAddZoneForwarder").attr("placeholder", "dns.quad9.net (9.9.9.9:853)")
break;
case "Https":
case "HttpsJson":
$("#txtAddZoneForwarder").attr("placeholder", "https://cloudflare-dns.com/dns-query (1.1.1.1)")
break;
}
});
$("input[type=radio][name=rdAddEditRecordDataForwarderProtocol]").change(updateAddEditFormForwarderPlaceholder);
});
function refreshZones(checkDisplay) {
@@ -79,9 +100,9 @@ function refreshZones(checkDisplay) {
var type;
if (zones[i].internal)
type = "Internal";
type = "<span class=\"label label-default\">Internal</span>";
else
type = zones[i].type;
type = "<span class=\"label label-primary\">" + zones[i].type + "</span>";
var status;
if (zones[i].disabled)
@@ -98,7 +119,7 @@ function refreshZones(checkDisplay) {
var isReadOnlyZone = zones[i].internal || (zones[i].type === "Secondary");
tableHtmlRows += "<tr id=\"trZone" + id + "\"><td>" + htmlEncode(name) + "</td>";
tableHtmlRows += "<td><span class=\"label label-default\">" + type + "</span></td>";
tableHtmlRows += "<td>" + type + "</td>";
tableHtmlRows += "<td>" + status + "</td>";
tableHtmlRows += "<td>" + expiry + "</td>";
tableHtmlRows += "<td align=\"right\" style=\"width: 220px;\"><button type=\"button\" class=\"btn btn-primary\" style=\"font-size: 12px; padding: 2px 0px; width: 60px; margin: 0 6px 6px 0;\" onclick=\"showEditZone('" + name + "');\">" + (isReadOnlyZone ? "View" : "Edit") + "</button>";
@@ -234,6 +255,7 @@ function showAddZoneModal() {
$("#txtAddZonePrimaryNameServer").val("");
$("#txtAddZoneGlueAddresses").val("");
$("#rdAddZoneForwarderProtocolUdp").prop("checked", true);
$("#txtAddZoneForwarder").attr("placeholder", "8.8.8.8 or [2620:fe::10]")
$("#txtAddZoneForwarder").val("");
$("#divAddZonePrimaryNameServer").hide();
@@ -339,6 +361,11 @@ function showEditZone(domain) {
$("#tdStatusEditZone").html(status);
$("#titleEditZoneExpiry").html(expiry);
if (responseJSON.response.zone.internal)
$("#titleEditZoneType").attr("class", "label label-default");
else
$("#titleEditZoneType").attr("class", "label label-primary");
switch (status) {
case "Disabled":
$("#tdStatusEditZone").attr("class", "label label-warning");
@@ -634,6 +661,7 @@ function clearAddEditForm() {
$("#divAddEditRecordDataForwarder").hide();
$("#rdAddEditRecordDataForwarderProtocolUdp").prop("checked", true);
$("input[name=rdAddEditRecordDataForwarderProtocol]:radio").attr('disabled', false);
$("#txtAddEditRecordDataForwarder").attr("placeholder", "8.8.8.8 or [2620:fe::10]")
$("#txtAddEditRecordDataForwarder").val("");
$("#btnAddEditRecord").button("reset");
@@ -934,6 +962,25 @@ function addRecord() {
});
}
function updateAddEditFormForwarderPlaceholder() {
var protocol = $('input[name=rdAddEditRecordDataForwarderProtocol]:checked').val();
switch (protocol) {
case "Udp":
case "Tcp":
$("#txtAddEditRecordDataForwarder").attr("placeholder", "8.8.8.8 or [2620:fe::10]")
break;
case "Tls":
$("#txtAddEditRecordDataForwarder").attr("placeholder", "dns.quad9.net (9.9.9.9:853)")
break;
case "Https":
case "HttpsJson":
$("#txtAddEditRecordDataForwarder").attr("placeholder", "https://cloudflare-dns.com/dns-query (1.1.1.1)")
break;
}
}
function showEditRecordModal(objBtn) {
var btn = $(objBtn);
var id = btn.attr("data-id");
@@ -1034,6 +1081,7 @@ function showEditRecordModal(objBtn) {
$("input[name=rdAddEditRecordDataForwarderProtocol]:radio").attr('disabled', true);
$("#rdAddEditRecordDataForwarderProtocol" + divData.attr("data-record-protocol")).prop("checked", true);
$("#txtAddEditRecordDataForwarder").val(divData.attr("data-record-value"));
updateAddEditFormForwarderPlaceholder();
break;
default: