Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorszaimen <szaimen@e.mail.de>2021-05-27 10:54:27 +0300
committerGitHub <noreply@github.com>2021-05-27 10:54:27 +0300
commitc2ea6df9bc002c2d406d61c6e1ac533f2670aec8 (patch)
tree7c33166548fdad401e302be497a5418a1dc63427 /apps
parent96814404334504ad5c0cef76e2a925dd177aa2d0 (diff)
make trusted_domain removal and addition its own function (#1990)
Diffstat (limited to 'apps')
-rw-r--r--apps/collabora_docker.sh76
-rw-r--r--apps/collabora_integrated.sh41
-rw-r--r--apps/onlyoffice_docker.sh76
-rw-r--r--apps/onlyoffice_integrated.sh41
-rw-r--r--apps/pico_cms.sh65
5 files changed, 154 insertions, 145 deletions
diff --git a/apps/collabora_docker.sh b/apps/collabora_docker.sh
index 24b36dd9..fe4c76e4 100644
--- a/apps/collabora_docker.sh
+++ b/apps/collabora_docker.sh
@@ -17,6 +17,41 @@ debug_mode
# Check if root
root_check
+# TODO: remove both functions with NC21.0.3 release
+add_to_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Adding $element to trusted domains..."
+ while [ "$count" -le 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ break
+ elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
+ then
+ nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$element"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+remove_from_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Removing $element from trusted domains..."
+ while [ "$count" -lt 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ nextcloud_occ_no_check config:system:delete trusted_domains "$count"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+
# Check if Collabora is already installed
print_text_in_color "$ICyan" "Checking if Collabora is already installed..."
if ! does_this_docker_exist 'collabora/code'
@@ -53,17 +88,7 @@ else
nextcloud_occ app:remove richdocuments
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
# Show successful uninstall if applicable
removal_popup "$SCRIPT_NAME"
fi
@@ -91,17 +116,7 @@ then
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# remove OnlyOffice-documentserver if activated
@@ -345,21 +360,8 @@ if is_app_installed richdocuments
then
nextcloud_occ config:app:set richdocuments wopi_url --value=https://"$SUBDOMAIN"
chown -R www-data:www-data "$NC_APPS_PATH"
- print_text_in_color "$ICyan" "Appending the new subdomain to trusted Domains..."
- count=0
- while [ "$count" -le 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$SUBDOMAIN" ]
- then
- break
- elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
- then
- nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$SUBDOMAIN"
- break
- else
- count=$((count+1))
- fi
- done
+ # Appending the new domain to trusted domains
+ add_to_trusted_domains "$SUBDOMAIN"
# Add prune command
add_dockerprune
# Restart Docker
diff --git a/apps/collabora_integrated.sh b/apps/collabora_integrated.sh
index 598f0619..82c33b7c 100644
--- a/apps/collabora_integrated.sh
+++ b/apps/collabora_integrated.sh
@@ -20,6 +20,23 @@ debug_mode
# Check if root
root_check
+# TODO: remove this with NC21.0.3 release
+remove_from_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Removing $element from trusted domains..."
+ while [ "$count" -lt 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ nextcloud_occ_no_check config:system:delete trusted_domains "$count"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+
# Check if Collabora is installed using the new method
if ! is_app_installed richdocumentscode
then
@@ -64,17 +81,7 @@ We will now remove the old docker and install the app from Nextcloud instead."
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# Check if Onlyoffice is installed and remove every trace of it
@@ -101,17 +108,7 @@ then
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# remove OnlyOffice-documentserver if activated
diff --git a/apps/onlyoffice_docker.sh b/apps/onlyoffice_docker.sh
index a804d834..34a4ca8f 100644
--- a/apps/onlyoffice_docker.sh
+++ b/apps/onlyoffice_docker.sh
@@ -17,6 +17,41 @@ debug_mode
# Check if root
root_check
+# TODO: remove both functions with NC21.0.3 release
+add_to_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Adding $element to trusted domains..."
+ while [ "$count" -le 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ break
+ elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
+ then
+ nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$element"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+remove_from_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Removing $element from trusted domains..."
+ while [ "$count" -lt 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ nextcloud_occ_no_check config:system:delete trusted_domains "$count"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+
# Check if collabora is already installed
if ! does_this_docker_exist 'onlyoffice/documentserver'
then
@@ -47,17 +82,7 @@ else
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
# Show successful uninstall if applicable
removal_popup "$SCRIPT_NAME"
fi
@@ -86,17 +111,7 @@ then
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# remove OnlyOffice-documentserver if activated
@@ -336,21 +351,8 @@ if [ -d "$NC_APPS_PATH"/onlyoffice ]
then
nextcloud_occ config:app:set onlyoffice DocumentServerUrl --value=https://"$SUBDOMAIN/"
chown -R www-data:www-data "$NC_APPS_PATH"
- print_text_in_color "$ICyan" "Appending the new subdomain to trusted Domains..."
- count=0
- while [ "$count" -le 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$SUBDOMAIN" ]
- then
- break
- elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
- then
- nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$SUBDOMAIN"
- break
- else
- count=$((count+1))
- fi
- done
+ # Appending the new domain to trusted domains
+ add_to_trusted_domains "$SUBDOMAIN"
# Add prune command
add_dockerprune
# Restart Docker
diff --git a/apps/onlyoffice_integrated.sh b/apps/onlyoffice_integrated.sh
index 909ea780..06da661b 100644
--- a/apps/onlyoffice_integrated.sh
+++ b/apps/onlyoffice_integrated.sh
@@ -20,6 +20,23 @@ debug_mode
# Check if root
root_check
+# TODO: remove this with NC21.0.3 release
+remove_from_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Removing $element from trusted domains..."
+ while [ "$count" -lt 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ nextcloud_occ_no_check config:system:delete trusted_domains "$count"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+
# Check if Collabora is installed using the new method
if ! is_app_installed documentserver_community
then
@@ -69,17 +86,7 @@ We will now remove Collabora from the server."
nextcloud_occ app:remove richdocuments
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# Check if Onlyoffice is installed and remove every trace of it
@@ -106,17 +113,7 @@ then
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
# remove Richdocumentscode if activated
diff --git a/apps/pico_cms.sh b/apps/pico_cms.sh
index 6d2774f2..b5800872 100644
--- a/apps/pico_cms.sh
+++ b/apps/pico_cms.sh
@@ -18,6 +18,41 @@ debug_mode
# Check if root
root_check
+# TODO: remove both functions with NC21.0.3 release
+add_to_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Adding $element to trusted domains..."
+ while [ "$count" -le 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ break
+ elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
+ then
+ nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$element"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+remove_from_trusted_domains() {
+ local element="$1"
+ local count=0
+ print_text_in_color "$ICyan" "Removing $element from trusted domains..."
+ while [ "$count" -lt 10 ]
+ do
+ if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$element" ]
+ then
+ nextcloud_occ_no_check config:system:delete trusted_domains "$count"
+ break
+ else
+ count=$((count+1))
+ fi
+ done
+}
+
# Nextcloud Main Domain
NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
@@ -75,17 +110,7 @@ E.g. 'sites.yourdomain.com' or 'blog.yourdomain.com'")
rm -f "$SITES_AVAILABLE/$SUBDOMAIN.conf"
fi
# Remove trusted domain
- count=0
- while [ "$count" -lt 10 ]
- do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$SUBDOMAIN" ]
- then
- nextcloud_occ_no_check config:system:delete trusted_domains "$count"
- break
- else
- count=$((count+1))
- fi
- done
+ remove_from_trusted_domains "$SUBDOMAIN"
fi
sed -i "/#Pico-CMS-start/,/#Pico-CMS-end/d" "$SITES_AVAILABLE/$NCDOMAIN.conf"
systemctl restart apache2
@@ -332,22 +357,8 @@ else
exit 1
fi
-# Appending the new local IP-address to trusted Domains
-print_text_in_color "$ICyan" "Appending the new subdomain to trusted Domains..."
-count=0
-while [ "$count" -le 10 ]
-do
- if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" = "$SUBDOMAIN" ]
- then
- break
- elif [ -z "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" ]
- then
- nextcloud_occ_no_check config:system:set trusted_domains "$count" --value="$SUBDOMAIN"
- break
- else
- count=$((count+1))
- fi
-done
+# Appending the new domain to trusted domains
+add_to_trusted_domains "$SUBDOMAIN"
# Inform user
msg_box "Pico CMS was successfully installed!