diff --git a/README.md b/README.md index 2258e2e..5c423ad 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.7 +**Shipped version:** 1.8.11 ## Screenshots diff --git a/README_fr.md b/README_fr.md index f763b41..ea2a661 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.7 +**Version embarquée :** 1.8.11 ## Captures d'écran diff --git a/conf/app.src b/conf/app.src index 88fd46e..ca2bc12 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.7.tar.gz -SOURCE_SUM=39212e8b2ab025643367664238279ba189104ddadf8f18db8feb02ceda538867 +SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.11.tar.gz +SOURCE_SUM=b9b9916d8e1b1ebe6dac5ebc0f24fa1ea064ddfd1307919bef2b58d7a8d5339c 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/nginx.conf b/conf/nginx.conf index ee2852b..e604ae3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,16 +5,16 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -#sub_path_only rewrite ^__PATH__/admin$ __PATH__/admin/ permanent; + #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; + #sub_path_only rewrite ^__PATH__/admin$ __PATH__/admin/ permanent; proxy_pass http://127.0.0.1:__PORT__/; proxy_set_header Host $host; proxy_buffering off; more_set_headers "X-Frame-Options : ALLOWALL"; - # Recommended proxy_http version for keepalive connections - # https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#nginx - proxy_http_version 1.1; + # Recommended proxy_http version for keepalive connections + # https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#nginx + proxy_http_version 1.1; # Include SSOWAT user panel. diff --git a/conf/systemd.service b/conf/systemd.service index 8fe4898..5d2a89b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,15 +1,16 @@ [Unit] -Description=Etherpad-lite, the collaborative editor. +Description=Etherpad-lite, collaborative editing of documents in real-time. After=syslog.target network.target [Service] Type=simple User=__APP__ Group=__APP__ -Environment="PATH=__ENV_PATH__" -Environment=NODE_ENV=production -ExecStart=__FINALPATH__/bin/safeRun.sh /var/log/__APP__/etherpad.log +WorkingDirectory=__FINALPATH__ +Environment="NODE_ENV=production" +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__FINALPATH__/node_modules/ep_etherpad-lite/node/server.js Restart=always [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file diff --git a/manifest.json b/manifest.json index 3d2d1b4..b755efd 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.7~ynh1", + "version": "1.8.11~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.0" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index d7cd620..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -11,13 +11,6 @@ - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. -## Validation +## Package_check results --- -*Minor decision* -- [ ] **Code review** : -- [ ] **Approval (LGTM)** : -*Code review and approval have to be from a member of @YunoHost-Apps/apps-group* -- **CI succeeded** : -[](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/_variables b/scripts/_variables index 9b63682..45da4d2 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -7,23 +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.18 +mypads_version=1.7.19 # Plugin versions -ep_align_version=0.3.14 -ep_author_hover_version=0.3.10 +ep_align_version=0.3.31 +ep_author_hover_version=0.3.17 ep_automatic_logut_version=1.0.8 -ep_comments_page_version=0.1.46 +ep_comments_page_version=0.1.51 +ep_countable_version=0.0.8 ep_delete_empty_pads_version=0.0.6 -ep_font_color_version=0.0.30 -ep_font_size_version=0.4.8 -ep_headings2_version=0.2.11 -ep_markdown_version=0.1.16 +ep_font_color_version=0.0.38 +ep_font_size_version=0.4.18 +ep_headings2_version=0.2.24 +ep_markdown_version=0.1.30 ep_page_view_version=0.5.26 -ep_spellcheck_version=0.0.18 -ep_subscript_and_superscript_version=0.2.11 -ep_table_of_contents_version=0.3.8 +ep_spellcheck_version=0.0.25 +ep_subscript_and_superscript_version=0.2.21 +ep_table_of_contents_version=0.3.17 diff --git a/scripts/install b/scripts/install index 0abc372..7475424 100644 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=3 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_print_OFF; ynh_app_setting_set --app=$app --key=password --value=$password; ynh_print_ON ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=export --value=$export @@ -161,17 +160,12 @@ 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 @@ -184,7 +178,7 @@ ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_f 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 +ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON if [ "$export" = "abiword" ] then # Get abiword binary path @@ -225,9 +219,7 @@ 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 @@ -250,7 +242,7 @@ npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>& # Framapad - Adds comments on sidebar and link it to the text. 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 +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 # Framapad - Apply colors to fonts @@ -306,15 +298,15 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." if [ $is_public -eq 1 ]; then - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -else - # Etherpad admin page doesn't support SSO... - ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" + ynh_permission_update --permission="main" --add="visitors" fi +# Etherpad admin page doesn't support SSO... +ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 202a5b4..d407b45 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,11 +23,11 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) language=$(ynh_app_setting_get --app=$app --key=language) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) 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) 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) @@ -135,6 +135,18 @@ if [ -z "$overwrite_systemd" ]; then ynh_app_setting_set $app overwrite_systemd $overwrite_systemd fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -207,13 +219,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 #================================================= @@ -221,36 +226,14 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Upgrading Etherpad npm modules..." --weight=60 -# Update the main modules of etherpad chown -R $app: $final_path -(cd "$final_path/src" -ynh_exec_warn_less npm cache clean --force -# Remove package-lock.json to prevent any shit during npm update... -#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) -# Then update the additionnal modules -(cd "$final_path" -ynh_exec_warn_less npm cache clean --force -while read node_module -do - # Ignore ep_etherpad-lite, this part is updated before in this script. - if [ "$node_module" = "ep_etherpad-lite" ]; then - continue - fi - echo "Update $node_module" - # Build the name of the variable with the version. - module_version=${node_module}_version - # Get the content of the variable (from the file _variables) - module_version=${!module_version:-} - # If the module has no version stored in a variable into the file, keep it empty. - # That way, the upgrade will not be specific to a version. - ## Otherwise, add @ before the version number to force the upgrade to this version. - 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 -done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")") +pushd $final_path + ynh_use_nodejs + ynh_exec_as $app env "$ynh_node_load_PATH" 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 +popd #================================================= # SPECIFIC UPGRADE @@ -291,7 +274,7 @@ then fi ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json" - # Use ldap for mypads + # Use LDAP for MyPads if [ $mypads -eq 1 ] && [ $useldap -eq 1 ] then ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json" @@ -329,11 +312,10 @@ then 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 + ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWORD__" --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" @@ -388,8 +370,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 #================================================= @@ -404,19 +385,6 @@ then sed -i "$mod_line s@div>@&\n\t