diff --git a/conf/.env.example b/conf/.env.example index 7b8e2a8..dbf7bd6 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -32,8 +32,8 @@ DB_LOG_SQL=false TIMEZONE=UTC # folders in which the files will be stored -#LYCHEE_DIST="/var/www/__APP__/public/dist/" -#LYCHEE_UPLOADS="/var/www/__APP__/public/uploads/" +LYCHEE_DIST="__FINALPATH__/public/dist/" +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 49eb90b..e0885e7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -30,6 +30,10 @@ location ^~ __PATH__/ { } + location __PATH__/uploads/ { + alias __PUBLIC_PATH__/uploads/ ; + } + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index c1a6f44..a4d5b1e 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -426,5 +426,5 @@ php_admin_value[post_max_size] = 512M ; Other common parameters php_admin_value[max_execution_time] = 200 ; php_admin_value[max_input_time] = 300 -; php_admin_value[memory_limit] = 256M +php_admin_value[memory_limit] = 256M ; php_admin_flag[short_open_tag] = On diff --git a/conf/user.css.example b/conf/user.css.example new file mode 100644 index 0000000..b6ed836 --- /dev/null +++ b/conf/user.css.example @@ -0,0 +1,23 @@ +/* Disable the 'zoom' animation while browsing pictures */ +#imageview #image { + transition: none !important; + animation-name: none !important; + animation-duration: 0 !important; +} + +/* Hide smart albums */ +/* +[data-id="0"] { display:none; } +[data-id="s"] { display:none; } +[data-id="f"] { display:none; } +[data-id="r"] { display:none; } +*/ + +/* Make the diadnostic font bigger */ +.settings_view p, .settings_view a, .settings_view input, +.sharing_view p, .sharing_view a, .sharing_view input, .sharing_view option, +.users_view p, .users_view a, .users_view input, .users_view option, +.logs_diagnostics_view pre { + font-size: 12pt; + line-height: 14pt; +} diff --git a/issue_template.md b/issue_template.md index 8d8a7db..7e9710a 100644 --- a/issue_template.md +++ b/issue_template.md @@ -22,7 +22,7 @@ about: When creating a bug report, please use the following template to provide - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - YunoHost version: x.x.x - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* -- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* - If yes, please explain: - Using, or trying to install package version/branch: - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* diff --git a/scripts/_common.sh b/scripts/_common.sh index a7309f9..0114157 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,9 @@ YNH_PHP_VERSION=7.3 extra_php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip" +# needed for raw upload and video playback +pkg_dependencies="ufraw-batch ffmpeg" + #================================================= # EXPERIMENTAL HELPERS #================================================= @@ -65,7 +68,7 @@ ynh_install_composer () { curl -sS https://getcomposer.org/installer 2>&1 \ | COMPOSER_HOME="$workdir/.composer" \ php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \ - || ynh_die "Unable to install Composer." + || ynh_die "Unable to install Composer." 2>&1 # update dependencies to create composer.lock ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \ diff --git a/scripts/backup b/scripts/backup index e7ee942..e5ee3e8 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,6 +24,7 @@ ynh_print_info --message="Backing up Lychee..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -38,7 +39,7 @@ ynh_backup --src_path="$final_path" # BACKUP MEDIA FOLDER #================================================= -#ynh_backup --src_path="/home/yunohost.$app" --is_big +ynh_backup --src_path="$public_path" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 91de147..56aa2cf 100755 --- a/scripts/install +++ b/scripts/install @@ -33,6 +33,9 @@ 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 @@ -45,6 +48,13 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=is_public --value=$is_public +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=3 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -62,15 +72,18 @@ ynh_script_progression --message="Setting up source files..." --weight=3 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir=$final_path #================================================= -# NGINX CONFIGURATION +# CREATE DIRECTORIES #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +ynh_app_setting_set --app=$app --key=public_path --value=$public_path +mkdir -p ${public_path}/uploads +mkdir -p ${public_path}/uploads/{big,import,medium,raw,small,thumb} # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_add_nginx_config "public_path" #================================================= # CREATE DEDICATED USER @@ -95,7 +108,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Installing Lychee with Composer..." --weight=15 # Install composer -ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--prefer-source --no-dev" +ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--prefer-source --no-dev" #================================================= # BUILDING @@ -108,36 +121,34 @@ cp ../conf/.env.example $final_path/.env ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.env" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" -# setup application config -cd $final_path && php$phpversion artisan key:generate -n --force --env -cd $final_path && php$phpversion artisan migrate -n --force -cd $final_path && php$phpversion artisan config:clear -n -cd $final_path && php$phpversion artisan config:cache -n +# Setup application config +pushd "$final_path" + php$phpversion artisan key:generate -n --force --env + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd + +# Setup custom user.css file +cp ../conf/user.css.example $final_path/public/dist/user.css #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_script_progression --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings 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} - #================================================= # SECURE FILES AND DIRECTORIES #================================================= # Set permissions to app files chown -R $app: $final_path -#chown -R $app: /home/yunohost.${app} -#chmod -R 750 /home/yunohost.${app} +chown -R $app: ${public_path} +chmod -R 755 ${public_path} #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 17714d2..17553ec 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name @@ -30,6 +31,7 @@ ynh_script_progression --message="Removing Lychee main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" +ynh_secure_remove --file="$public_path" #================================================= # REMOVE THE MYSQL DATABASE @@ -39,6 +41,14 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=2 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index c0296af..fe5f82e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -25,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -65,10 +66,10 @@ ynh_system_user_create --username=$app #================================================= # RESTORE DATA #================================================= -#ynh_script_progression --message="Restoring Lychee data..." +ynh_script_progression --message="Restoring Lychee data..." # Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. -#ynh_restore_file --origin_path="/home/yunohost.$app" --not_mandatory +ynh_restore_file --origin_path=$public_path --not_mandatory #================================================= # RESTORE USER RIGHTS @@ -76,7 +77,16 @@ ynh_system_user_create --username=$app # Restore permissions on app files chown -R $app: $final_path -#chmod -R 750 /home/yunohost.$app/{uploads,data} +chown -R $app: $public_path +chmod -R 750 $public_path + +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=7 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 1d0067a..4a11512 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -56,6 +57,16 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If public_path doesn't exist, create it +if [ -z "$public_path" ]; then + public_path=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=public_path --value=$public_path +fi + +if [ ! -d "$public_path/uploads" ]; then + mkdir -p $public_path/uploads +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -118,9 +129,11 @@ ynh_install_composer ynh_exec_warn_less ynh_composer_exec --commands=\"dump-autoload\" -( cd $final_path && php$phpversion artisan migrate -n --force ) -( cd $final_path && php$phpversion artisan config:clear -n ) -( cd $final_path && php$phpversion artisan config:cache -n ) +pushd "$final_path" + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. @@ -132,7 +145,8 @@ ynh_store_file_checksum --file="$final_path/.env" # Set permissions on app files chown -R $app: $final_path -#chmod -R 750 /home/yunohost.$app/{uploads,data} +chown -R $app: $public_path +chmod -R 750 $public_path #================================================= # RELOAD NGINX