Implemented Check for updates which removs the last shell exec from web ui, and reimplemented db_update switch to update_cli.php

This commit is contained in:
johnnyq
2026-08-26 23:38:23 -04:00
parent 14c38b9814
commit 069f587c1d
13 changed files with 573 additions and 132 deletions

34
js/auto_reload.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* Reload a page that is waiting on something cron will do.
*
* Opt in by putting data-itflow-reload-seconds="<n>" on the element that says so - the
* "Checking for updates" alert on Maintenance > Update is the first user. Rendering that
* attribute is what starts the timer, so a view that is not waiting costs one failed
* querySelector.
*
* Deliberately an attribute rather than an inline <script>: inline scripts are the thing
* standing between ITFlow and a CSP without unsafe-inline, and this would have been another.
*/
(function () {
'use strict';
document.addEventListener('DOMContentLoaded', function () {
const waiting = document.querySelector('[data-itflow-reload-seconds]');
if (!waiting) {
return;
}
const seconds = parseInt(waiting.dataset.itflowReloadSeconds, 10);
if (!Number.isFinite(seconds) || seconds < 1) {
return;
}
setTimeout(function () {
window.location.reload();
}, seconds * 1000);
});
})();