diff --git a/README.md b/README.md index ec2c3dc..3eff617 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to Etherpad is a highly customizable Open Source online editor providing collaborative editing in really real-time. This package will install the same plugins than [Framapad](https://framapad.org/). -**Shipped version:** 1.8.4 +**Shipped version:** 1.8.12 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 3e90ad5..5548138 100644 --- a/README_fr.md +++ b/README_fr.md @@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/inst Etherpad est un éditeur en ligne Open Source hautement personnalisable qui permet l'édition collaborative en temps réel. Ce paquet installera les mêmes plugins que [Framapad](https://framapad.org/). -**Version embarquée :** 1.8.4 +**Version embarquée :** 1.8.12 ## Captures d'écran diff --git a/check_process b/check_process index a908e89..870f8f7 100644 --- a/check_process +++ b/check_process @@ -19,7 +19,6 @@ main.pad_configuration.pad_config_alwaysshowchat=1|0 main.pad_configuration.pad_config_show_markdown=1|0 main.pad_configuration.pad_config_automatic_logout=0|1 - main.pad_configuration.pad_config_skinname=noskin|colibris|noskin main.mypads_configuration.mypads=0|1 main.mypads_configuration.useldap=0|1 main.is_public.is_public=1|0 diff --git a/conf/credentials.json b/conf/credentials.json index 02cc320..eb17770 100644 --- a/conf/credentials.json +++ b/conf/credentials.json @@ -44,7 +44,7 @@ "__ADMIN__": { // 1) "password" can be replaced with "hash" if you install ep_hash_auth // 2) please note that if password is null, the user will not be created - "password": "__PASSWD__", + "password": "__PASSWORD__", "is_admin": true } }, diff --git a/conf/systemd.service b/conf/systemd.service index fd81e8d..645f210 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,9 +6,10 @@ After=syslog.target network.target Type=simple User=__APP__ Group=__APP__ -Environment="PATH=__ENV_PATH__" +WorkingDirectory=__FINALPATH__ Environment=NODE_ENV=production -ExecStart=__FINALPATH__/src/bin/run.sh /var/log/__APP__/etherpad.log +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__FINALPATH__/src/bin/run.sh Restart=always [Install] diff --git a/config_panel.toml b/config_panel.toml index 8b1f163..7561980 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -46,13 +46,7 @@ name = "Etherpad configuration" ask = "Automatic logout" type = "boolean" default = true - - [main.pad_configuration.pad_config_skinname] - ask = "Theme Name" - choices = ["noskin", "colibris"] - default = "noskin" - help = "noskin is the traditional Etherpad theme. colibris is the new theme." - + [main.mypads_configuration] name = "Mypads configuration" diff --git a/manifest.json b/manifest.json index a44fa03..5007da2 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~ynh3", + "version": "1.8.12~ynh1", "url": "https://framapad.org", "license": "Apache-2.0", "maintainer": { @@ -18,7 +18,7 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -30,38 +30,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Etherpad MyPads", - "fr": "Choisissez un domaine pour Etherpad MyPads" - }, "example": "sub.domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Etherpad MyPads", - "fr": "Choisissez un chemin pour Etherpad MyPads" - }, "example": "/pad", "default": "/pad" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose the Etherpad MyPads administrator (must be an existing YunoHost user)", - "fr": "Choisissez l'administrateur Etherpad MyPads (doit être un utilisateur YunoHost existant)" - }, "example": "john" }, { "name": "password", "type": "password", - "ask": { - "en": "Set the administrator password (between 8 and 30 characters)", - "fr": "Définissez le mot de passe administrateur (entre 8 et 30 caractères)" - }, "example": "Choose a password" }, { @@ -77,10 +61,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public website?", - "fr": "Est-ce un site public ?" - }, "help": { "en": "If your Etherpad instance is public, everyone will be able to create a pad or see an existing one.", "fr": "Si votre instance Etherpad est publique, tout le monde pourra créer un pad ou voir un pad existant." diff --git a/scripts/_variables b/scripts/_variables index ec5a324..063a5f7 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -7,7 +7,7 @@ abiword_app_depencencies="abiword" libreoffice_app_dependencies="unoconv libreoffice-writer" # NodeJS version -nodejs_version=12 +nodejs_version=14 # MyPads version # This variable is mostly used to force an upgrade of the package in case of new versions of MyPads. diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config index 19936da..d1404e7 100755 --- a/scripts/actions/reset_default_config +++ b/scripts/actions/reset_default_config @@ -87,7 +87,7 @@ ynh_store_file_checksum --file="$config_file" ynh_script_progression --message="Restarting Etherpad..." --weight=9 # Wait for etherpad to be fully started -ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" +ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index b3954a7..172752c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -130,7 +130,7 @@ ynh_systemd_action --action=reload --service_name=nginx ynh_script_progression --message="Restarting Etherpad..." --weight=10 # Wait for etherpad to be fully started -ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" +ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" #================================================= # DEACTIVE MAINTENANCE MODE diff --git a/scripts/config b/scripts/config index ffbe98e..e464243 100644 --- a/scripts/config +++ b/scripts/config @@ -78,16 +78,6 @@ else fi pad_config_automatic_logout="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT:-$old_pad_config_automatic_logout}" -# Etherpad skin -old_pad_config_skinname="$(get_config_value skinName)" -if [ "$old_pad_config_skinname" = "no-skin" ]; then - old_pad_config_skinname=noskin -fi -pad_config_skinname="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME:-$old_pad_config_skinname}" -if [ "$pad_config_skinname" = "no-skin" ]; then - pad_config_skinname=noskin -fi - # Mypads if [ -d $final_path/node_modules/ep_mypads ] then @@ -146,7 +136,6 @@ show_config() { ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT=$pad_config_alwaysshowchat" ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN=$pad_config_show_markdown" ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT=$pad_config_automatic_logout" - ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME=$pad_config_skinname" ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads" ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap" @@ -230,17 +219,6 @@ apply_config() { restart_etherpad=1 fi - # Plugin option ep_page_view_default - if [ "$pad_config_skinname" != "$old_pad_config_skinname" ] - then - if [ "$pad_config_skinname" = "noskin" ]; then - pad_config_skinname="no-skin" - fi - ynh_replace_string --match_string="\( *\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$config_file" - ynh_app_setting_set --app=$app --key=pad_config_skinname --value="$pad_config_skinname" - restart_etherpad=1 - fi - # Export if [ "$export" != "$old_export" ] then @@ -310,7 +288,7 @@ apply_config() { if [ $restart_etherpad -eq 1 ] then # Wait for etherpad to be fully started - ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" + ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" fi #================================================= diff --git a/scripts/install b/scripts/install index ee2e394..93988b3 100644 --- a/scripts/install +++ b/scripts/install @@ -161,16 +161,22 @@ ynh_use_logrotate --specific_user=$app/$app ynh_script_progression --message="Installing Etherpad..." --weight=90 # Install dependencies and proceed to the installation -ynh_use_nodejs -( - cd "$final_path" - mkdir -p node_modules - cd node_modules - [ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite - cd ep_etherpad-lite - chown -R $app: $final_path - ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn -) +# ynh_use_nodejs +# ( +# cd "$final_path" +# mkdir -p node_modules +# cd node_modules +# [ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite +# cd ep_etherpad-lite +# chown -R $app: $final_path +# ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn +# ) + +chown -R $app: $final_path +pushd $final_path + ynh_use_nodejs + ynh_exec_as $app env "$ynh_node_load_PATH" bin/installDeps.sh +popd #================================================= # CONFIGURE ETHERPAD @@ -178,12 +184,8 @@ ynh_use_nodejs ynh_script_progression --message="Configuring Etherpad..." --weight=6 cp ../conf/settings.json "$final_path/settings.json" -cp ../conf/credentials.json "$final_path/credentials.json" + ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/credentials.json" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json" -ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json" -ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON if [ "$export" = "abiword" ] then # Get abiword binary path @@ -207,8 +209,8 @@ fi # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$final_path/settings.json" -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$final_path/credentials.json" + +ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json" #================================================= # SECURING FILES AND DIRECTORIES @@ -224,9 +226,8 @@ chmod 600 $final_path/credentials.json #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=4 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" # Create a dedicated systemd config -ynh_add_systemd_config +ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -295,7 +296,7 @@ fi #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring Fail2ban..." --weight=13 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=13 # 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 @@ -325,7 +326,7 @@ ynh_systemd_action --action=reload --service_name=nginx ynh_script_progression --message="Restarting Etherpad..." --weight=20 # Wait for etherpad to be fully started -ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" +ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" if [ $mypads -eq 1 ] then @@ -333,7 +334,7 @@ then mysql -u $db_name -p$db_pwd $db_name < "../conf/lang_mypads.sql" # Wait for etherpad to be fully started - ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" + ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" fi #================================================= diff --git a/scripts/restore b/scripts/restore index d4da3c7..7dd74e1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -173,7 +173,7 @@ ynh_systemd_action --action=reload --service_name=nginx ynh_script_progression --message="Restarting Etherpad..." --weight=8 # Wait for etherpad to be fully started -ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" +ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" #================================================= # DEACTIVE MAINTENANCE MODE diff --git a/scripts/upgrade b/scripts/upgrade index 28521a1..d6f402f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,8 @@ 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) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON mypads=$(ynh_app_setting_get --app=$app --key=mypads) useldap=$(ynh_app_setting_get --app=$app --key=useldap) overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings) @@ -40,14 +42,13 @@ pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_sho pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers) pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat) pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown) -pad_config_skinname=$(ynh_app_setting_get --app=$app --key=pad_config_skinname) #================================================= # CHECK VERSION #================================================= # Wait for etherpad to be fully started -ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" +ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="systemd" --timeout="120" upgrade_type=$(ynh_check_app_version_changed) @@ -209,13 +210,6 @@ fi #================================================= ynh_script_progression --message="Upgrading NodeJS..." --weight=4 -# Remove the old nvm helper. -if [ -d /opt/nvm ] -then - ynh_secure_remove --file="/opt/nvm" - sed --in-place "/NVM_DIR/d" /root/.bashrc -fi - ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -231,9 +225,24 @@ ynh_exec_warn_less npm cache clean --force ynh_secure_remove --file="$final_path/src/package-lock.json" ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" update) + +pushd $final_path + ynh_use_nodejs + ynh_exec_as $app env "$ynh_node_load_PATH" src/bin/installDeps.sh + #ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm cache clean --force + #ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install --upgrade + ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_automatic_logut ep_countable ep_delete_empty_pads ep_subscript_and_superscript ep_headings2 ep_author_hover ep_markdown ep_comments_page ep_align ep_font_color ep_font_size ep_spellcheck ep_table_of_contents >> $install_log 2>&1 + if [ $mypads -eq 1 ]; then + # Framapad - Groups and private pads for Etherpad + ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads >> $install_log 2>&1 + fi +popd + + # Then update the additionnal modules (cd "$final_path" -ynh_exec_warn_less npm cache clean --force +#ynh_exec_warn_less npm cache clean --force +ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm cache clean --force while read node_module do # Ignore ep_etherpad-lite, this part is updated before in this script. @@ -251,9 +260,12 @@ do if [ -n "${module_version}" ]; then module_version=@${module_version} fi - ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade ${node_module}${module_version} || true + ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install --upgrade ${node_module}${module_version} || true done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")") +# ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade ${node_module}${module_version} || true +# done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")") + #================================================= # SPECIFIC UPGRADE #================================================= @@ -315,9 +327,6 @@ then if [ -n "$pad_config_show_markdown" ]; then ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$final_path/settings.json" fi - if [ -n "$pad_config_skinname" ]; then - ynh_replace_string --match_string="\(\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$final_path/settings.json" - fi # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/settings.json" @@ -326,19 +335,7 @@ then # Overwrite the credentials config file only if it's allowed if [ $overwrite_credentials -eq 1 ] then - # Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. - ynh_backup_if_checksum_is_different --file="$final_path/credentials.json" - cp ../conf/credentials.json "$final_path/credentials.json" - - ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json" - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON - ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json" - ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json" - ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON - - # Recalculate and store the checksum of the file for the next upgrade. - ynh_store_file_checksum --file="$final_path/credentials.json" + ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json" fi fi @@ -390,8 +387,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Overwrite the systemd configuration only if it's allowed if [ $overwrite_systemd -eq 1 ] then - ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - ynh_add_systemd_config + ynh_add_systemd_config --others_var="ynh_node_load_PATH" fi #=================================================