From 8ddccde8e5ceaccf85ee5c3bbb52a22bb16f5b98 Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Mon, 7 Apr 2025 11:14:30 +0200 Subject: [PATCH] fixes #337 fixes #337 --- install.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 0322281b..c8f1a4fd 100644 --- a/install.sh +++ b/install.sh @@ -1299,15 +1299,15 @@ set_email_address_and_email_admin_logins(){ local message="$2" generate_random_token_one_time_only TRANSIENT=$(awk -F'=' '/^mail_security_token/ {print $2}' "${CONFIG_FILE}") - - SSL=$(awk -F'=' '/^ssl/ {print $2}' "${CONFIG_FILE}") - - # Determine protocol based on SSL configuration - if [ "$SSL" = "yes" ]; then - PROTOCOL="https" - else - PROTOCOL="http" - fi + + PROTOCOL="http" + if [ "$SET_HOSTNAME_NOW" = true ]; then + if [[ $new_hostname =~ ^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then + if [ -f "/etc/openpanel/caddy/ssl/acme-v02.api.letsencrypt.org-directory/$new_hostname/$new_hostname.key" ]; then + PROTOCOL="https + fi + fi + fi # Send email using appropriate protocol curl -k -X POST "$PROTOCOL://127.0.0.1:2087/send_email" -F "transient=$TRANSIENT" -F "recipient=$EMAIL" -F "subject=$title" -F "body=$message"