From f5121bc1c5a25f3a3ec878286cace3187b05b9a1 Mon Sep 17 00:00:00 2001 From: ash Date: Fri, 29 May 2026 11:11:23 +0100 Subject: [PATCH] fix cursor placement --- scripts/caddy.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/caddy.sh b/scripts/caddy.sh index 790acc5..ce74352 100755 --- a/scripts/caddy.sh +++ b/scripts/caddy.sh @@ -88,15 +88,25 @@ add_config() { [[ -z "$SERVICE" ]] && { gum style --foreground "red" " Aborted – no service name given."; press_enter; return; } - # Domain – pre-filled with common suffix; type the subdomain then arrow to end - DOMAIN=$(gum input \ - --prompt " Domain: " \ + # Domain – type subdomain only, suffix appended automatically + SUBDOMAIN=$(gum input \ + --prompt " Subdomain: " \ --prompt.foreground "$ORANGE" \ - --value ".marlow.quest" \ - --width 40 \ + --placeholder "e.g. homarr (will become homarr.marlow.quest)" \ + --width 50 \ --cursor.foreground "$ORANGE") - [[ -z "$DOMAIN" ]] && { gum style --foreground "red" " Aborted – no domain given."; press_enter; return; } + [[ -z "$SUBDOMAIN" ]] && { gum style --foreground "red" " Aborted – no domain given."; press_enter; return; } + + # If they typed a full domain (contains a dot) use as-is, otherwise append suffix + if [[ "$SUBDOMAIN" == *.* ]]; then + DOMAIN="$SUBDOMAIN" + else + DOMAIN="${SUBDOMAIN}.marlow.quest" + fi + + gum style --foreground "$GREY_LIGHT" --margin "0 2" " → ${DOMAIN}" + echo "" # Upstream IP:port – pre-filled with common subnet prefix UPSTREAM=$(gum input \ @@ -123,7 +133,6 @@ add_config() { if [[ "$USE_TINYAUTH" == "Yes" ]]; then CONFIG_BLOCK="${DOMAIN} { import tinyauth - } reverse_proxy ${UPSTREAM} }"