diff --git a/CHANGELOG.md b/CHANGELOG.md index af1de70..c1680dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Changelog ========= +## [1.8.13~ynh1]() - 2021-03-23 + +#### Changed +* [Upgrade to 1.8.13](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/9684b59824b18ea781efb8a26df5d7c3d51a8264) +* [Upgrade NodeJS to 14](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/5d3ce9996e3f4d0812b000467e5ae2d9ee5416e0) +* [Update to MyPads 1.7.20]() +* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/943ec31536dabe4f2146253f3e478598cdafe4bf) + +#### Added +* [ep_countable plugin (working again)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/5d3ce9996e3f4d0812b000467e5ae2d9ee5416e0) + ## [1.8.4~ynh3](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/133) - 2021-04-23 #### Changed diff --git a/README.md b/README.md index 4d46ddb..79dc6fc 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 k 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.13 ## Screenshots @@ -31,7 +31,7 @@ You can also find a configuration file for Etherpad at this path `/var/www/ether ## Documentation - * Official documentation: http://etherpad.org/doc/v1.8.4 + * Official documentation: http://etherpad.org/doc/v1.8.13 * YunoHost documentation: https://yunohost.org/en/app_etherpad_mypads ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index 8e69c05..f1d4c03 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/instal 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.13 ## Captures d'écran @@ -30,7 +30,7 @@ Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpa ## Documentation - * Documentation officielle : http://etherpad.org/doc/v1.8.4 + * Documentation officielle : http://etherpad.org/doc/v1.8.13 * Documentation YunoHost : https://yunohost.org/fr/app_etherpad_mypads ## Fonctionnalités spécifiques à YunoHost diff --git a/actions.toml b/actions.toml index 0273bb8..e80eab8 100644 --- a/actions.toml +++ b/actions.toml @@ -33,18 +33,3 @@ command = "/bin/bash scripts/actions/reset_default_config \"settings.json\"" # accepted_return_codes = [0, 1, 2, 3] # optional accepted_return_codes = [0] description = "Reset the config file settings.json." - -[public_private] -name = "Move to public or private" -command = "/bin/bash scripts/actions/public_private" -# user = "root" # optional -# cwd = "/" # optional -# accepted_return_codes = [0, 1, 2, 3] # optional -accepted_return_codes = [0] -description = "Change the public access of the app." - - [public_private.arguments] - [public_private.arguments.is_public] - type = "boolean" - ask = "Is it a public app?" - default = true diff --git a/check_process b/check_process index 5d974b2..85976fe 100644 --- a/check_process +++ b/check_process @@ -19,10 +19,8 @@ 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 main.overwrite_files.overwrite_settings=0|1 main.overwrite_files.overwrite_credentials=0|1 main.overwrite_files.overwrite_nginx=0|1 diff --git a/conf/app.src b/conf/app.src index 1016585..2c28073 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.4.tar.gz -SOURCE_SUM=b6ad9734a058d3b471cf15c060e609e978797e32559818e9f0a80e0a253c7ba8 +SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.13.tar.gz +SOURCE_SUM=c83052daf3b0af8aa3c19a8308e21fcbcfecca99aeb3e8047383875f855443f1 SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true 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/settings.json b/conf/settings.json index 13cd91d..8eee7b0 100644 --- a/conf/settings.json +++ b/conf/settings.json @@ -113,7 +113,7 @@ * "full-width-editor" variant (by default editor is rendered as a page, with * a max-width of 900px). */ - "skinVariants": "super-light-toolbar super-light-editor light-background", + "skinVariants": "light-toolbar super-light-editor dark-background", /* * IP and port which Etherpad should bind at. diff --git a/conf/systemd.service b/conf/systemd.service index 8fe4898..f2a54ed 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,19 @@ After=syslog.target network.target Type=simple User=__APP__ Group=__APP__ -Environment="PATH=__ENV_PATH__" +WorkingDirectory=__FINALPATH__ Environment=NODE_ENV=production -ExecStart=__FINALPATH__/bin/safeRun.sh /var/log/__APP__/etherpad.log +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__FINALPATH__/src/bin/run.sh +StandardOutput=append:/var/log/__APP__/etherpad.log +StandardError=inherit Restart=always +#PrivateDevices=true +#ProtectControlGroups=true +#ProtectHome=true +#ProtectKernelTunables=true +#ProtectSystem=full + [Install] WantedBy=multi-user.target diff --git a/config_panel.toml b/config_panel.toml index 8b1f163..631ba72 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -46,16 +46,10 @@ 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" + name = "MyPads configuration" [main.mypads_configuration.mypads] ask = "Enable MyPads plugin?" @@ -68,16 +62,6 @@ name = "Etherpad configuration" default = true - [main.is_public] - name = "Public access" - - [main.is_public.is_public] - ask = "Is it a public website?" - type = "boolean" - default = true - help = "If your Etherpad instance is public, everyone will be able to create a pad or see an existing one." - - [main.overwrite_files] name = "Overwriting config files during an upgrade" diff --git a/manifest.json b/manifest.json index 839be8b..7f318cf 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.13~ynh1", "url": "https://framapad.org", "license": "Apache-2.0", "maintainer": { diff --git a/scripts/_variables b/scripts/_variables index 4e07d29..e89bc02 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -7,24 +7,24 @@ 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. -mypads_version=1.7.17 +mypads_version=1.7.20 # Plugin versions -ep_align_version=0.2.5 -ep_author_hover_version=0.3.0 +ep_align_version=0.3.34 +ep_author_hover_version=0.3.19 ep_automatic_logut_version=1.0.8 -ep_comments_page_version=0.1.5 +ep_comments_page_version=0.1.60 ep_countable_version=0.0.11 -ep_delete_empty_pads_version=0.0.6 -ep_font_color_version=0.0.15 -ep_headings2_version=0.1.3 -ep_markdown_version=0.1.7 +ep_delete_empty_pads_version=0.0.7 +ep_font_color_version=0.0.42 +ep_headings2_version=0.2.28 +ep_markdown_version=0.1.32 ep_page_view_version=0.5.24 -ep_spellcheck_version=0.0.7 -ep_subscript_and_superscript_version=0.1.2 -ep_table_of_contents_version=0.2.3 -ep_font_size_version=0.3.8 +ep_spellcheck_version=0.0.27 +ep_subscript_and_superscript_version=0.2.26 +ep_table_of_contents_version=0.3.20 +ep_font_size_version=0.4.22 diff --git a/scripts/actions/add_remove_abiword b/scripts/actions/add_remove_abiword index 891ab94..24622ee 100755 --- a/scripts/actions/add_remove_abiword +++ b/scripts/actions/add_remove_abiword @@ -84,7 +84,7 @@ fi # Rebuild the meta package and install the new dependencies ( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it. -ynh_install_app_dependencies $dependencies) +ynh_exec_warn_less ynh_install_app_dependencies $dependencies) # Remove all unused dependencies ynh_package_autopurge diff --git a/scripts/actions/add_remove_libreoffice b/scripts/actions/add_remove_libreoffice index 106ecbd..24bc7dd 100755 --- a/scripts/actions/add_remove_libreoffice +++ b/scripts/actions/add_remove_libreoffice @@ -67,24 +67,24 @@ fi ynh_script_progression --message="$action2 LibreOffice..." --weight=3 -# Load common variables, and especially libreoffice dependencies. +# Load common variables, and especially LibreOffice dependencies. source scripts/_variables dependencies="" if [ $libreoffice -eq 1 ] then - # Add libreoffice dependencies if libreoffice has to be installed + # Add LibreOffice dependencies if libreoffice has to be installed dependencies="$dependencies $libreoffice_app_dependencies" fi if [ $abiword -eq 1 ] then - # Add abiword dependencies if abiword is already installed to keep it as a dependence. + # Add Abiword dependencies if abiword is already installed to keep it as a dependence. dependencies="$dependencies $abiword_app_depencencies" fi # Rebuild the meta package and install the new dependencies ( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it. -ynh_install_app_dependencies $dependencies) +ynh_exec_warn_less ynh_install_app_dependencies $dependencies) # Remove all unused dependencies ynh_package_autopurge @@ -95,11 +95,11 @@ ynh_package_autopurge if [ $libreoffice -eq 1 ] then - # Set libreoffice as default export app + # Set LibreOffice as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice" elif [ $abiword -eq 1 ] then - # Set abiword as default export app + # Set Abiword as default export app yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword" else # Remove any export app diff --git a/scripts/actions/public_private b/scripts/actions/public_private deleted file mode 100755 index 39d6d3b..0000000 --- a/scripts/actions/public_private +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source /usr/share/yunohost/helpers - -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -# Get is_public -is_public=${YNH_ACTION_IS_PUBLIC} - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -is_public_old=$(ynh_app_setting_get --app=$app --key=is_public) - -if [ $is_public -eq $is_public_old ] -then - ynh_die --message="is_public is already set as $is_public." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# MOVE TO PUBLIC OR PRIVATE -#================================================= - -if [ $is_public -eq 0 ]; then - public_private="private" -else - public_private="public" -fi -ynh_script_progression --message="Moving the application to $public_private..." --weight=3 - -if [ $is_public -eq 0 ] -then - ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" # etherpad admin page doesn't support SSO... -else - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -fi - -ynh_script_progression --message="Upgrading SSOwat configuration..." -# Regen ssowat configuration -yunohost app ssowatconf - -# Update the config of the app -ynh_app_setting_set --app=$app --key=is_public --value=$is_public - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - -ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/config b/scripts/config index ffbe98e..41f406d 100644 --- a/scripts/config +++ b/scripts/config @@ -78,17 +78,7 @@ 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 +# MyPads if [ -d $final_path/node_modules/ep_mypads ] then # Enable @@ -99,7 +89,7 @@ else fi mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}" -# Ldap for Mypads +# LDAP for MyPads if grep -q "//noldap" $config_file then # Disable @@ -110,10 +100,6 @@ else fi useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}" -# is_public -old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)" -is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}" - # Overwrite settings.json file old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)" overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}" @@ -146,13 +132,8 @@ 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" - - ynh_return "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public" - ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings" ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS=$overwrite_credentials" ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx" @@ -216,37 +197,27 @@ apply_config() { if [ "$pad_config_automatic_logout" != "$old_pad_config_automatic_logout" ] then ynh_use_nodejs - pushd "$final_path" + #pushd "$final_path/src" + #ynh_secure_remove --file="$final_path/src/package-lock.json" #added to fix saveError ENOENT: no such file or directory if [ "$pad_config_automatic_logout" = "0" ] then ynh_replace_string --match_string="^\(.*\"automatic_logut.*$\)" --replace_string="\/\/\1" --target_file="$config_file" - npm uninstall ep_automatic_logut + ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_automatic_logut else ynh_replace_string --match_string="^\/\/\(.*\"automatic_logut.*$\)" --replace_string="\1" --target_file="$config_file" - npm install ep_automatic_logut@${ep_automatic_logut_version} + ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_automatic_logut@${ep_automatic_logut_version} fi popd chown -R $app: $final_path/node_modules 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 if [ "$export" = "abiword" ] then - # if abiword isn't installed, call the action add_remove_abiword. + # if Abiword isn't installed, call the action add_remove_abiword. if ! which abiword > /dev/null then yunohost app action run $app add_remove_abiword @@ -255,7 +226,7 @@ apply_config() { ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file" elif [ "$export" = "libreoffice" ] then - # if libreoffice isn't installed, call the action add_remove_libreoffice. + # if LibreOffice isn't installed, call the action add_remove_libreoffice. if ! which soffice > /dev/null then yunohost app action run $app add_remove_libreoffice @@ -272,16 +243,17 @@ apply_config() { restart_etherpad=1 fi - # Mypads + # MyPads if [ "$mypads" != "$old_mypads" ] then ynh_use_nodejs - pushd "$final_path" + #pushd "$final_path/src" + #ynh_secure_remove --file="$final_path/src/package-lock.json" #added to fix saveError ENOENT: no such file or directory if [ "$mypads" = "1" ] then - npm install ep_mypads@${mypads_version} + ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads@${mypads_version} else - npm uninstall ep_mypads + ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_mypads fi popd chown -R $app: $final_path/node_modules @@ -291,8 +263,8 @@ apply_config() { restart_etherpad=1 fi - # Ldap for Mypads - if [ "$useldap" != "$old_useldap" ] + # LDAP for MyPads + if [ "$useldap" != "$old_useldap" ] then if [ "$useldap" = "1" ] then @@ -313,21 +285,6 @@ apply_config() { ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120" fi - #================================================= - # MODIFY PUBLIC ACCESSIBILITY - #================================================= - - # Change public accessibility - if [ "$is_public" != "$old_is_public" ] - then - if [ "$is_public" = "1" ] - then - yunohost app action run $app public_private --args is_public=1 - else - yunohost app action run $app public_private --args is_public=0 - fi - fi - #================================================= # MODIFY OVERWRITTING SETTINGS #================================================= diff --git a/scripts/install b/scripts/install index 4541af0..d52d9d6 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 @@ -92,9 +95,9 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_script_progression --message="Installing dependencies..." --weight=120 if [ "$export" = "abiword" ]; then - ynh_install_app_dependencies $abiword_app_depencencies + ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies elif [ "$export" = "libreoffice" ]; then - ynh_install_app_dependencies $libreoffice_app_dependencies + ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies fi #================================================= @@ -110,9 +113,18 @@ ynh_install_nodejs --nodejs_version=$nodejs_version ynh_script_progression --message="Creating a MySQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=3 + +# Create a dedicated system user +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -130,14 +142,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a dedicated system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -160,17 +164,11 @@ 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 -) +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 +176,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,15 +201,16 @@ 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 #================================================= # Set files ownership to etherpad -chown -R $app: $final_path +chown -R $app:$app $final_path +chmod o-rwx $final_path # Restrict access to credentials.json chmod 600 $final_path/credentials.json @@ -224,15 +219,14 @@ 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 #================================================= -yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" +yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" #================================================= # INSTALL FRAMAPAD'S PLUGINS @@ -241,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 @@ -279,25 +273,26 @@ 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. 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 - 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