Minor fix to renew now function

This commit is contained in:
Toby Chui 2023-06-23 23:22:19 +08:00
parent 23eca5afae
commit 741d3f8de1
2 changed files with 19 additions and 3 deletions

View File

@ -185,7 +185,21 @@ func (a *AutoRenewer) HandleLoadAutoRenewDomains(w http.ResponseWriter, r *http.
}
func (a *AutoRenewer) HandleRenewNow(w http.ResponseWriter, r *http.Request) {
renewedDomains, err := a.CheckAndRenewCertificates()
if err != nil {
utils.SendErrorResponse(w, err.Error())
return
}
message := "Domains renewed"
if len(renewedDomains) == 0 {
message = ("All certificates are up-to-date!")
} else {
message = ("The following domains have been renewed: " + strings.Join(renewedDomains, ","))
}
js, _ := json.Marshal(message)
utils.SendJSONResponse(w, string(js))
}
func (a *AutoRenewer) HandleAutoRenewEnable(w http.ResponseWriter, r *http.Request) {

View File

@ -393,10 +393,12 @@
//Handle the renew now btn click
function renewNow(){
alert("wip");
return
$.get("/api/acme/autoRenew/renewNow", function(data){
alert(data);
if (data.error != undefined){
parent.msgbox(data.error, false, 6000);
}else{
parent.msgbox(data)
}
})
}