From dad171096b7e9fa01992ce94bee0a377b1dcccad Mon Sep 17 00:00:00 2001 From: Tien Ngo Date: Tue, 30 Dec 2025 14:19:56 +0700 Subject: [PATCH] fix ntfy --- notify.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/notify.sh b/notify.sh index 5a2455f..09fccf0 100644 --- a/notify.sh +++ b/notify.sh @@ -19,14 +19,6 @@ send_ntfy() { echo -e "${YELLOW}🔔 Ntfy Push Notification${NC}" echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" - # Debug: Show environment variables - echo -e " ${YELLOW}Debug Info:${NC}" - echo -e " NTFY_URL: ${GREEN}${NTFY_URL:-'(not set)'}${NC}" - echo -e " NTFY_TOPIC: ${GREEN}${NTFY_TOPIC:-'(not set)'}${NC}" - echo -e " NTFY_USERNAME: ${GREEN}${NTFY_USERNAME:-'(not set)'}${NC}" - echo -e " NTFY_PASSWORD: ${GREEN}${NTFY_PASSWORD:+'***set***'}${NTFY_PASSWORD:-'(not set)'}${NC}" - echo "" - if [ -n "$NTFY_URL" ] && [ -n "$NTFY_TOPIC" ]; then echo -e " Server: ${GREEN}$NTFY_URL${NC}" echo -e " Topic: ${GREEN}$NTFY_TOPIC${NC}" @@ -43,9 +35,10 @@ send_ntfy() { tags="x,warning,deployment" fi - # Check for Basic Auth + + local curl_auth_args=() if [ -n "$NTFY_USERNAME" ] && [ -n "$NTFY_PASSWORD" ]; then - auth_args="-u $NTFY_USERNAME:$NTFY_PASSWORD" + curl_auth_args=(-u "$NTFY_USERNAME:$NTFY_PASSWORD") echo -e " ${GREEN}✓${NC} Using Basic Authentication" else echo -e " ${YELLOW}⚠${NC} No authentication (public topic)" @@ -65,7 +58,7 @@ EOF echo -e " ${YELLOW}→${NC} Sending push notification..." echo -e " ${YELLOW}→${NC} Target: $NTFY_URL/$NTFY_TOPIC" - response=$(curl -s -w "\n%{http_code}" $auth_args -X POST "$NTFY_URL/$NTFY_TOPIC" \ + response=$(curl -s -w "\n%{http_code}" "${curl_auth_args[@]}" -X POST "$NTFY_URL/$NTFY_TOPIC" \ -H "Title: $ICON $TITLE" \ -H "Priority: $priority" \ -H "Tags: $tags" \