Surface when LibrePortal is behind upstream and let users update from the WebUI, reusing the proven git-update path instead of reinventing it. Detection (host): webuiSystemUpdateCheck writes frontend/data/system/update_status.json from a throttled git fetch + behind-count + VERSION compare, off the existing per-minute `webui generate system` cron. A new /VERSION file is the canonical version. Display (frontend): update-notifier.js/.css render a global topbar badge (every page) and a dashboard banner (prominent when behind, subtle "up to date" with a manual check otherwise), plus a details panel. Actions go through the task pipeline: - `libreportal update apply` -> webuiRunUpdate (non-interactive: guards, forced check, gitPerformUpdate, then dockerInstallApp libreportal) - `libreportal update check` -> forced recheck gitFolderResetAndBackup's body is extracted into gitPerformUpdate (no exit) so the WebUI path can reuse it; the interactive CLI flow is unchanged. Detection JSON verified against the repo (up-to-date and behind cases). webuiRunUpdate's re-clone + redeploy still needs validation on a live host. The latest-version source is git for now and is the single swap point for get.libreportal.org later — the JSON contract and frontend stay unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
31 lines
844 B
Bash
Executable File
31 lines
844 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Update Commands Handler
|
|
# Handles all update subcommands by calling core functions
|
|
|
|
cliHandleUpdateCommands()
|
|
{
|
|
local update_type="$initial_command2"
|
|
|
|
case "$update_type" in
|
|
"")
|
|
# Interactive CLI updater (prompts the user).
|
|
checkUpdates
|
|
;;
|
|
"check")
|
|
# Non-interactive: force a fresh out-of-date check and rewrite
|
|
# update_status.json. Used by the WebUI "Check for updates" action.
|
|
webuiSystemUpdateCheck "force"
|
|
;;
|
|
"apply"|"now")
|
|
# Non-interactive: perform the update. Used by the WebUI
|
|
# "Update now" action.
|
|
webuiRunUpdate
|
|
;;
|
|
*)
|
|
isNotice "Invalid update command: ${RED}$update_type${NC}"
|
|
cliShowUpdateHelp
|
|
;;
|
|
esac
|
|
}
|