From f9039099e36bb98379d466f7ababea329a0f32a7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 4 May 2021 21:02:17 +0200 Subject: [PATCH 1/6] Add ynh_npm --- check_process | 2 +- manifest.json | 2 +- scripts/install | 28 ++++++++++++++-------------- scripts/upgrade | 28 ++++++++++++++-------------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/check_process b/check_process index 285af8f..85976fe 100644 --- a/check_process +++ b/check_process @@ -34,7 +34,7 @@ setup_public=1 upgrade=1 backup_restore=1 - multi_instance=0 + multi_instance=1 change_url=1 actions=1 config_panel=1 diff --git a/manifest.json b/manifest.json index 7cffa6e..7f318cf 100644 --- a/manifest.json +++ b/manifest.json @@ -20,7 +20,7 @@ "requirements": { "yunohost": ">= 4.1.7" }, - "multi_instance": false, + "multi_instance": true, "services": [ "nginx", "mysql" diff --git a/scripts/install b/scripts/install index e6eba05..5c4cb22 100644 --- a/scripts/install +++ b/scripts/install @@ -232,35 +232,35 @@ ynh_script_progression --message="Installing Etherpad plugins..." --weight=90 pushd "$final_path" # Add Left/Center/Right/Justify to lines of text in a pad -npm install ep_align@${ep_align_version} >> $install_log 2>&1 +ynh_npm install ep_align@${ep_align_version} >> $install_log 2>&1 # Framapad - Adds author names to span titles -npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1 +ynh_npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1 # Automatically disconnects user after some period of time (Prevent server overload) -npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1 +ynh_npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1 # Framapad - Adds comments on sidebar and link it to the text. -npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1 +ynh_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 +ynh_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 +ynh_npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1 # Framapad - Apply colors to fonts -npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1 +ynh_npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1 # Framapad - Adds heading support to Etherpad Lite. -npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1 +ynh_npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1 # Framapad - Edit and Export as Markdown in Etherpad -npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1 +ynh_npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1 if [ $mypads -eq 1 ]; then # Framapad - Groups and private pads for etherpad - npm install ep_mypads@${mypads_version} >> $install_log 2>&1 + ynh_npm install ep_mypads@${mypads_version} >> $install_log 2>&1 fi # Framapad - Add support to do 'Spell checking' -npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1 +ynh_npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1 # Framapad - Add support for Subscript and Superscript -npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1 +ynh_npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1 # Framapad - View a table of contents for your pad -npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1 +ynh_npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1 # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views -npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1 +ynh_npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1 popd chown -R $app: $final_path/node_modules diff --git a/scripts/upgrade b/scripts/upgrade index f4bb497..4b82926 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -285,35 +285,35 @@ ynh_script_progression --message="Installing Etherpad plugins..." --weight=90 pushd "$final_path" # Add Left/Center/Right/Justify to lines of text in a pad -npm install ep_align@${ep_align_version} >> $install_log 2>&1 +ynh_npm install ep_align@${ep_align_version} >> $install_log 2>&1 # Framapad - Adds author names to span titles -npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1 +ynh_npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1 # Automatically disconnects user after some period of time (Prevent server overload) -npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1 +ynh_npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1 # Framapad - Adds comments on sidebar and link it to the text. -npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1 +ynh_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 +ynh_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 +ynh_npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1 # Framapad - Apply colors to fonts -npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1 +ynh_npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1 # Framapad - Adds heading support to Etherpad Lite. -npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1 +ynh_npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1 # Framapad - Edit and Export as Markdown in Etherpad -npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1 +ynh_npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1 if [ $mypads -eq 1 ]; then # Framapad - Groups and private pads for etherpad - npm install ep_mypads@${mypads_version} >> $install_log 2>&1 + ynh_npm install ep_mypads@${mypads_version} >> $install_log 2>&1 fi # Framapad - Add support to do 'Spell checking' -npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1 +ynh_npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1 # Framapad - Add support for Subscript and Superscript -npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1 +ynh_npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1 # Framapad - View a table of contents for your pad -npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1 +ynh_npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1 # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views -npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1 +ynh_npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1 popd chown -R $app: $final_path/node_modules From bef653b4d987ef4a0983c9dc528f1e6b1ae31588 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 4 May 2021 22:14:35 +0200 Subject: [PATCH 2/6] Fix --- scripts/install | 9 ++++++--- scripts/upgrade | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5c4cb22..ad079eb 100644 --- a/scripts/install +++ b/scripts/install @@ -6,9 +6,12 @@ # IMPORT GENERIC HELPERS #================================================= +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi + # Load common variables for all scripts. source _variables - source _common.sh source /usr/share/yunohost/helpers @@ -270,7 +273,7 @@ chown -R $app: $final_path/node_modules if [ $mypads -eq 1 ] then - # Add a link to etherpad to allow anonymous pads creation from Mypads. + # Add a link to Etherpad to allow anonymous pads creation from MyPads. ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*" --replace_string="&Pads anonymes" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*" --replace_string="&Anonymous pads" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json # And a link to etherpad admin from Mypads. @@ -288,7 +291,7 @@ fi #================================================= ynh_script_progression --message="Configuring Fail2Ban..." --weight=13 -# Create a dedicated fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=" .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4b82926..6724a45 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -412,7 +412,7 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$ #================================================= ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8 -# Create a dedicated fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=" .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5 #================================================= From 2ee32ce4e36a575c21cd2b1477afa86fc53761a9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 4 May 2021 23:47:37 +0200 Subject: [PATCH 3/6] Update install --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index ad079eb..06a3063 100644 --- a/scripts/install +++ b/scripts/install @@ -281,9 +281,10 @@ then ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | Etherpad admin" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json # Find the /div just after the field to open a pad - mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) + #mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) # In order to add a link to mypads plugin. - sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html + #sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html + sed -i '157i

MyPads
' $final_path/src/templates/index.html fi #================================================= From 509199dcf8a0e3f363bad3b9690e62d480baf2dc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 5 May 2021 00:01:16 +0200 Subject: [PATCH 4/6] Fix triple mypads links --- scripts/install | 4 ++-- scripts/upgrade | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 06a3063..9399bc2 100644 --- a/scripts/install +++ b/scripts/install @@ -280,9 +280,9 @@ then ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | Etherpad admin" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | Etherpad admin" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json - # Find the /div just after the field to open a pad + ## Find the /div just after the field to open a pad #mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) - # In order to add a link to mypads plugin. + ## In order to add a link to MyPads plugin. #sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html sed -i '157i

MyPads
' $final_path/src/templates/index.html fi diff --git a/scripts/upgrade b/scripts/upgrade index 6724a45..8594965 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -440,10 +440,11 @@ fi if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ] then - # Find the /div just after the field to open a pad - mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) - # In order to add a link to mypads plugin. - sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html + # # Find the /div just after the field to open a pad + # mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) + # # In order to add a link to mypads plugin. + # sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html + sed -i '157i

MyPads
' $final_path/src/templates/index.html fi #================================================= From 71a179ef95dbf441a49ed76481fad0ba49313e5e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 5 May 2021 08:26:29 +0200 Subject: [PATCH 5/6] Remove text-decoration --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 9399bc2..b8f2f3b 100644 --- a/scripts/install +++ b/scripts/install @@ -284,7 +284,7 @@ then #mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) ## In order to add a link to MyPads plugin. #sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html - sed -i '157i

MyPads
' $final_path/src/templates/index.html + sed -i '157i

MyPads
' $final_path/src/templates/index.html fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8594965..91c6c14 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -444,7 +444,7 @@ then # mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1) # # In order to add a link to mypads plugin. # sed -i "$mod_line s@div>@&\n\t

MyPads
@" $final_path/src/templates/index.html - sed -i '157i

MyPads
' $final_path/src/templates/index.html + sed -i '157i

MyPads
' $final_path/src/templates/index.html fi #================================================= From d7425cda38f199e086308ae482fc029c9b114902 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 5 May 2021 08:46:16 +0200 Subject: [PATCH 6/6] Do not send password by email --- scripts/install | 6 +----- scripts/remove | 2 +- scripts/restore | 4 ---- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index b8f2f3b..f96a9f3 100644 --- a/scripts/install +++ b/scripts/install @@ -340,7 +340,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) if [ $mypads -eq 1 ] then - Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin." + Informations="You can access two different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin." else Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin." fi @@ -349,10 +349,6 @@ ynh_print_OFF echo "$Informations You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json. -Your credentials for the admin panel are: -- login : $admin -- password : $password - You can configure this app easily by using the experimental config-panel feature $admin_panel/config-panel. You can also find some specific actions for this app by using the experimental action feature $admin_panel/actions. diff --git a/scripts/remove b/scripts/remove index f7bf183..5378b48 100755 --- a/scripts/remove +++ b/scripts/remove @@ -97,7 +97,7 @@ ynh_remove_logrotate #================================================= ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7 -# Remove the dedicated fail2ban config +# Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index e037cda..49073ed 100644 --- a/scripts/restore +++ b/scripts/restore @@ -198,10 +198,6 @@ ynh_print_OFF echo "$Informations You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json. -Your credentials for the admin panel are: -- login : $admin -- password : $password - If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=restore