diff --git a/conf/settings.json b/conf/settings.json index d51e36c..97c6d68 100644 --- a/conf/settings.json +++ b/conf/settings.json @@ -434,7 +434,7 @@ __COMMENT_IF_LDAP_DISABLED__ }, /* * Restrict socket.io transport methods */ - "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"], + "socketTransportProtocols" : ["websocket", "polling"], "socketIo": { /* diff --git a/conf/systemd.service b/conf/systemd.service index 0684052..4808e55 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment=ETHERPAD_PRODUCTION=true 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 StandardError=inherit Restart=always diff --git a/manifest.toml b/manifest.toml index a0eb9a6..54027d6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -115,4 +115,4 @@ ram.runtime = "50M" [resources.database] type = "mysql" - + \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index d8e6290..195f905 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,24 +5,24 @@ #================================================= # NodeJS version -nodejs_version=14 +nodejs_version=20 # 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.24 # Plugin versions -ep_align_version=0.3.53 -ep_author_hover_version=0.3.37 -ep_comments_page_version=1.0.5 +ep_align_version=0.3.94 +ep_author_hover_version=0.3.55 +ep_comments_page_version=1.0.33 ep_countable_version=0.0.13 ep_delete_empty_pads_version=0.0.10 -ep_font_color_version=0.0.63 -ep_headings2_version=0.2.44 -ep_markdown_version=0.1.50 -ep_spellcheck_version=0.0.43 -ep_subscript_and_superscript_version=0.2.47 -ep_font_size_version=0.4.44 +ep_font_color_version=0.0.86 +ep_headings2_version=0.2.62 +ep_markdown_version=0.1.77 +ep_spellcheck_version=0.0.59 +ep_subscript_and_superscript_version=0.3.7 +ep_font_size_version=0.4.59 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index c239422..658b49b 100644 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ chown $app -R /var/log/$app #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Configure etherpad..." +ynh_script_progression --message="Configure $app..." abiword_path="null" soffice_path="null" @@ -80,7 +80,6 @@ then fi # 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="credentials.json" --destination="$install_dir/credentials.json" @@ -90,47 +89,25 @@ chown $app:$app "$install_dir/settings.json" chmod 600 "$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 #================================================= -ynh_script_progression --message="Installing Etherpad..." --weight=90 +ynh_script_progression --message="Installing $app..." --weight=90 -pushd $install_dir - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh +pushd "$install_dir" + 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 #================================================= diff --git a/scripts/restore b/scripts/restore index 78789ad..230ffe9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,6 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -# ynh_script_progression --message="Restoring the app main directory..." --weight=5 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_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" diff --git a/scripts/upgrade b/scripts/upgrade index be9c68f..98f9f4e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,8 +3,6 @@ source _common.sh source /usr/share/yunohost/helpers -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # 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 #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=4 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - 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 +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="settings.json credentials.json" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -107,8 +101,7 @@ chown $app -R /var/log/$app #================================================= # CONFIGURE ETHERPAD #================================================= - -ynh_script_progression --message="Configure etherpad..." +ynh_script_progression --message="Configure $app..." abiword_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 ynh_compare_current_package_version --comparison lt --version 1.9.1~ynh3 -then - 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 - then - 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 - fi - popd -fi +#if ynh_compare_current_package_version --comparison lt --version 1.9.1~ynh3 +#then +# 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 +# then +# 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 +# fi +# popd +#fi -ynh_script_progression --message="Installing Etherpad plugins..." --weight=10 +#ynh_script_progression --message="Installing Etherpad plugins..." --weight=10 -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 +#pushd "$install_dir" +# ynh_exec_warn_less npm install pnpm -g +# 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} +# 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 #================================================= # UPGRADE NPM MODULES #================================================= -ynh_script_progression --message="Upgrading Etherpad..." --weight=10 +ynh_script_progression --message="Upgrading $app..." --weight=10 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 #================================================= # ADD MYPADS LINK #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ] +if [ $mypads -eq 1 ] then # Find the /div just after the field to open a pad in order to add a link to MyPads plugin. sed -i '157i

MyPads
' $install_dir/src/templates/index.html