security/acme-client: quality of life improvements for cron handling, refs #2178

This commit is contained in:
Frank Wall
2021-03-05 00:42:18 +01:00
parent e682ed1b4b
commit 40e943a2f1
3 changed files with 21 additions and 3 deletions
+8
View File
@@ -8,6 +8,14 @@ WWW: https://github.com/acmesh-official/acme.sh
Plugin Changelog
================
2.5
Fixed:
* ensure that the auto renewal cron job is properly disabled (#2178)
Changed:
* reload settings page to show/hide cron tab
2.4
Added:
@@ -86,6 +86,8 @@ class SettingsController extends ApiMutableModelControllerBase
Config::getInstance()->save();
// Refresh the crontab
$backend->configdRun('template reload OPNsense/Cron');
// (res)start daemon
$backend->configdRun("cron restart");
$result['result'] = "new";
$result['uuid'] = $cron_uuid;
} else {
@@ -99,7 +101,7 @@ class SettingsController extends ApiMutableModelControllerBase
) {
// Get UUID, clean existin entry
$cron_uuid = (string)$mdlAcme->settings->UpdateCron;
$mdlAcme->settings->UpdateCron = null;
$mdlAcme->settings->UpdateCron = "";
$mdlCron = new Cron();
// Delete the cronjob item
if ($mdlCron->jobs->job->del($cron_uuid)) {
@@ -109,6 +111,8 @@ class SettingsController extends ApiMutableModelControllerBase
Config::getInstance()->save();
// Regenerate the crontab
$backend->configdRun('template reload OPNsense/Cron');
// (res)start daemon
$backend->configdRun("cron restart");
$result['result'] = "deleted";
} else {
$result['result'] = "unable to delete cron";
@@ -54,8 +54,6 @@ POSSIBILITY OF SUCH DAMAGE.
// Save & reconfigure acme-client to activate changes
$("#reconfigureAct").click(function(){
// TODO: reload the page afterwards to show/hide the "Schedule" tab
// set progress animation
$('[id*="reconfigureAct_progress"]').each(function(){
$(this).addClass("fa fa-spinner fa-pulse");
@@ -99,6 +97,10 @@ POSSIBILITY OF SUCH DAMAGE.
// when done, disable progress animation
$('[id*="reconfigureAct_progress"]').each(function(){
$(this).removeClass("fa fa-spinner fa-pulse");
// reload page to show or hide links to cron edit page
setTimeout(function () {
window.location.reload(true)
}, 300);
});
dlg.close();
}
@@ -132,6 +134,10 @@ POSSIBILITY OF SUCH DAMAGE.
// when done, disable progress animation
$('[id*="reconfigureAct_progress"]').each(function(){
$(this).removeClass("fa fa-spinner fa-pulse");
// reload page to show or hide links to cron edit page
setTimeout(function () {
window.location.reload(true)
}, 300);
});
});
});