diff --git a/app/Http/Controllers/Api/OtherController.php b/app/Http/Controllers/Api/OtherController.php index 64b2669e9..27b0fc3fe 100644 --- a/app/Http/Controllers/Api/OtherController.php +++ b/app/Http/Controllers/Api/OtherController.php @@ -202,7 +202,6 @@ public function healthcheck(Request $request) new OA\Property(property: 'status', type: 'string', example: 'in_progress'), new OA\Property(property: 'step', type: 'integer', example: 3), new OA\Property(property: 'message', type: 'string', example: 'Pulling Docker images'), - new OA\Property(property: 'timestamp', type: 'string', example: '2024-01-15T10:30:45+00:00'), ] )), new OA\Response( @@ -231,17 +230,18 @@ public function upgradeStatus(Request $request) [$step, $message, $timestamp] = $parts; - // Check if status is stale (older than 30 minutes) + // Check if status is stale (older than 10 minutes) - upgrades shouldn't take longer try { $statusTime = new \DateTime($timestamp); $now = new \DateTime; $diffMinutes = ($now->getTimestamp() - $statusTime->getTimestamp()) / 60; - if ($diffMinutes > 30) { + if ($diffMinutes > 10) { return response()->json(['status' => 'none']); } } catch (\Exception $e) { - // If timestamp parsing fails, continue with the status + // If timestamp parsing fails, treat as stale for security + return response()->json(['status' => 'none']); } // Determine status based on step @@ -250,7 +250,6 @@ public function upgradeStatus(Request $request) 'status' => 'error', 'step' => 0, 'message' => $message, - 'timestamp' => $timestamp, ]); } @@ -261,7 +260,6 @@ public function upgradeStatus(Request $request) 'status' => $status, 'step' => $stepInt, 'message' => $message, - 'timestamp' => $timestamp, ]); } } diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index f6d0c9c8d..8ade89669 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -260,6 +260,11 @@ nohup bash -c " echo '============================================================' >>\"\$LOGFILE\" echo \"Upgrade completed: \$(date '+%Y-%m-%d %H:%M:%S')\" >>\"\$LOGFILE\" echo '============================================================' >>\"\$LOGFILE\" + + # Clean up status file after a short delay to allow frontend to read completion + sleep 10 + rm -f \"\$STATUS_FILE\" + log 'Status file cleaned up' " >>"$LOGFILE" 2>&1 & # Give the background process a moment to start