From 77a4ae4f30001060b8d89ecae405d7538afd0b00 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 27 Dec 2020 19:16:44 +0100 Subject: [PATCH] Fix --- conf/.env.example | 2 +- conf/nginx.conf | 3 +++ scripts/install | 18 ++++++++++++------ scripts/restore | 2 +- scripts/upgrade | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/conf/.env.example b/conf/.env.example index 57d4ef9..c3b742c 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -33,7 +33,7 @@ TIMEZONE=UTC # folders in which the files will be stored LYCHEE_DIST="/var/www/__APP__/public/dist/" -LYCHEE_UPLOADS="/home/yunohost.__APP__/uploads/" +LYCHEE_UPLOADS="/home/yunohost.app/__APP__/uploads/" # url to access those files # LYCHEE_DIST_URL="dist/" diff --git a/conf/nginx.conf b/conf/nginx.conf index eb96731..b8cda6a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -27,7 +27,10 @@ location ^~ __PATH__/ { fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; + } + location __PATH__/uploads/ { + alias __PUBLIC_PATH__/uploads/ ; } # Include SSOWAT user panel. diff --git a/scripts/install b/scripts/install index 9a92df9..f4c9dea 100755 --- a/scripts/install +++ b/scripts/install @@ -33,9 +33,14 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +public_path=/home/yunohost.app/$app +test ! -e "${public_path}" || ynh_die --message="$public_path already exists" + # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +ynh_app_setting_set --app=$app --key=public_path --value=$public_path + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -104,8 +109,6 @@ ynh_script_progression --message="Installing Lychee with Composer..." --weight=1 # Install composer ynh_install_composer -#ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update --lock" - #================================================= # BUILDING #================================================= @@ -141,8 +144,11 @@ ynh_store_file_checksum "$final_path/.env" # CREATE DIRECTORIES #================================================= -mkdir -p /home/yunohost.$app/uploads -mkdir -p /home/yunohost.$app/uploads/{big,medium,small,thumb,import,raw} +mkdir -p $public_path/uploads +mkdir -p $public_path/uploads/{big,import,medium,raw,small,thumb,raw} + +# Create a dedicated NGINX config +ynh_add_nginx_config "public_path" #================================================= # SECURE FILES AND DIRECTORIES @@ -150,8 +156,8 @@ mkdir -p /home/yunohost.$app/uploads/{big,medium,small,thumb,import,raw} # Set permissions to app files chown -R $app: $final_path -chown -R $app: /home/yunohost.$app -chmod -R 755 /home/yunohost.$app +chown -R $app: $public_path +chmod -R 755 $public_path #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a6aaa84..38c3b3e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -83,7 +83,7 @@ ynh_restore_file --origin_path="/home/yunohost.$app" --not_mandatory # Restore permissions on app files chown -R $app: $final_path -chmod -R 755 /home/yunohost.$app +chmod -R 755 $public_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 0e8b93e..9474fb5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -146,7 +146,7 @@ ynh_store_file_checksum --file="$final_path/.env" # Set permissions on app files chown -R $app: $final_path -chmod -R 755 /home/yunohost.$app +chmod -R 755 $public_path #================================================= # RELOAD NGINX