Browse Source

Update acme.go

Alan Yeung 1 year ago
parent
commit
5efc75db78
1 changed files with 7 additions and 0 deletions
  1. 7 0
      mod/acme/acme.go

+ 7 - 0
mod/acme/acme.go

@@ -193,6 +193,9 @@ func contains(slice []string, str string) bool {
 	return false
 }
 
+// HandleGetExpiredDomains handles the HTTP GET request to retrieve the list of expired domains.
+// It calls the CheckCertificate method to obtain the expired domains and sends a JSON response
+// containing the list of expired domains.
 func (a *ACMEHandler) HandleGetExpiredDomains(w http.ResponseWriter, r *http.Request) {
 	type ExpiredDomains struct {
 		Domain []string `json:"domain"`
@@ -206,6 +209,9 @@ func (a *ACMEHandler) HandleGetExpiredDomains(w http.ResponseWriter, r *http.Req
 	utils.SendJSONResponse(w, string(js))
 }
 
+// HandleRenewCertificate handles the HTTP GET request to renew a certificate for the provided domains.
+// It retrieves the domains and filename parameters from the request, calls the ObtainCert method
+// to renew the certificate, and sends a JSON response indicating the result of the renewal process.
 func (a *ACMEHandler) HandleRenewCertificate(w http.ResponseWriter, r *http.Request) {
 	domainPara, err := utils.GetPara(r, "domains")
 	if err != nil {
@@ -226,6 +232,7 @@ func (a *ACMEHandler) HandleRenewCertificate(w http.ResponseWriter, r *http.Requ
 	utils.SendJSONResponse(w, strconv.FormatBool(result))
 }
 
+// Escape JSON string
 func jsonEscape(i string) string {
 	b, err := json.Marshal(i)
 	if err != nil {