This commit is contained in:
2025-12-30 14:19:56 +07:00
parent c3ab382adc
commit dad171096b

View File

@@ -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" \