From 943ec31536dabe4f2146253f3e478598cdafe4bf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 20 Mar 2021 19:08:44 +0100 Subject: [PATCH 1/3] Add permissions --- README.md | 1 + README_fr.md | 1 + manifest.json | 4 ++-- scripts/_variables | 26 +++++++++++++------------- scripts/install | 13 ++++++------- scripts/remove | 2 +- scripts/upgrade | 35 ++++++++++++----------------------- 7 files changed, 36 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 67a9db7..ee5080d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ You can also find a configuration file for Etherpad at this path `/var/www/ether * [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Adds author names to span titles* * [ep_automatic_logut](https://www.npmjs.com/package/ep_automatic_logut) - *Automatically disconnects user after some period of time (Prevent server overload)* * [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Adds comments on sidebar and link it to the text.* + * [ep_countable](https://www.npmjs.com/package/ep_countable) - *Adds paragraphs, words and characters count* * [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Delete pads which were never edited* * [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Apply colors to fonts* * [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Add support for Font Sizes* diff --git a/README_fr.md b/README_fr.md index ead6f39..6a9dfd9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -55,6 +55,7 @@ Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpa * [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Ajoute des noms d'auteurs* * [ep_automatic_logut](https://www.npmjs.com/package/ep_automatic_logut) - *Déconnecte automatiquement l'utilisateur après une certaine période de temps (Prévient la surcharge du serveur)* * [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajoute des commentaires sur la sidebar et le lie au texte.* + * [ep_countable](https://www.npmjs.com/package/ep_countable) - *Ajoute l'afficher le nombre de paragraphes, de mots et de caractères* * [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Supprimer les pads qui n'ont jamais été édités* * [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Appliquer les couleurs aux polices de caractères* * [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Permet de définir la taille de la police*. diff --git a/manifest.json b/manifest.json index 7e66103..a44fa03 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Online editor providing collaborative editing in real-time.", "fr": "Éditeur en ligne fournissant l'édition collaborative en temps réel." }, - "version": "1.8.4~ynh2", + "version": "1.8.4~ynh3", "url": "https://framapad.org", "license": "Apache-2.0", "maintainer": { @@ -105,7 +105,7 @@ "fr": "Voulez-vous installer le plugin MyPads ?" }, "help": { - "en": "mypads plugin" + "en": "MyPads plugin" }, "default": true }, diff --git a/scripts/_variables b/scripts/_variables index 70a9eb8..ec5a324 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -11,20 +11,20 @@ nodejs_version=12 # MyPads version # This variable is mostly used to force an upgrade of the package in case of new versions of MyPads. -mypads_version=1.7.17 +mypads_version=1.7.19 # Plugin versions -ep_align_version=0.2.5 -ep_author_hover_version=0.3.0 +ep_align_version=0.3.31 +ep_author_hover_version=0.3.17 ep_automatic_logut_version=1.0.8 -ep_comments_page_version=0.1.5 -#ep_countable_version=0.0.7 -ep_delete_empty_pads_version=0.0.6 -ep_font_color_version=0.0.15 -ep_headings2_version=0.1.3 -ep_markdown_version=0.1.7 +ep_comments_page_version=0.1.58 +ep_countable_version=0.0.9 +ep_delete_empty_pads_version=0.0.7 +ep_font_color_version=0.0.40 +ep_headings2_version=0.2.26 +ep_markdown_version=0.1.30 ep_page_view_version=0.5.24 -ep_spellcheck_version=0.0.7 -ep_subscript_and_superscript_version=0.1.2 -ep_table_of_contents_version=0.2.3 -ep_font_size_version=0.3.8 +ep_spellcheck_version=0.0.25 +ep_subscript_and_superscript_version=0.2.22 +ep_table_of_contents_version=0.3.18 +ep_font_size_version=0.4.19 diff --git a/scripts/install b/scripts/install index b3532a4..0e80c80 100644 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=3 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=is_public --value=$is_public ynh_print_OFF; ynh_app_setting_set --app=$app --key=password --value=$password; ynh_print_ON ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=export --value=$export @@ -250,7 +249,7 @@ npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>& # Framapad - Adds comments on sidebar and link it to the text. npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1 # Framapad - Displays paragraphs, sentences, words and characters counts. -#npm install ep_countable@${ep_countable_version} >> $install_log 2>&1 +npm install ep_countable@${ep_countable_version} >> $install_log 2>&1 # Framapad - Delete pads which were never edited npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1 # Framapad - Apply colors to fonts @@ -306,15 +305,15 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." --weight=2 if [ $is_public -eq 1 ]; then - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -else - # etherpad admin page doesn't support SSO... - ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" + ynh_permission_update --permission="main" --add="visitors" fi +# Etherpad admin page doesn't support SSO... +ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/remove b/scripts/remove index 5507df8..60f8e32 100755 --- a/scripts/remove +++ b/scripts/remove @@ -95,7 +95,7 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --weight=7 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7 # Remove the dedicated fail2ban config ynh_remove_fail2ban_config diff --git a/scripts/upgrade b/scripts/upgrade index 23f0a3b..e4ed5a5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) language=$(ynh_app_setting_get --app=$app --key=language) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) export=$(ynh_app_setting_get --app=$app --key=export) @@ -57,15 +56,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 -# Fix is_public as a boolean value -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 - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -135,6 +125,18 @@ if [ -z "$overwrite_systemd" ]; then ynh_app_setting_set $app overwrite_systemd $overwrite_systemd fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -404,19 +406,6 @@ then sed -i "$mod_line s@div>@&\n\t

Mypads
@" $final_path/src/templates/index.html fi -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ]; then - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -else - # etherpad admin page doesn't support SSO... - ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" -fi - #================================================= # RELOAD NGINX #================================================= From d037041b9a979b6d2f66942d33c1c66e2f3d961c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Mar 2021 14:13:12 +0100 Subject: [PATCH 2/3] Update check_process --- check_process | 1 - 1 file changed, 1 deletion(-) diff --git a/check_process b/check_process index 8672ecd..2ff2c0f 100644 --- a/check_process +++ b/check_process @@ -38,7 +38,6 @@ upgrade=1 backup_restore=1 multi_instance=1 - port_already_use=1 (9001) change_url=1 actions=1 config_panel=1 From 5ac9356765dd81c61467e3bb4e54a9fbf4608944 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Mar 2021 14:25:19 +0100 Subject: [PATCH 3/3] Add service description --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 0e80c80..cc6e39d 100644 --- a/scripts/install +++ b/scripts/install @@ -232,7 +232,7 @@ ynh_add_systemd_config # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/etherpad.log" +yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" #================================================= # INSTALL FRAMAPAD'S PLUGINS diff --git a/scripts/restore b/scripts/restore index 248d03c..d4da3c7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -141,7 +141,7 @@ chown -R $app: $final_path # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/etherpad.log" +yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index e4ed5a5..28521a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -364,7 +364,7 @@ chown $app -R /var/log/$app/etherpad.log # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/etherpad.log" +yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" #================================================= # UPGRADE FAIL2BAN