Added Custom Name Server Option

This commit is contained in:
sickjuicy
2024-11-26 23:30:24 +01:00
parent 4a4483e09d
commit e6b2d458f7
3 changed files with 50 additions and 49 deletions

View File

@@ -25,8 +25,6 @@
</style>
</head>
<body>
<link rel="stylesheet" href="../darktheme.css">
<script src="../script/darktheme.js"></script>
<br>
<div class="ui container">
<div class="ui header">
@@ -52,7 +50,7 @@
</div>
<small>If you don't want to share your private email address, you can also fill in an email address that point to a mailbox not exists on your domain.</small>
</div>
<div class="ui basic segment advanceoptions">
<div class="ui basic segment" style="background-color: #f7f7f7; border-radius: 1em;">
<div class="ui accordion advanceSettings">
<div class="title">
<i class="dropdown icon"></i>
@@ -137,6 +135,13 @@
<!-- Auto populate moved to acmedns module and initDNSProviderList() -->
</div>
</div>
<div class="ui form">
<div class="field">
<label>Domain Name Server (optional)</label>
<input id="dnsInput" type="text" placeholder="ns.example.com" onkeyup="handlePostInputAutomation();">
<small>If you have more than one DNS server, enter them separated by commas (e.g. ns1.example.com,ns2.example.com)
</small>
</div>
</div>
<div class="field dnsChallengeOnly" style="display:none;">
<div class="ui divider"></div>
@@ -439,15 +444,11 @@
let optionalFieldsHTML = "";
for (const [key, datatype] of Object.entries(data)) {
if (datatype == "int"){
let defaultValue = 10;
if (key == "HTTPTimeout"){
defaultValue = 300;
}
$("#dnsProviderAPIFields").append(`<div class="ui fluid labeled dnsConfigField input typeint" key="${key}" style="margin-top: 0.2em;">
$("#dnsProviderAPIFields").append(`<div class="ui fluid labeled dnsConfigField input" key="${key}" style="margin-top: 0.2em;">
<div class="ui basic blue label" style="font-weight: 300;">
${key}
</div>
<input type="number" value="${defaultValue}">
<input type="number" value="300">
</div>`);
}else if (datatype == "bool"){
booleanFieldsHTML += (`<div class="ui checkbox dnsConfigField" key="${key}" style="margin-top: 1em !important; padding-left: 0.4em;">
@@ -606,12 +607,8 @@
//Boolean option
let checked = $(this).find("input")[0].checked;
dnsCredentials[thisKey] = checked;
}else if ($(this).hasClass("typeint")){
//Int options
let value = $(this).find("input").val();
dnsCredentials[thisKey] = parseInt(value);
}else{
//String options
//String or int options
let value = $(this).find("input").val().trim();
dnsCredentials[thisKey] = value;
}
@@ -725,8 +722,7 @@
if (callback != undefined){callback(false);}
return;
}
var ca = $("#ca").dropdown("get value");
var caURL = "";
if (ca == "Custom ACME Server") {
@@ -734,9 +730,9 @@
caURL = $("#caURL").val();
}
var dns = $("#useDnsChallenge")[0].checked;
var skipTLSValue = $("#skipTLSCheckbox")[0].checked;
var dnsServers = $("#dnsInput").val(); // New line: Read DNS servers from input field
$.ajax({
url: "/api/acme/obtainCert",
@@ -749,22 +745,18 @@
caURL: caURL,
skipTLS: skipTLSValue,
dns: dns,
dnsServers: dnsServers // New line: Include DNS servers in the request
},
success: function(response) {
$("#obtainButton").removeClass("loading").removeClass("disabled");
if (response.error) {
console.log("Error:", response.error);
// Show error message
parent.msgbox(response.error, false, 12000);
if (callback != undefined){callback(false);}
} else {
console.log("Certificate renewed successfully");
// Show success message
parent.msgbox("Certificate renewed successfully");
// Renew the parent certificate list
parent.initManagedDomainCertificateList();
if (callback != undefined){callback(true);}
}
},