From f2681717d02bcec38f83db872c707ca04e1b1561 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sun, 27 Aug 2023 21:19:21 +0200 Subject: [PATCH 1/3] improve the https check Signed-off-by: Daniel Hansson --- lib.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib.sh b/lib.sh index 88aad0fb0a..412c55213b 100644 --- a/lib.sh +++ b/lib.sh @@ -747,9 +747,13 @@ fi # Check if Nextcloud is installed with TLS check_nextcloud_https() { - if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https" +if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https" +then + # Check if it's used by any of the Documentserver apps and adopt the message to that + if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ] then - if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ] + ncdomain + if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true' then msg_box "Sorry, but Nextcloud needs to be run on HTTPS. You can easily activate TLS (HTTPS) by running the Let's Encrypt script. @@ -758,7 +762,12 @@ More info here: http://shortio.hanssonit.se/1EAgBmPyFc To run this script again, just exectue 'sudo bash $SCRIPTS/menu.sh' and choose: Additional Apps --> Documentserver --> $1." exit - else + fi + else + # Adopt the error message to anything else but the Documentserver apps + ncdomain + if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true' + then msg_box "Sorry, but Nextcloud needs to be run on HTTPS. You can easily activate TLS (HTTPS) by running the Let's Encrypt script. More info here: http://shortio.hanssonit.se/1EAgBmPyFc @@ -768,6 +777,7 @@ Additional Apps --> $1." exit fi fi +fi } restart_webserver() { From 1d2662fc7a985d024e7f792d3008ebdda8b01b44 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sun, 27 Aug 2023 21:26:19 +0200 Subject: [PATCH 2/3] . Signed-off-by: Daniel Hansson --- apps/notify_push.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/notify_push.sh b/apps/notify_push.sh index a2a53aa104..d4982cd37c 100644 --- a/apps/notify_push.sh +++ b/apps/notify_push.sh @@ -41,8 +41,9 @@ fi # Check TLS check_nextcloud_https "Notify Push" +# Get the NCDOMAIN variable +ncdomain # Check apache conf -NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||') if ! [ -f "$SITES_AVAILABLE/$NCDOMAIN.conf" ] then msg_box "It seems like you haven't used the built-in 'Activate TLS' script to enable 'Let's Encrypt!' \ From 06c63c64c680cb19725e21cda7312a8628caa5b4 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sun, 27 Aug 2023 21:27:19 +0200 Subject: [PATCH 3/3] only fetch domain if needed Signed-off-by: Daniel Hansson --- apps/notify_push.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/notify_push.sh b/apps/notify_push.sh index d4982cd37c..75f1cd6551 100644 --- a/apps/notify_push.sh +++ b/apps/notify_push.sh @@ -42,7 +42,11 @@ fi check_nextcloud_https "Notify Push" # Get the NCDOMAIN variable -ncdomain +if [ -z $NCDOMAIN ] +then + ncdomain +fi + # Check apache conf if ! [ -f "$SITES_AVAILABLE/$NCDOMAIN.conf" ] then