From 0fc4528b694be32808d902b4835775e219888faa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 19 Aug 2022 10:15:37 +0100 Subject: [PATCH] Get ntfy files from account --- scripts/epicyon-notification | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/epicyon-notification b/scripts/epicyon-notification index d4d6cd373..9c5a8ba2b 100755 --- a/scripts/epicyon-notification +++ b/scripts/epicyon-notification @@ -118,8 +118,21 @@ function sendNotification { # see https://ntfy.sh # You will need to create these two files containing the ntfy # service url and topic - ntfy_url_file=/home/${ADMIN_USERNAME}/.ntfy_url - ntfy_topic_file=/home/${ADMIN_USERNAME}/.ntfy_topic + ntfy_url_file=/home/${USERNAME}/.ntfy_url + ntfy_topic_file=/home/${USERNAME}/.ntfy_topic + + # get ntfy settings from the account directory + epicyon_config_file=${epicyonInstallDir}/config.json + if [ -f "${epicyon_config_file}" ]; then + epicyon_domain=$(cat "$epicyon_config_file" | awk -F '"domain": "' '{print $2}' | awk -F '"' '{print $1}') + if [ "${epicyon_domain}" ]; then + epicyon_account_dir="${epicyonInstallDir}/accounts/${USERNAME}@${epicyon_domain}" + if [ -d "${epicyon_account_dir}" ]; then + ntfy_url_file=${epicyon_account_dir}/.ntfy_url + ntfy_topic_file=${epicyon_account_dir}/.ntfy_topic + fi + fi + fi if [ "$MESSAGE" ]; then if [ -f "$ntfy_topic_file" ]; then