From 79c0589a8189e79c69272a270bf23d30d9f34166 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 10 Sep 2021 22:10:09 +0200 Subject: [PATCH 1/4] patch --- check_process | 2 +- manifest.json | 8 ++-- scripts/_common.sh | 108 --------------------------------------------- scripts/install | 10 +---- scripts/restore | 2 - scripts/upgrade | 25 +---------- 6 files changed, 8 insertions(+), 147 deletions(-) diff --git a/check_process b/check_process index 5d9f0e3..b1aaef9 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,7 @@ password="pass" language="fr" market=1 - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 ; Actions is_public=0|1 ; Config_panel diff --git a/manifest.json b/manifest.json index 70b97ce..5876f0d 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "leed", "packaging_format": 1, "description": { - "en": "Minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.", - "fr": "Agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive." + "en": "Minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds", + "fr": "Agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive" }, "version": "1.9.0~ynh1", "url": "http://leed.idleman.fr/", @@ -18,12 +18,12 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 4.1.0" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index a7ea7cb..96ffe33 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,118 +6,10 @@ YNH_PHP_VERSION="7.3" -#================================================= -# PACKAGE CHECK BYPASSING... -#================================================= - -IS_PACKAGE_CHECK () { - if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ] - then - return 0 - else - return 1 - fi -} - -#================================================= -# BOOLEAN CONVERTER -#================================================= - -bool_to_01 () { - local var="$1" - [ "$var" = "true" ] && var=1 - [ "$var" = "false" ] && var=0 - echo "$var" -} - -bool_to_true_false () { - local var="$1" - [ "$var" = "1" ] && var=true - [ "$var" = "0" ] && var=false - echo "$var" -} - #================================================= # FUTUR OFFICIAL HELPERS #================================================= -# Install or update the main directory yunohost.multimedia -# -# usage: ynh_multimedia_build_main_dir -ynh_multimedia_build_main_dir () { - local ynh_media_release="v1.2" - local checksum="806a827ba1902d6911095602a9221181" - - # Download yunohost.multimedia scripts - wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1 - - # Check the control sum - echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ - || ynh_die "Corrupt source" - - # Check if the package acl is installed. Or install it. - ynh_package_is_installed 'acl' \ - || ynh_package_install acl - - # Extract - mkdir yunohost.multimedia-master - tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1 - ./yunohost.multimedia-master/script/ynh_media_build.sh -} - -# Add a directory in yunohost.multimedia -# This "directory" will be a symbolic link to a existing directory. -# -# usage: ynh_multimedia_addfolder "Source directory" "Destination directory" -# -# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias. -# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia" -ynh_multimedia_addfolder () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= ) - local source_dir - local dest_dir - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - ./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir" -} - -# Move a directory in yunohost.multimedia, and replace by a symbolic link -# -# usage: ynh_multimedia_movefolder "Source directory" "Destination directory" -# -# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias. -# It will be moved to "Destination directory" -# A symbolic link will replace it. -# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia" -ynh_multimedia_movefolder () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= ) - local source_dir - local dest_dir - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - ./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir" -} - -# Allow an user to have an write authorisation in multimedia directories -# -# usage: ynh_multimedia_addaccess user_name -# -# | arg: -u, --user_name= - The name of the user which gain this access. -ynh_multimedia_addaccess () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [u]=user_name=) - local user_name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - groupadd -f multimedia - usermod -a -G multimedia $user_name -} - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index a56a5b8..4389450 100644 --- a/scripts/install +++ b/scripts/install @@ -112,9 +112,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Setuping application with CURL..." --weight=5 -# Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." -# Making the app public for curl +# Making the app public for cURL ynh_permission_update --permission="main" --add="visitors" # Installation with curl @@ -152,15 +150,11 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=2 - - +ynh_script_progression --message="Configuring permissions..." --weight=2 # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/restore b/scripts/restore index 673ae98..2a1b644 100644 --- a/scripts/restore +++ b/scripts/restore @@ -37,8 +37,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) #================================================= ynh_script_progression --message="Validating restoration parameters..." -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " diff --git a/scripts/upgrade b/scripts/upgrade index 8a42559..cc61240 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,27 +79,6 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -# If is_public doesn't exist, create it -if [ -z "$is_public" ]; then - public_check=$(ynh_app_setting_get --app=$app --key=skipped_uris) - # If skipped_uris is empty, that was a public installation. - if [ -z "$public_check" ]; then - is_public=1 - else - is_public=0 - fi - ynh_app_setting_set --app=$app --key=is_public --value=$is_public -else - # Fix is_public as a boolean - if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 - elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 - fi -fi - # If overwrite_nginx doesn't exist, create it if [ -z "$overwrite_nginx" ]; then overwrite_nginx=1 @@ -220,9 +199,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading Leed with cURL..." --weight=4 # Set the app as temporarily public for curl call - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" - # Regen SSOwat configuration - yunohost app ssowatconf + ynh_permission_update --permission="main" --add="visitors" # Start the upgrade procedure of leed. ynh_local_curl "/" fi From 5e50e11963fa78fad17001dd2a3be53fac6aa68e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 25 Sep 2021 16:03:35 +0200 Subject: [PATCH 2/4] Fix --- manifest.json | 9 +++------ scripts/install | 2 +- scripts/upgrade | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index 5876f0d..4fbed97 100644 --- a/manifest.json +++ b/manifest.json @@ -30,8 +30,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "path", @@ -41,8 +40,7 @@ }, { "name": "admin", - "type": "user", - "example": "john" + "type": "user" }, { "name": "is_public", @@ -65,8 +63,7 @@ }, { "name": "password", - "type": "password", - "example": "Choose a password" + "type": "password" } ] } diff --git a/scripts/install b/scripts/install index 4389450..89cf532 100644 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -ynh_print_OFF; user_pwd=$YNH_APP_ARG_PASSWORD; ynh_print_ON +user_pwd=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/upgrade b/scripts/upgrade index cc61240..bcde239 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -202,6 +202,7 @@ then ynh_permission_update --permission="main" --add="visitors" # Start the upgrade procedure of leed. ynh_local_curl "/" + ynh_permission_update --permission="main" --remove="visitors" fi #================================================= From db07cd5324576e39cafebaeebcb9d40ba98cb332 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 25 Sep 2021 23:17:14 +0200 Subject: [PATCH 3/4] Fix --- scripts/install | 5 ++--- scripts/upgrade | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 89cf532..e1538ba 100644 --- a/scripts/install +++ b/scripts/install @@ -50,7 +50,7 @@ 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=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language - +ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=1 ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 @@ -117,9 +117,8 @@ ynh_permission_update --permission="main" --add="visitors" # Installation with curl ynh_script_progression --message="Finalizing installation..." -ynh_print_OFF + ynh_local_curl "/install.php?installButton" "install_changeLngLeed=$language" "root=$domain$path_url" "mysqlHost=localhost" "mysqlLogin=$db_name" "mysqlMdp=$db_pwd" "mysqlBase=$db_name" "mysqlPrefix=leed_" "login=$admin" "password=$user_pwd" -ynh_print_ON # Remove the public access ynh_permission_update --permission="main" --remove="visitors" diff --git a/scripts/upgrade b/scripts/upgrade index bcde239..54f6ec0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -215,6 +215,17 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8 # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: " --max_retry=5 +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Configuring permissions..." --weight=1 + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + ynh_permission_update --permission="main" --add="visitors" +fi + #================================================= # RELOAD NGINX #================================================= From 69a74adb882c0cf4fdc997fb9c0818a2d19ab86c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Sep 2021 07:56:27 +0200 Subject: [PATCH 4/4] fix --- conf/app.src | 1 - scripts/install | 2 -- 2 files changed, 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index ee55626..f3251ab 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,5 +3,4 @@ SOURCE_SUM=e8a9c4586234169e2dd96e6c6e90e140a2336950c3b259947b70b0b0b6ff903c SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/scripts/install b/scripts/install index e1538ba..0fa8988 100644 --- a/scripts/install +++ b/scripts/install @@ -171,7 +171,6 @@ ynh_systemd_action --service_name=nginx --action=reload # Get main domain and buid the url of the admin panel of the app. admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app" -ynh_print_OFF echo "Please take note of your password for this application: '$user_pwd'. You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__. @@ -180,7 +179,6 @@ You can also find some specific actions for this app by using the experimental _ If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/leed_ynh__URL_TAG3__." > mail_to_send ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=install -ynh_print_ON #================================================= # END OF SCRIPT