fix(fileflows): handle update API failures and fix Node install

Server updates no longer abort on 401 or unreachable API; users can force deploy when security is enabled or the app is down. Node installs now pass --server during systemd setup, and Node updates skip the server-only API.
This commit is contained in:
Michel Roegl-Brunner
2026-07-14 12:04:22 +02:00
parent 09ec7b3203
commit 52a8649b5a
2 changed files with 79 additions and 40 deletions
+41 -5
View File
@@ -31,11 +31,50 @@ function update_script() {
exit exit
fi fi
update_available=$(curl -fsSL -X 'GET' "http://localhost:19200/api/status/update-available" -H 'accept: application/json' | jq .UpdateAvailable) local proceed=false
if systemctl list-unit-files 'fileflows.service' --no-legend 2>/dev/null | grep -q '^fileflows\.service'; then
tmp=$(mktemp)
http_code=$(curl -sSL -X 'GET' "http://localhost:19200/api/status/update-available" -H 'accept: application/json' -o "$tmp" -w '%{http_code}' 2>/dev/null) || http_code="000"
if [[ "$http_code" == "200" ]]; then
update_available=$(jq -r '.UpdateAvailable // false' "$tmp" 2>/dev/null)
rm -f "$tmp"
if [[ "${update_available}" == "true" ]]; then if [[ "${update_available}" == "true" ]]; then
proceed=true
else
msg_ok "No update required. ${APP} is already at latest version"
exit
fi
else
rm -f "$tmp"
if [[ "$http_code" == "401" ]]; then
msg_warn "Could not check for updates: API returned 401 (security may be enabled)."
else
msg_warn "Could not check for updates: API unreachable (HTTP ${http_code})."
fi
if [[ "${FORCE_UPDATE:-}" == "1" ]]; then
proceed=true
else
read -r -p "${TAB3}Force update without version check? [y/N]: " CONFIRM
if [[ "$CONFIRM" =~ ^([yY][eE][sS]|[yY])$ ]]; then
proceed=true
else
msg_error "Update aborted."
exit
fi
fi
fi
else
proceed=true
fi
if [[ "$proceed" != "true" ]]; then
exit
fi
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl --all stop 'fileflows*' systemctl --all stop 'fileflows*'
msg_info "Stopped Service" msg_ok "Stopped Service"
msg_info "Creating Backup" msg_info "Creating Backup"
ls /opt/*.tar.gz &>/dev/null && rm -f /opt/*.tar.gz ls /opt/*.tar.gz &>/dev/null && rm -f /opt/*.tar.gz
@@ -71,9 +110,6 @@ function update_script() {
systemctl --all start 'fileflows*' systemctl --all start 'fileflows*'
msg_ok "Started Service" msg_ok "Started Service"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
else
msg_ok "No update required. ${APP} is already at latest version"
fi
exit exit
} }
+5 -2
View File
@@ -55,9 +55,12 @@ if [[ "$install_server" =~ ^[Ss]$ ]]; then
msg_ok "Installed FileFlows Server" msg_ok "Installed FileFlows Server"
else else
msg_info "Installing FileFlows Node" msg_info "Installing FileFlows Node"
read -r -p "${TAB3}Enter FileFlows Server URL (e.g. http://192.168.1.10:19200): " server_url
while [[ -z "${server_url// /}" ]]; do
read -r -p "${TAB3}Enter FileFlows Server URL (e.g. http://192.168.1.10:19200): " server_url
done
cd /opt/fileflows/Node cd /opt/fileflows/Node
$STD dotnet FileFlows.Node.dll $STD dotnet FileFlows.Node.dll --server "$server_url" --systemd install --root true
$STD dotnet FileFlows.Node.dll --systemd install --root true
systemctl enable -q --now fileflows-node systemctl enable -q --now fileflows-node
msg_ok "Installed FileFlows Node" msg_ok "Installed FileFlows Node"
fi fi