1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-25 19:17:22 +01:00

Ability to set custom TTL values for custom DNS records (#28)

This commit is contained in:
David Duque
2021-09-16 15:35:04 +01:00
committed by David Duque
parent 113b7bd827
commit 3b0b2a1605
4 changed files with 118 additions and 67 deletions

View File

@@ -44,9 +44,19 @@
</div>
</div>
<div class="form-group">
<label for="customdnsValue" class="col-sm-1 control-label">Value</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="customdnsValue" placeholder="">
<table>
<tr style="width: 100%;">
<td style="width: 75%;">
<label for="customdnsValue" class="control-label">Value</label>
<input type="text" class="form-control" id="customdnsValue" placeholder="">
</td>
<td style="width: 25%;">
<label for="customdnsTtl" class="col-sm-1 control-label">TTL</label>
<input type="number" class="form-control" style="margin-left: 5pt;" id="customdnsTtl" placeholder="default">
</td>
</tr>
</table>
<div id="customdnsTypeHint" class="text-info" style="margin-top: .5em"></div>
</div>
</div>
@@ -57,7 +67,7 @@
</div>
</form>
<div style="text-align: right; font-size; 90%; margin-top: 1em;">
<div style="text-align: right; font-size: 90%; margin-top: 1em;">
sort by:
<a href="#" onclick="window.miab_custom_dns_data_sort_order='qname'; show_current_custom_dns_update_after_sort(); return false;">domain name</a>
|
@@ -68,10 +78,11 @@
<th>Domain Name</th>
<th>Record Type</th>
<th>Value</th>
<th>TTL</th>
<th></th>
</thead>
<tbody>
<tr><td colspan="4">Loading...</td></tr>
<tr><td colspan="5">Loading...</td></tr>
</tbody>
</table>
@@ -214,7 +225,7 @@ function show_current_custom_dns_update_after_sort() {
var last_zone = null;
for (var i = 0; i < data.length; i++) {
if (sort_key == "qname" && data[i].zone != last_zone) {
var r = $("<tr><th colspan=4 style='background-color: #EEE'></th></tr>");
var r = $("<tr><th colspan=5 style='background-color: #EEE'></th></tr>");
r.find("th").text(data[i].zone);
tbody.append(r);
last_zone = data[i].zone;
@@ -228,6 +239,11 @@ function show_current_custom_dns_update_after_sort() {
tr.append($('<td class="long"/>').text(data[i].qname));
tr.append($('<td/>').text(data[i].rtype));
tr.append($('<td class="long" style="max-width: 40em"/>').text(data[i].value));
if (data[i].ttl) {
tr.append($('<td/>').text(data[i].ttl));
} else {
tr.append($('<td/>').html('<i class="">default</i>'));
}
tr.append($('<td>[<a href="#" onclick="return delete_custom_dns_record(this)">delete</a>]</td>'));
}
}
@@ -264,10 +280,15 @@ function do_set_custom_dns(qname, rtype, value, method) {
else
qname = $('#customdnsZone').val();
rtype = $('#customdnsType').val();
value = $('#customdnsValue').val();
value = {
value: $('#customdnsValue').val(),
ttl: $('#customdnsTtl').val()
};
method = 'POST';
}
console.log(value)
api(
"/dns/custom/" + qname + "/" + rtype,
method,