1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-09-12 00:18:59 +02:00

Move zonefile download to the external dns page, fix filename, response format

This commit is contained in:
Joshua Tauberer
2020-11-15 11:55:41 -05:00
parent db676576ab
commit b4496213b1
4 changed files with 54 additions and 44 deletions

View File

@@ -99,23 +99,6 @@
</div>
</form>
<h3>Download zonefile</h3>
<p>You can download your zonefiles here, for example if you want to host your DNS somewhere else.</p>
<form class="form-horizontal" role="form" onsubmit="do_download_zonefile(); return false;">
<div class="form-group">
<label for="downloadZonefile" class="col-sm-1 control-label">Zone</label>
<div class="col-sm-10">
<select id="downloadZonefile" class="form-control"> </select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-11">
<button type="submit" class="btn btn-primary">Download</button>
</div>
</div>
</form>
<h3>Custom DNS API</h3>
@@ -189,13 +172,10 @@ function show_custom_dns() {
"GET",
{ },
function(data) {
var selects = ['#customdnsZone', '#downloadZonefile']
for (var i = 0; i < selects.length; i++) {
$(selects[i]).text('');
for (var j = 0; j < data.length; j++) {
$(selects[i]).append($('<option/>').text(data[j]));
}
}
$('#customdnsZone').text('');
for (var i = 0; i < data.length; i++) {
$('#customdnsZone').append($('<option/>').text(data[i]));
}
});
show_current_custom_dns();
@@ -212,7 +192,7 @@ function show_current_custom_dns() {
$('#custom-dns-current').fadeIn();
else
$('#custom-dns-current').fadeOut();
var reverse_fqdn = function(el) {
el.qname = el.qname.split('.').reverse().join('.');
return el;
@@ -294,22 +274,6 @@ function do_set_custom_dns(qname, rtype, value, method) {
});
}
function do_download_zonefile() {
var zone = $('#downloadZonefile').val();
api(
"/dns/zonefile/"+ zone,
"GET",
{},
function(data) {
if (data == "") return; // nothing updated
show_modal_error("Download Zonefile", $("<pre/>").text(data));
},
function(err) {
show_modal_error("Download Zonefile (Error)", $("<pre/>").text(err));
});
}
function show_customdns_rtype_hint() {
$('#customdnsTypeHint').text($("#customdnsType").find('option:selected').attr('data-hint'));
}