diff --git a/README.md b/README.md index dc0c22dc..1bfe3e70 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Shipped version:** 30.0.4~ynh2 +**Shipped version:** 30.0.5~ynh1 **Demo:** diff --git a/README_es.md b/README_es.md index f104760c..ace78493 100644 --- a/README_es.md +++ b/README_es.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Versión actual:** 30.0.4~ynh2 +**Versión actual:** 30.0.5~ynh1 **Demo:** diff --git a/README_eu.md b/README_eu.md index 120dd6b7..3ce0e0ab 100644 --- a/README_eu.md +++ b/README_eu.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Paketatutako bertsioa:** 30.0.4~ynh2 +**Paketatutako bertsioa:** 30.0.5~ynh1 **Demoa:** diff --git a/README_fr.md b/README_fr.md index 38500704..9c601c1d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ L'adresse `/.well-known` sera automatiquement configuré pour la synchronisatio Le catalogue YunoHost dispose de deux suites bureautiques collaboratives, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) et [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), qui peuvent être intégrées à Nextcloud. -**Version incluse :** 30.0.4~ynh2 +**Version incluse :** 30.0.5~ynh1 **Démo :** diff --git a/README_gl.md b/README_gl.md index d930a5ec..45ca9c68 100644 --- a/README_gl.md +++ b/README_gl.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Versión proporcionada:** 30.0.4~ynh2 +**Versión proporcionada:** 30.0.5~ynh1 **Demo:** diff --git a/README_id.md b/README_id.md index 3d6cc343..dd14aea2 100644 --- a/README_id.md +++ b/README_id.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Versi terkirim:** 30.0.4~ynh2 +**Versi terkirim:** 30.0.5~ynh1 **Demo:** diff --git a/README_nl.md b/README_nl.md index df6b6c37..c8e5b034 100644 --- a/README_nl.md +++ b/README_nl.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Geleverde versie:** 30.0.4~ynh2 +**Geleverde versie:** 30.0.5~ynh1 **Demo:** diff --git a/README_pl.md b/README_pl.md index 2465b2b1..0a131134 100644 --- a/README_pl.md +++ b/README_pl.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Dostarczona wersja:** 30.0.4~ynh2 +**Dostarczona wersja:** 30.0.5~ynh1 **Demo:** diff --git a/README_ru.md b/README_ru.md index 525a7f1e..f503fe6f 100644 --- a/README_ru.md +++ b/README_ru.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**Поставляемая версия:** 30.0.4~ynh2 +**Поставляемая версия:** 30.0.5~ynh1 **Демо-версия:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 888ce826..f46ba2f1 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -26,7 +26,7 @@ The `/.well-known` address will be automatically configured for CalDAV and CardD The YunoHost catalog has two collaborative office suites, [OnlyOffice](https://github.com/YunoHost-Apps/onlyoffice_ynh) and [Collabora](https://github.com/YunoHost-Apps/collabora_ynh), which can be integrated with Nextcloud. -**分发版本:** 30.0.4~ynh2 +**分发版本:** 30.0.5~ynh1 **演示:** diff --git a/hooks/post_user_delete b/hooks/post_user_delete index 7d49d24b..83908ca5 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -9,7 +9,7 @@ php_version=$(ynh_app_setting_get --app=$app --key=php_version) # Define a function to execute commands with `occ` exec_occ() { - (cd "$install_dir" && ynh_exec_as_app \ + (cd "$install_dir" && sudo -u $app \ php${php_version} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") } diff --git a/manifest.toml b/manifest.toml index 3b7ac246..64602115 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Nextcloud" description.en = "Online storage, file sharing platform and various other applications" description.fr = "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" -version = "30.0.4~ynh2" +version = "30.0.5~ynh1" maintainers = ["kay0u"] @@ -59,8 +59,8 @@ ram.runtime = "512M" [resources.sources] [resources.sources.main] - url = 'https://download.nextcloud.com/server/releases/nextcloud-30.0.4.tar.bz2' - sha256 = 'eb6aaba9acef442f2b3e4a996b7ee8a5ed24442f9bba681237fb28ed970e1fa5' + url = 'https://download.nextcloud.com/server/releases/nextcloud-30.0.5.tar.bz2' + sha256 = '248c6e6e612ceeeb170c4d25b8579b0af0e6613abdfa07f2fe6993426b781bea' [resources.sources.29] url = 'https://download.nextcloud.com/server/releases/nextcloud-29.0.10.tar.bz2' diff --git a/patches/main/02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch b/patches/main/01-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch similarity index 100% rename from patches/main/02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch rename to patches/main/01-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch diff --git a/patches/main/01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch b/patches/main/01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch deleted file mode 100644 index 1cbbd31a..00000000 --- a/patches/main/01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -index 993f74ae0e4..c85aadc49db 100644 ---- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -@@ -47,6 +47,10 @@ class ContentSecurityPolicyNonceManager { - * Check if the browser supports CSP v3 - */ - public function browserSupportsCspV3(): bool { -+ // YunoHost patch: disable CSPv3 nonces to: -+ // - avoid white page on first login from YunoHost portal -+ // - allow YunoHost tile display -+ return false; - $browserBlocklist = [ - Request::USER_AGENT_IE, - ]; -diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -index b8bbfdb7d67..a51a15ca0e6 100644 ---- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -+++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -@@ -493,7 +493,8 @@ class EmptyContentSecurityPolicy { - - if (!empty($this->allowedFontDomains)) { - $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); -- $policy .= ';'; -+ // YunoHost patch: extend font-src to load data fonts embedded in YunoHost tile script -+ $policy .= ' data:;'; - } - - if (!empty($this->allowedConnectDomains)) { diff --git a/scripts/restore b/scripts/restore index 1ed03c8e..82f94948 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,13 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression "Restoring data directory..." + +ynh_restore "$data_dir" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -64,13 +71,6 @@ ynh_script_progression "Restoring the logrotate configuration..." ynh_restore "/etc/logrotate.d/$app" -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression "Restoring data directory..." - -ynh_restore "$data_dir" - #================================================= # RESTORE USER RIGHTS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8a20d119..0b8bbd11 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -137,187 +137,186 @@ then fi fi -# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed -if ynh_app_upstream_version_changed -then - ynh_script_progression "Upgrading $app..." +#================================================= +# UPGRADE NEXTCLOUD +#================================================= +ynh_script_progression "Upgrading $app..." - # Set write access for the following commands - chown -R $app:www-data "$install_dir" - # Print the current version number of Nextcloud - exec_occ -V +# Set write access for the following commands +chown -R $app:www-data "$install_dir" +# Print the current version number of Nextcloud +exec_occ -V + +if [ "$(exec_occ config:system:get mysql.utf8mb4)" != "true" ]; then + db_pwd=$(ynh_app_setting_get --key=db_pwd) + # Change your databases character set and collation + ynh_mysql_db_shell <<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" + # Set the mysql.utf8mb4 config to true in config.php + exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true" + exec_occ maintenance:repair +fi - if [ "$(exec_occ config:system:get mysql.utf8mb4)" != "true" ]; then - db_pwd=$(ynh_app_setting_get --key=db_pwd) - # Change your databases character set and collation - ynh_mysql_db_shell <<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" - # Set the mysql.utf8mb4 config to true in config.php - exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true" - exec_occ maintenance:repair - fi +# Upgrade may fail if this app is enabled +# Take all apps enabled, and check if mail is one of them +# Then temporary disable the mail app +mail_app_must_be_reactived=0 + +if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then + exec_occ app:disable mail + mail_app_must_be_reactived=1 +fi - # Upgrade may fail if this app is enabled - # Take all apps enabled, and check if mail is one of them - # Then temporary disable the mail app - mail_app_must_be_reactived=0 +# While the current version is not the last version, do an upgrade +while [ "$last_version" != "$current_version" ] +do - if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then - exec_occ app:disable mail - mail_app_must_be_reactived=1 + next_major_version="$(( $current_major_version + 1 ))" + if [[ "$next_major_version" -ge "$last_major_version" ]]; then + ynh_print_info "Upgrading to Nextcloud $last_version" + source_id="main" + else + ynh_print_info "Upgrading to Nextcloud $next_major_version" + source_id="$next_major_version" fi - # While the current version is not the last version, do an upgrade - while [ "$last_version" != "$current_version" ] - do + # Create a temporary directory + tmpdir="${install_dir}__tmp_upgrade" + + ynh_setup_source --dest_dir="$tmpdir" --source_id="$source_id" - next_major_version="$(( $current_major_version + 1 ))" - if [[ "$next_major_version" -ge "$last_major_version" ]]; then - ynh_print_info "Upgrading to Nextcloud $last_version" - source_id="main" - else - ynh_print_info "Upgrading to Nextcloud $next_major_version" - source_id="$next_major_version" - fi - - # Create a temporary directory - tmpdir="${install_dir}__tmp_upgrade" - - ynh_setup_source --dest_dir="$tmpdir" --source_id="$source_id" - - # Backup the config file in the temp dir - cp -a "$install_dir/config/config.php" "$tmpdir/config/config.php" - - # Enable maintenance mode - exec_occ maintenance:mode --on - - # Backup 3rd party applications from the current Nextcloud - # But do not overwrite if there is any upgrade - # (apps directory already exists in Nextcloud archive) - ( - cd $install_dir/apps - for nc_app_dir in */ - do - if [ ! -d "$tmpdir/apps/$nc_app_dir" ] - then - cp -a "$nc_app_dir" "$tmpdir/apps/$nc_app_dir" - fi - done - ) - - # Replace the old Nextcloud by the new one - ynh_safe_rm "$install_dir" - mv "$tmpdir" "$install_dir" - - # Set write access for the following commands - chown -R $app:www-data "$install_dir" - # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) - exec_occ maintenance:mode --off - exec_occ upgrade || [ $? -eq 3 ] || ynh_die "Unable to upgrade $app" - - # Get the new current version number - current_version=$(grep OC_VersionString "$install_dir/version.php" | cut -d\' -f2) - current_major_version=${current_version%%.*} - - # Print the current version number of Nextcloud - exec_occ -V + # Backup the config file in the temp dir + cp -a "$install_dir/config/config.php" "$tmpdir/config/config.php" + + # Enable maintenance mode + exec_occ maintenance:mode --on + + # Backup 3rd party applications from the current Nextcloud + # But do not overwrite if there is any upgrade + # (apps directory already exists in Nextcloud archive) + ( + cd $install_dir/apps + for nc_app_dir in */ + do + if [ ! -d "$tmpdir/apps/$nc_app_dir" ] + then + cp -a "$nc_app_dir" "$tmpdir/apps/$nc_app_dir" + fi done + ) - exec_occ db:add-missing-indices -n - exec_occ db:add-missing-columns -n - exec_occ db:add-missing-primary-keys -n - exec_occ db:convert-filecache-bigint -n + # Replace the old Nextcloud by the new one + ynh_safe_rm "$install_dir" + mv "$tmpdir" "$install_dir" - #================================================= - # CONFIGURE NEXTCLOUD - #================================================= - ynh_script_progression "Reconfiguring $app..." + # Set write access for the following commands + chown -R $app:www-data "$install_dir" + # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) + exec_occ maintenance:mode --off + exec_occ upgrade || [ $? -eq 3 ] || ynh_die "Unable to upgrade $app" + + # Get the new current version number + current_version=$(grep OC_VersionString "$install_dir/version.php" | cut -d\' -f2) + current_major_version=${current_version%%.*} + + # Print the current version number of Nextcloud + exec_occ -V +done - # Verify the checksum and backup the file if it's different - ynh_backup_if_checksum_is_different "$install_dir/config/config.php" +exec_occ db:add-missing-indices -n +exec_occ db:add-missing-columns -n +exec_occ db:add-missing-primary-keys -n +exec_occ db:convert-filecache-bigint -n - nc_conf="${install_dir}/config.json" - ynh_config_add --template="config.json" --destination="$nc_conf" +#================================================= +# CONFIGURE NEXTCLOUD +#================================================= +ynh_script_progression "Reconfiguring $app..." - # Reneable the mail app - if [ $mail_app_must_be_reactived -eq 1 ]; then - exec_occ app:enable mail - fi +# Verify the checksum and backup the file if it's different +ynh_backup_if_checksum_is_different "$install_dir/config/config.php" - # Ensure that UpdateNotification app is disabled - exec_occ app:disable updatenotification +nc_conf="${install_dir}/config.json" +ynh_config_add --template="config.json" --destination="$nc_conf" - # Enable LDAP plugin - exec_occ app:enable user_ldap +# Reneable the mail app +if [ $mail_app_must_be_reactived -eq 1 ]; then + exec_occ app:enable mail +fi - # Update all installed apps - exec_occ app:update --all +# Ensure that UpdateNotification app is disabled +exec_occ app:disable updatenotification - # move the logs from the data_dir to the standard /var/log - # it would be better in the ENSURE DOWNWARD COMPATIBILITY section - # but it must be after the exec_occ() definition, so it's here - if [ -f "$data_dir/data/nextcloud.log" ]; then - mkdir -p "/var/log/$app" - chmod 750 "/var/log/$app" - mv "$data_dir"/data/nextcloud.log* "/var/log/$app" - # adapt the nextcloud config - exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log" - fi +# Enable LDAP plugin +exec_occ app:enable user_ldap - # Load the config file in nextcloud - exec_occ config:import "$nc_conf" +# Update all installed apps +exec_occ app:update --all - # Then remove the config file - ynh_safe_rm "$nc_conf" +# move the logs from the data_dir to the standard /var/log +# it would be better in the ENSURE DOWNWARD COMPATIBILITY section +# but it must be after the exec_occ() definition, so it's here +if [ -f "$data_dir/data/nextcloud.log" ]; then + mkdir -p "/var/log/$app" + chmod 750 "/var/log/$app" + mv "$data_dir"/data/nextcloud.log* "/var/log/$app" + # adapt the nextcloud config + exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log" +fi - #================================================= - # ALLOW USERS TO DISCONNECT FROM NEXTCLOUD - #================================================= +# Load the config file in nextcloud +exec_occ config:import "$nc_conf" - # Add dynamic logout URL to the config - url_base64="$(echo -n "https://$domain$path" | base64)" - old_logout_url="https://$(cat /etc/yunohost/current_host)/yunohost/sso/?action=logout" - current_logout_url="$(exec_occ config:system:get logout_url 2> /dev/null)" - if [[ "$current_logout_url" == "${old_logout_url}" ]] || [[ "$current_logout_url" == "" ]] - then - echo " - //-YunoHost- - // set logout_url according to main domain - \$main_domain = file_get_contents('/etc/yunohost/current_host'); - \$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout&r=${url_base64}'; - //-YunoHost- - " >> "$install_dir/config/config.php" - fi +# Then remove the config file +ynh_safe_rm "$nc_conf" - #================================================= - # CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS - #================================================= - - exec_occ config:system:set overwrite.cli.url --value="https://${domain}${path}" - - #================================================= - # MOUNT HOME FOLDERS AS EXTERNAL STORAGE - #================================================= - - # Enable External Storage and create local mount to home folder as needed - if [ $user_home -eq 1 ]; then - exec_occ app:enable files_external - exec_occ files_external:list --output=json \ - | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ - || create_external_storage "/home/\$user" "Home" - # Iterate over users to extend their home folder permissions - for u in $(ynh_user_list); do - setfacl --modify g:$app:rwx "/home/$u" || true - done - fi +#================================================= +# ALLOW USERS TO DISCONNECT FROM NEXTCLOUD +#================================================= - #================================================= - # STORE THE CHECKSUM OF THE CONFIG FILE - #================================================= +# Add dynamic logout URL to the config +url_base64="$(echo -n "https://$domain$path" | base64)" +old_logout_url="https://$(cat /etc/yunohost/current_host)/yunohost/sso/?action=logout" +current_logout_url="$(exec_occ config:system:get logout_url 2> /dev/null)" +if [[ "$current_logout_url" == "${old_logout_url}" ]] || [[ "$current_logout_url" == "" ]] +then + echo " +//-YunoHost- +// set logout_url according to main domain +\$main_domain = file_get_contents('/etc/yunohost/current_host'); +\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout&r=${url_base64}'; +//-YunoHost- + " >> "$install_dir/config/config.php" +fi - # Calculate and store the config file checksum into the app settings - ynh_store_file_checksum "${install_dir}/config/config.php" +#================================================= +# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS +#================================================= + +exec_occ config:system:set overwrite.cli.url --value="https://${domain}${path}" + +#================================================= +# MOUNT HOME FOLDERS AS EXTERNAL STORAGE +#================================================= + +# Enable External Storage and create local mount to home folder as needed +if [ $user_home -eq 1 ]; then + exec_occ app:enable files_external + exec_occ files_external:list --output=json \ + | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ + || create_external_storage "/home/\$user" "Home" + # Iterate over users to extend their home folder permissions + for u in $(ynh_user_list); do + setfacl --modify g:$app:rwx "/home/$u" || true + done fi +#================================================= +# STORE THE CHECKSUM OF THE CONFIG FILE +#================================================= + +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum "${install_dir}/config/config.php" + #================================================= # REGEN PERMISSIONS #=================================================