Skip to content

Commit 764f541

Browse files
authored
improve the https check (#2555)
1 parent 0b8c0ab commit 764f541

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

apps/notify_push.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ fi
4141
# Check TLS
4242
check_nextcloud_https "Notify Push"
4343

44+
# Get the NCDOMAIN variable
45+
if [ -z $NCDOMAIN ]
46+
then
47+
ncdomain
48+
fi
49+
4450
# Check apache conf
45-
NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
4651
if ! [ -f "$SITES_AVAILABLE/$NCDOMAIN.conf" ]
4752
then
4853
msg_box "It seems like you haven't used the built-in 'Activate TLS' script to enable 'Let's Encrypt!' \

lib.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,13 @@ fi
747747

748748
# Check if Nextcloud is installed with TLS
749749
check_nextcloud_https() {
750-
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
750+
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
751+
then
752+
# Check if it's used by any of the Documentserver apps and adopt the message to that
753+
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
751754
then
752-
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
755+
ncdomain
756+
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
753757
then
754758
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
755759
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
758762
To run this script again, just exectue 'sudo bash $SCRIPTS/menu.sh' and choose:
759763
Additional Apps --> Documentserver --> $1."
760764
exit
761-
else
765+
fi
766+
else
767+
# Adopt the error message to anything else but the Documentserver apps
768+
ncdomain
769+
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
770+
then
762771
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
763772
You can easily activate TLS (HTTPS) by running the Let's Encrypt script.
764773
More info here: http://shortio.hanssonit.se/1EAgBmPyFc
@@ -768,6 +777,7 @@ Additional Apps --> $1."
768777
exit
769778
fi
770779
fi
780+
fi
771781
}
772782

773783
restart_webserver() {

0 commit comments

Comments
 (0)