&1"); $localBefore = getLatestLocalCommit($path); $remote = getLatestRemoteCommit($path); if ($localBefore === $remote) { return "Already up to date!"; } $changelog = getCommitLogs($path, $localBefore, $remote); $output[] = "Soft-resetting local system files..."; $output[] = shell_exec("git -C $path reset --hard origin/main 2>&1"); $output[] = shell_exec("git -C $path clean -fd 2>&1"); $output[] = "\nChangelog:"; $output[] = $changelog ?: "No new commits."; return implode("\n", $output); } if ($mode === 'git') { header('Content-Type: text/html; charset=utf-8'); echo "
"; echo "Running THOS Git Update...\n\n"; echo forceGitUpdate($repoPath); echo "\n"; } elseif ($mode === 'curl') { echo "Running installer...\n\n"; echo shell_exec("sudo bash '$(curl -fsSL https://surillya.com/thos/thos.sh)'"); } else { http_response_code(400); echo "Unknown update mode"; }