Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
01f0bbf2ba
1 changed files with 27 additions and 5 deletions
  1. 27 5
      web/snippet/acme.html

+ 27 - 5
web/snippet/acme.html

@@ -57,7 +57,7 @@
               <p>Renew all certificates with ACME supported CAs</p>
               <div class="ui toggle checkbox">
                 <input type="checkbox" id="renewAllSupported" onchange="setAutoRenewIfCASupportMode(this.checked);" checked>
-                <label>Auto renew if CA is supported</label>
+                <label>Renew All Certs</label>
               </div><br>
               <button id="renewNowBtn" onclick="renewNow();" class="ui basic right floated button" style="margin-top: -2em;"><i class="yellow refresh icon"></i> Renew Now</button>
               <div class="ui horizontal divider"> OR </div>
@@ -76,7 +76,7 @@
               <div class="ui yellow message">
                 Certificate Renew only works on the certification authority (CA) supported by Zoraxy. Check Zoraxy wiki for more information on supported list of CAs.
               </div>
-              <button class="ui basic right floated button"><i class="blue save icon"></i> Save Changes</button>
+              <button class="ui basic right floated button" onclick="saveAutoRenewPolicy();"><i class="blue save icon"></i> Save Changes</button>
               <button id="renewSelectedButton" onclick="renewNow();" class="ui basic right floated disabled button"><i class="yellow refresh icon"></i> Renew Selected</button>
               <br><br>
           </div>
@@ -389,7 +389,12 @@
             $("#renewAllSupported").parent().checkbox("set checked");
           }else{
             //This is a list of domain files
-
+            data.forEach(function(name) {
+              $('#domainTableBody input[type="checkbox"][name="' + name + '"]').prop('checked', true);
+            });
+            $("#domainCertFileTable").removeClass("disabled");
+            $("#renewNowBtn").addClass("disabled");
+            $("#renewSelectedButton").removeClass("disabled");
           }
         }
       })
@@ -398,9 +403,26 @@
     function saveAutoRenewPolicy(){
       let autoRenewAll = $("#renewAllSupported").parent().checkbox("is checked");
       if (autoRenewAll == true){
-
+        $.ajax({
+          url: "/api/acme/autoRenew/setDomains",
+          data: {opr: "setAuto"},
+          success: function(data){
+            parent.msgbox("Renew policy rule updated")
+          }
+        });
       }else{
-
+        let checkedNames = [];
+        $('#domainTableBody input[type="checkbox"]:checked').each(function() {
+          checkedNames.push($(this).attr('name'));
+        });
+
+        $.ajax({
+          url: "/api/acme/autoRenew/setDomains",
+          data: {opr: "setSelected", domains: JSON.stringify(checkedNames)},
+          success: function(data){
+            parent.msgbox("Renew policy rule updated")
+          }
+        });
       }
     }