From 8bbc73482e99e4525be02703382650f18506c9d4 Mon Sep 17 00:00:00 2001 From: Matthew Oleksowicz Date: Sat, 23 Aug 2025 00:01:09 -0400 Subject: [PATCH] Fix ntfy variable references and replace tr for uppercase conversion. --- notify_templates/notify_DSM.sh | 4 ++-- notify_templates/notify_HA.sh | 4 ++-- notify_templates/notify_apprise.sh | 4 ++-- notify_templates/notify_discord.sh | 4 ++-- notify_templates/notify_gotify.sh | 4 ++-- notify_templates/notify_matrix.sh | 4 ++-- notify_templates/notify_ntfy.sh | 6 +++--- notify_templates/notify_pushbullet.sh | 4 ++-- notify_templates/notify_pushover.sh | 4 ++-- notify_templates/notify_slack.sh | 4 ++-- notify_templates/notify_smtp.sh | 4 ++-- notify_templates/notify_telegram.sh | 4 ++-- notify_templates/notify_v2.sh | 12 ++++++------ 13 files changed, 31 insertions(+), 31 deletions(-) diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index b98281b..8da3c54 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -25,12 +25,12 @@ fi trigger_DSM_notification() { if [[ -n "$1" ]]; then DSM_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$DSM_channel") else DSM_channel="DSM" - UpperChannel="DSM" fi +UpperChannel="${DSM_channel^^}" + DSMSendmailToVar="${UpperChannel}_SENDMAILTO" DSMSubjectTagVar="${UpperChannel}_SUBJECTTAG" diff --git a/notify_templates/notify_HA.sh b/notify_templates/notify_HA.sh index 26586b4..9ea1a0c 100755 --- a/notify_templates/notify_HA.sh +++ b/notify_templates/notify_HA.sh @@ -10,12 +10,12 @@ NOTIFY_HA_VERSION="v0.2" trigger_HA_notification() { if [[ -n "$1" ]]; then HA_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$HA_channel") else HA_channel="HA" - UpperChannel="HA" fi + UpperChannel="${HA_channel^^}" + HAEntityVar="${UpperChannel}_ENTITY" HAUrlVar="${UpperChannel}_URL" HATokenVar="${UpperChannel}_TOKEN" diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index 579b3c9..eef74bd 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -10,12 +10,12 @@ NOTIFY_APPRISE_VERSION="v0.4" trigger_apprise_notification() { if [[ -n "$1" ]]; then apprise_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$apprise_channel") else apprise_channel="apprise" - UpperChannel="APPRISE" fi + UpperChannel="${apprise_channel^^}" + ApprisePayloadVar="${UpperChannel}_PAYLOAD" AppriseUrlVar="${UpperChannel}_URL" diff --git a/notify_templates/notify_discord.sh b/notify_templates/notify_discord.sh index 293893b..9336435 100644 --- a/notify_templates/notify_discord.sh +++ b/notify_templates/notify_discord.sh @@ -9,12 +9,12 @@ NOTIFY_DISCORD_VERSION="v0.5" trigger_discord_notification() { if [[ -n "$1" ]]; then discord_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$discord_channel") else discord_channel="discord" - UpperChannel="DISCORD" fi + UpperChannel="${discord_channel^^}" + DiscordWebhookUrlVar="${UpperChannel}_WEBHOOK_URL" if [[ -z "${!DiscordWebhookUrlVar:-}" ]]; then diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index ddf48cf..751961f 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -9,12 +9,12 @@ NOTIFY_GOTIFY_VERSION="v0.5" trigger_gotify_notification() { if [[ -n "$1" ]]; then gotify_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$gotify_channel") else gotify_channel="gotify" - UpperChannel="GOTIFY" fi + UpperChannel="${gotify_channel^^}" + GotifyTokenVar="${UpperChannel}_TOKEN" GotifyUrlVar="${UpperChannel}_DOMAIN" diff --git a/notify_templates/notify_matrix.sh b/notify_templates/notify_matrix.sh index 9966a73..7681aa7 100644 --- a/notify_templates/notify_matrix.sh +++ b/notify_templates/notify_matrix.sh @@ -9,12 +9,12 @@ NOTIFY_MATRIX_VERSION="v0.4" trigger_matrix_notification() { if [[ -n "$1" ]]; then matrix_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$matrix_channel") else matrix_channel="matrix" - UpperChannel="MATRIX" fi + UpperChannel="${matrix_channel^^}" + AccessTokenVar="${UpperChannel}_ACCESS_TOKEN" RoomIdVar="${UpperChannel}_ROOM_ID" MatrixServerVar="${UpperChannel}_SERVER_URL" diff --git a/notify_templates/notify_ntfy.sh b/notify_templates/notify_ntfy.sh index 22b41fb..8d6108b 100644 --- a/notify_templates/notify_ntfy.sh +++ b/notify_templates/notify_ntfy.sh @@ -9,17 +9,17 @@ NOTIFY_NTFYSH_VERSION="v0.7" trigger_ntfy_notification() { if [[ -n "$1" ]]; then ntfy_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$ntfy_channel") else ntfy_channel="ntfy" - UpperChannel="NTFY" fi + UpperChannel="${ntfy_channel^^}" + NtfyDomainVar="${UpperChannel}_DOMAIN" NtfyTopicNameVar="${UpperChannel}_TOPIC_NAME" NtfyAuthVar="${UpperChannel}_AUTH" - if [[ -z "${!GotifyTokenVar:-}" ]] || [[ -z "${!GotifyUrlVar:-}" ]]; then + if [[ -z "${!NtfyDomainVar:-}" ]] || [[ -z "${!NtfyTopicNameVar:-}" ]]; then printf "The ${ntfy_channel} notification channel is enabled, but required configuration variables are missing. Ntfy notifications will not be sent.\n" remove_channel ntfy diff --git a/notify_templates/notify_pushbullet.sh b/notify_templates/notify_pushbullet.sh index f272157..321d79c 100644 --- a/notify_templates/notify_pushbullet.sh +++ b/notify_templates/notify_pushbullet.sh @@ -10,12 +10,12 @@ NOTIFY_PUSHBULLET_VERSION="v0.4" trigger_pushbullet_notification() { if [[ -n "$1" ]]; then pushbullet_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$pushbullet_channel") else pushbullet_channel="pushbullet" - UpperChannel="PUSHBULLET" fi + UpperChannel="${pushbullet_channel^^}" + PushUrlVar="${UpperChannel}_URL" PushTokenVar="${UpperChannel}_TOKEN" diff --git a/notify_templates/notify_pushover.sh b/notify_templates/notify_pushover.sh index 389f68d..846ac5d 100644 --- a/notify_templates/notify_pushover.sh +++ b/notify_templates/notify_pushover.sh @@ -10,12 +10,12 @@ NOTIFY_PUSHOVER_VERSION="v0.4" trigger_pushover_notification() { if [[ -n "$1" ]]; then pushover_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$pushover_channel") else pushover_channel="pushover" - UpperChannel="PUSHOVER" fi + UpperChannel="${pushover_channel^^}" + PushoverUrlVar="${UpperChannel}_URL" PushoverUserKeyVar="${UpperChannel}_USER_KEY" PushoverTokenVar="${UpperChannel}_TOKEN" diff --git a/notify_templates/notify_slack.sh b/notify_templates/notify_slack.sh index aa65a9d..6807dcf 100644 --- a/notify_templates/notify_slack.sh +++ b/notify_templates/notify_slack.sh @@ -9,12 +9,12 @@ NOTIFY_SLACK_VERSION="v0.4" trigger_slack_notification() { if [[ -n "$1" ]]; then slack_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$slack_channel") else slack_channel="slack" - UpperChannel="SLACK" fi + UpperChannel="${slack_channel^^}" + AccessTokenVar="${UpperChannel}_ACCESS_TOKEN" ChannelIDVar="${UpperChannel}_CHANNEL_ID" diff --git a/notify_templates/notify_smtp.sh b/notify_templates/notify_smtp.sh index 41d2895..931c336 100644 --- a/notify_templates/notify_smtp.sh +++ b/notify_templates/notify_smtp.sh @@ -24,12 +24,12 @@ fi trigger_smtp_notification() { if [[ -n "$1" ]]; then smtp_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$smtp_channel") else smtp_channel="smtp" - UpperChannel="SMTP" fi + UpperChannel="${smtp_channel^^}" + SendMailFromVar="${UpperChannel}_MAIL_FROM" SendMailToVar="${UpperChannel}_MAIL_TO" SubjectTagVar="${UpperChannel}_SUBJECT_TAG" diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index b42352c..2d549a2 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -9,12 +9,12 @@ NOTIFY_TELEGRAM_VERSION="v0.5" trigger_telegram_notification() { if [[ -n "$1" ]]; then telegram_channel="$1" - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$telegram_channel") else telegram_channel="telegram" - UpperChannel="TELEGRAM" fi + UpperChannel="${telegram_channel^^}" + TelegramTokenVar="${UpperChannel}_TOKEN" TelegramChatIdVar="${UpperChannel}_CHAT_ID" TelegramTopicIdVar="${UpperChannel}_TOPIC_ID" diff --git a/notify_templates/notify_v2.sh b/notify_templates/notify_v2.sh index c357c89..22abacf 100644 --- a/notify_templates/notify_v2.sh +++ b/notify_templates/notify_v2.sh @@ -22,7 +22,7 @@ UpdToString="" FormattedOutput="" get_channel_template() { - local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1") + local UpperChannel="${1^^}" local TemplateVar="${UpperChannel}_TEMPLATE" if [[ -n "${!TemplateVar:-}" ]]; then printf "${!TemplateVar}" @@ -54,7 +54,7 @@ for template in "${enabled_notify_templates[@]}"; do done skip_snooze() { - local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1") + local UpperChannel="${1^^}" local SkipSnoozeVar="${UpperChannel}_SKIPSNOOZE" if [[ "${!SkipSnoozeVar:-}" == "true" ]]; then printf "true" @@ -64,7 +64,7 @@ skip_snooze() { } allow_empty() { - local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1") + local UpperChannel="${1^^}" local AllowEmptyVar="${UpperChannel}_ALLOWEMPTY" if [[ "${!AllowEmptyVar:-}" == "true" ]]; then printf "true" @@ -74,7 +74,7 @@ allow_empty() { } containers_only() { - local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1") + local UpperChannel="${1^^}" local ContainersOnlyVar="${UpperChannel}_CONTAINERSONLY" if [[ "${!ContainersOnlyVar:-}" == "true" ]]; then printf "true" @@ -84,7 +84,7 @@ containers_only() { } output_format() { - local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1") + local UpperChannel="${1^^}" local OutputFormatVar="${UpperChannel}_OUTPUT" if [[ -z "${!OutputFormatVar:-}" ]]; then printf "text" @@ -318,7 +318,7 @@ notify_update_notification() { UpdateChannels=( "${enabled_notify_templates[@]}" "v2" ) for NotifyScript in "${UpdateChannels[@]}"; do - UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$NotifyScript") + UpperChannel="${NotifyScript^^}" VersionVar="NOTIFY_${UpperChannel}_VERSION" if [[ -n "${!VersionVar:-}" ]]; then RawNotifyUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_${NotifyScript}.sh"