From cf3a1166d1844621dc894039702946143b70e415 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 24 May 2026 13:49:26 +0000 Subject: [PATCH] install_tool: probe user-supplied openwebui URL before suggesting install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openwebui ships as a Docker service rather than a CLI, and the installer's check_tool only looked at the default localhost:8080. Users running the official image on a different port were told it wasn't installed and prompted to install it again. Now, when the default probe misses, the wizard first asks for the endpoint (and optional API key), persists them to .env, and re-checks before falling through to the install suggestion. Also fixes the y/n prompt that rendered as "[Y] [Y]:" because both _it_confirm and _it_read appended the default — _it_confirm now prints the hint directly as "[Y/n]" or "[y/N]". --- scripts/install_tool.sh | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/install_tool.sh b/scripts/install_tool.sh index 1111804..54d4127 100755 --- a/scripts/install_tool.sh +++ b/scripts/install_tool.sh @@ -71,8 +71,15 @@ _it_secret() { } _it_confirm() { - local prompt="$1" default="${2:-N}" v - v="$(_it_read "$prompt [$default]" "$default")" + local prompt="$1" default="${2:-N}" v hint + case "${default^^}" in + Y|YES) hint="Y/n" ;; + *) hint="y/N" ;; + esac + _it_open_tty + printf '%s [%s]: ' "$prompt" "$hint" >&4 + IFS= read -r v <&3 || v="" + v="${v:-$default}" case "${v,,}" in y|yes) return 0 ;; *) return 1 ;; @@ -198,6 +205,33 @@ install_tool() { return 0 fi + # openwebui is an HTTP service, not a CLI — before assuming it isn't + # installed, give the user a chance to point us at a non-default URL + # (e.g. they're running the official Docker image on a different port). + if [ "$name" = "openwebui" ]; then + _it_say "" + _it_say "[install_tool] openwebui not reachable at the default URL." + _it_say "[install_tool] If you already have OpenWebUI running (e.g. via Docker on a non-standard port)," + _it_say "[install_tool] enter its URL now and we'll re-check before suggesting install." + local _ow_endpoint + _ow_endpoint="$(_it_read "OpenWebUI endpoint" "${CLK_OPENWEBUI_ENDPOINT:-http://localhost:8080}")" + export CLK_OPENWEBUI_ENDPOINT="$_ow_endpoint" + env_set "$_IT_ENV_FILE" CLK_OPENWEBUI_ENDPOINT "$_ow_endpoint" + if _it_confirm "Set OpenWebUI API key now? (only needed for authenticated instances)" "N"; then + local _ow_key + _ow_key="$(_it_secret "Paste OpenWebUI API key")" + if [ -n "$_ow_key" ]; then + export CLK_OPENWEBUI_API_KEY="$_ow_key" + env_set "$_IT_ENV_FILE" CLK_OPENWEBUI_API_KEY "$_ow_key" + fi + fi + if check_tool openwebui; then + _it_say "[install_tool] openwebui reachable at $_ow_endpoint — skipping install." + return 0 + fi + _it_warn "still no openwebui server at $_ow_endpoint." + fi + # Resolve the install command for this tool. local fn="_install_cmd_$name" if ! declare -F "$fn" >/dev/null; then