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 branch 'fix' into ci-auto-update-2.0.3

This commit is contained in:
Éric Gaspar 2024-05-12 17:30:32 +02:00
commit d94e11e645
7 changed files with 71 additions and 107 deletions

View file

@ -434,7 +434,7 @@ __COMMENT_IF_LDAP_DISABLED__ },
/* /*
* Restrict socket.io transport methods * Restrict socket.io transport methods
*/ */
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"], "socketTransportProtocols" : ["websocket", "polling"],
"socketIo": { "socketIo": {
/* /*

View file

@ -9,7 +9,7 @@ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
Environment=ETHERPAD_PRODUCTION=true Environment=ETHERPAD_PRODUCTION=true
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/node/server.js ExecStart=__INSTALL_DIR__/bin/run.sh
StandardOutput=append:/var/log/__APP__/etherpad.log StandardOutput=append:/var/log/__APP__/etherpad.log
StandardError=inherit StandardError=inherit
Restart=always Restart=always

View file

@ -115,4 +115,4 @@ ram.runtime = "50M"
[resources.database] [resources.database]
type = "mysql" type = "mysql"

View file

@ -5,24 +5,24 @@
#================================================= #=================================================
# NodeJS version # NodeJS version
nodejs_version=14 nodejs_version=20
# MyPads version # MyPads version
# This variable is mostly used to force an upgrade of the package in case of new versions of MyPads. # This variable is mostly used to force an upgrade of the package in case of new versions of MyPads.
mypads_version=1.7.24 mypads_version=1.7.24
# Plugin versions # Plugin versions
ep_align_version=0.3.53 ep_align_version=0.3.94
ep_author_hover_version=0.3.37 ep_author_hover_version=0.3.55
ep_comments_page_version=1.0.5 ep_comments_page_version=1.0.33
ep_countable_version=0.0.13 ep_countable_version=0.0.13
ep_delete_empty_pads_version=0.0.10 ep_delete_empty_pads_version=0.0.10
ep_font_color_version=0.0.63 ep_font_color_version=0.0.86
ep_headings2_version=0.2.44 ep_headings2_version=0.2.62
ep_markdown_version=0.1.50 ep_markdown_version=0.1.77
ep_spellcheck_version=0.0.43 ep_spellcheck_version=0.0.59
ep_subscript_and_superscript_version=0.2.47 ep_subscript_and_superscript_version=0.3.7
ep_font_size_version=0.4.44 ep_font_size_version=0.4.59
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -59,7 +59,7 @@ chown $app -R /var/log/$app
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configure etherpad..." ynh_script_progression --message="Configure $app..."
abiword_path="null" abiword_path="null"
soffice_path="null" soffice_path="null"
@ -80,7 +80,6 @@ then
fi fi
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_add_config --template="settings.json" --destination="$install_dir/settings.json" ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json" ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
@ -90,47 +89,25 @@ chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json" chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json" chown $app:$app "$install_dir/credentials.json"
#=================================================
# INSTALL ETHERPAD'S PLUGINS
#=================================================
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
pushd "$install_dir"
# Add Left/Center/Right/Justify to lines of text in a pad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version}
# Framapad - Adds author names to span titles
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_author_hover@${ep_author_hover_version}
# Framapad - Adds comments on sidebar and link it to the text.
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_comments_page@${ep_comments_page_version}
# Framapad - Displays paragraphs, sentences, words and characters counts.
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_countable@${ep_countable_version}
# Framapad - Delete pads which were never edited
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_delete_empty_pads@${ep_delete_empty_pads_version}
# Framapad - Apply colors to fonts
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_color@${ep_font_color_version}
# Framapad - Adds heading support to Etherpad Lite.
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_headings2@${ep_headings2_version}
# Framapad - Edit and Export as Markdown in Etherpad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_markdown@${ep_markdown_version}
if [ $mypads -eq 1 ]; then
# Framapad - Groups and private pads for Etherpad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_mypads@${mypads_version}
fi
# Framapad - Add support to do 'Spell checking'
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version}
# Framapad - Add support for Subscript and Superscript
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version}
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version}
popd
#================================================= #=================================================
# INSTALL ETHERPAD # INSTALL ETHERPAD
#================================================= #=================================================
ynh_script_progression --message="Installing Etherpad..." --weight=90 ynh_script_progression --message="Installing $app..." --weight=90
pushd $install_dir pushd "$install_dir"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh ynh_exec_warn_less npm install pnpm -g
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true bin/installDeps.sh && \
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins \
ep_align@${ep_align_version} \
ep_author_hover@${ep_author_hover_version} \
ep_delete_empty_pads@${ep_delete_empty_pads_version} \
ep_headings2@${ep_headings2_version} \
ep_markdown@${ep_markdown_version} \
ep_font_size@${ep_font_size_version}
if [ $mypads -eq 1 ]; then
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins \
ep_mypads@${mypads_version}
fi
popd popd
#================================================= #=================================================

View file

@ -6,7 +6,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
#
ynh_script_progression --message="Restoring the app main directory..." --weight=5 ynh_script_progression --message="Restoring the app main directory..." --weight=5
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
@ -28,7 +27,11 @@ chown $app:$app "$install_dir/credentials.json"
ynh_script_progression --message="Restoring system configurations related to $app..." ynh_script_progression --message="Restoring system configurations related to $app..."
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less npm install pnpm -g
popd
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -3,8 +3,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
@ -67,14 +65,10 @@ ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=4
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="settings.json credentials.json"
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="settings.json credentials.json"
fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
@ -107,8 +101,7 @@ chown $app -R /var/log/$app
#================================================= #=================================================
# CONFIGURE ETHERPAD # CONFIGURE ETHERPAD
#================================================= #=================================================
ynh_script_progression --message="Configure $app..."
ynh_script_progression --message="Configure etherpad..."
abiword_path="null" abiword_path="null"
soffice_path="null" soffice_path="null"
@ -144,62 +137,53 @@ chown $app:$app "$install_dir/credentials.json"
#================================================= #=================================================
# If upgrading from an old version and table of content is there, remove it # If upgrading from an old version and table of content is there, remove it
if ynh_compare_current_package_version --comparison lt --version 1.9.1~ynh3 #if ynh_compare_current_package_version --comparison lt --version 1.9.1~ynh3
then #then
pushd "$install_dir" # pushd "$install_dir"
if ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ls 2>/dev/null | grep -q ep_table_of_contents # if ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ls 2>/dev/null | grep -q ep_table_of_contents
then # then
ynh_script_progression --message="Uninstalling ep_table_of_contents..." --weight=2 # ynh_script_progression --message="Uninstalling ep_table_of_contents..." --weight=2
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm uninstall ep_table_of_contents # ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm uninstall ep_table_of_contents
fi # fi
popd # popd
fi #fi
ynh_script_progression --message="Installing Etherpad plugins..." --weight=10 #ynh_script_progression --message="Installing Etherpad plugins..." --weight=10
pushd "$install_dir" #pushd "$install_dir"
# Add Left/Center/Right/Justify to lines of text in a pad # ynh_exec_warn_less npm install pnpm -g
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version} # ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins ep_align@${ep_align_version} ep_author_hover@${ep_author_hover_version} ep_comments_page@${ep_comments_page_version} ep_countable@${ep_countable_version} ep_delete_empty_pads@${ep_delete_empty_pads_version} ep_font_color@${ep_font_color_version} ep_headings2@${ep_headings2_version} ep_markdown@${ep_markdown_version} ep_spellcheck@${ep_spellcheck_version} ep_subscript_and_superscript@${ep_subscript_and_superscript_version} ep_font_size@${ep_font_size_version}
# Framapad - Adds author names to span titles # if [ $mypads -eq 1 ]; then
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_author_hover@${ep_author_hover_version} # ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins ep_mypads@${mypads_version}
# Framapad - Adds comments on sidebar and link it to the text. # fi
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_comments_page@${ep_comments_page_version} #popd
# Framapad - Displays paragraphs, sentences, words and characters counts.
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_countable@${ep_countable_version}
# Framapad - Delete pads which were never edited
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_delete_empty_pads@${ep_delete_empty_pads_version}
# Framapad - Apply colors to fonts
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_color@${ep_font_color_version}
# Framapad - Adds heading support to Etherpad Lite.
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_headings2@${ep_headings2_version}
# Framapad - Edit and Export as Markdown in Etherpad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_markdown@${ep_markdown_version}
if [ $mypads -eq 1 ]; then
# Framapad - Groups and private pads for Etherpad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_mypads@${mypads_version}
fi
# Framapad - Add support to do 'Spell checking'
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version}
# Framapad - Add support for Subscript and Superscript
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version}
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version}
popd
#================================================= #=================================================
# UPGRADE NPM MODULES # UPGRADE NPM MODULES
#================================================= #=================================================
ynh_script_progression --message="Upgrading Etherpad..." --weight=10 ynh_script_progression --message="Upgrading $app..." --weight=10
pushd $install_dir pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh ynh_exec_warn_less npm install pnpm -g
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true bin/installDeps.sh && \
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins \
ep_align@${ep_align_version} \
ep_author_hover@${ep_author_hover_version} \
ep_delete_empty_pads@${ep_delete_empty_pads_version} \
ep_headings2@${ep_headings2_version} \
ep_markdown@${ep_markdown_version} \
ep_font_size@${ep_font_size_version}
if [ $mypads -eq 1 ]; then
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run install-plugins \
ep_mypads@${mypads_version}
fi
popd popd
#================================================= #=================================================
# ADD MYPADS LINK # ADD MYPADS LINK
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ] if [ $mypads -eq 1 ]
then then
# Find the /div just after the field to open a pad in order to add a link to MyPads plugin. # Find the /div just after the field to open a pad in order to add a link to MyPads plugin.
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html