From 07dabdf166a2b16a42f2260b213c7106d2e86189 Mon Sep 17 00:00:00 2001 From: liberodark Date: Tue, 20 Nov 2018 23:37:34 +0100 Subject: [PATCH] fix and clean --- conf/nginx.conf | 2 +- conf/nginx.conf.old | 19 ------------------- manifest.json | 11 +++++++++++ scripts/install | 8 +++++--- 4 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 conf/nginx.conf.old diff --git a/conf/nginx.conf b/conf/nginx.conf index 5a74de2..d9826db 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,7 +6,7 @@ location ^~ __PATH__/ { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; - add_header X-Frame-Options "ALLOW-FROM https://__DOMAIN__/"; + add_header X-Frame-Options "ALLOW-FROM https://__NEXTCLOUDDOMAIN__/"; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/conf/nginx.conf.old b/conf/nginx.conf.old deleted file mode 100644 index 9c23714..0000000 --- a/conf/nginx.conf.old +++ /dev/null @@ -1,19 +0,0 @@ -# static files -location ^~ /loleaflet { - proxy_pass http://localhost:__PORT__; - proxy_set_header Host $http_host; -} - -# WOPI discovery URL -location ^~ /hosting/discovery { - proxy_pass http://localhost:__PORT__; - proxy_set_header Host $http_host; -} - -# websockets, download, presentation and image upload -location ^~ /lool { - proxy_pass http://localhost:__PORT__; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; -} diff --git a/manifest.json b/manifest.json index 157406d..baed30f 100644 --- a/manifest.json +++ b/manifest.json @@ -31,6 +31,17 @@ }, "example": "example.com" }, + + { + "name": "nextclouddomain", + "type": "string", + "ask": { + "en": "The domain of your Nextcloud instance", + "fr": "Le domain de votre instance Nextcloud" + }, + "example": "example.com", + "default": "" + } { "name": "path", diff --git a/scripts/install b/scripts/install index 64034d0..e320280 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +nextcloud_domain=$YNH_APP_ARG_NEXTCLOUDDOMAIN ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -63,6 +64,7 @@ ynh_webpath_register $app $domain $path_url #================================================= ynh_app_setting_set $app domain $domain +ynh_app_setting_set $app nextcloud_domain $nextcloud_domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app is_public $is_public @@ -147,6 +149,7 @@ sudo apt-get install -y onlyoffice-documentserver #================================================= # Create a dedicated nginx config +#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "../conf/nginx.conf" ynh_add_nginx_config #================================================= @@ -163,15 +166,14 @@ ynh_system_user_create $app # Fix https://github.com/ONLYOFFICE/onlyoffice-owncloud/issues/172#issuecomment-411746394 cp -a ../conf/default.json /etc/onlyoffice/documentserver/default.json +#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/nginx/conf.d/$domain.d/onlyoffice.conf" + # Fix Nextcloud http://dev.onlyoffice.org/viewtopic.php?f=53&t=10001 #sed -i "/# Add headers to serve security.*/a \ \ \ \ add_header X-Frame-Options \"ALLOW-FROM https://$domain/\";" /etc/nginx/conf.d/$nextcloud_domain.d/nextcloud.conf # Fix OnlyOffice http://dev.onlyoffice.org/viewtopic.php?f=53&t=10001 #sed -i "/# Add headers to serve security.*/a \ \ \ \ add_header X-Frame-Options \"ALLOW-FROM https://$domain/\";" /etc/nginx/conf.d/$domain.d/onlyoffice.conf -#cp -a ../conf/onlyoffice-documentserver.conf /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf -#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml" - #================================================= # STORE THE CONFIG FILE CHECKSUM #=================================================