1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00

Merge pull request #137 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-05-05 18:28:43 +02:00 committed by GitHub
commit 982eda4efa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 52 deletions

View file

@ -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

View file

@ -20,7 +20,7 @@
"requirements": {
"yunohost": ">= 4.1.7"
},
"multi_instance": false,
"multi_instance": true,
"services": [
"nginx",
"mysql"

View file

@ -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
@ -232,35 +235,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
@ -270,17 +273,18 @@ 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\": .*</ul>" --replace_string="&<a href=../>Pads anonymes</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Anonymous pads</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
# And a link to etherpad admin from Mypads.
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --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 "</div>" | cut -d '-' -f 1)
# In order to add a link to mypads plugin.
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $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 "</div>" | cut -d '-' -f 1)
## In order to add a link to MyPads plugin.
#sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $final_path/src/templates/index.html
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none">MyPads</a></font></center>' $final_path/src/templates/index.html
fi
#=================================================
@ -288,7 +292,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="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
@ -336,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
@ -345,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.

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
@ -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="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
@ -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 "</div>" | cut -d '-' -f 1)
# In order to add a link to mypads plugin.
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $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 "</div>" | cut -d '-' -f 1)
# # In order to add a link to mypads plugin.
# sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $final_path/src/templates/index.html
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none">MyPads</a></font></center>' $final_path/src/templates/index.html
fi
#=================================================