diff --git a/ALL_README.md b/ALL_README.md new file mode 100644 index 0000000..a01b345 --- /dev/null +++ b/ALL_README.md @@ -0,0 +1,7 @@ +# All available README files by language + +- [Read the README in English](README.md) +- [Irakurri README euskaraz](README_eu.md) +- [Lire le README en français](README_fr.md) +- [Le o README en galego](README_gl.md) +- [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 8d429f4..0081a07 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -9,10 +9,10 @@ It shall NOT be edited by hand. [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) -*[Lire ce readme en français.](./README_fr.md)* +*[Read this README in other languages.](./ALL_README.md)* -> *This package allows you to install Nextcloud quickly and simply on a YunoHost server. -If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* +> *This package allows you to install Nextcloud quickly and simply on a YunoHost server.* +> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.* ## Overview @@ -29,9 +29,9 @@ In addition to Nextcloud core features, the following are made available with th * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal -**Shipped version:** 28.0.2~ynh1 +**Shipped version:** 28.0.5~ynh1 -**Demo:** https://demo.nextcloud.com/ +**Demo:** ## Screenshots @@ -39,20 +39,20 @@ In addition to Nextcloud core features, the following are made available with th ## Documentation and resources -* Official app website: -* Official user documentation: -* Official admin documentation: -* Upstream app code repository: -* YunoHost Store: -* Report a bug: +- Official app website: +- Official user documentation: +- Official admin documentation: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). +Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). -To try the testing branch, please proceed like that. +To try the `testing` branch, please proceed like that: -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug or sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug diff --git a/README_eu.md b/README_eu.md new file mode 100644 index 0000000..4353f35 --- /dev/null +++ b/README_eu.md @@ -0,0 +1,61 @@ + + +# Nextcloud YunoHost-erako + +[![Integrazio maila](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) + +[![Instalatu Nextcloud YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) + +*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)* + +> *Pakete honek Nextcloud YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.* +> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.* + +## Aurreikuspena + +Nextcloud Hub is a fully open-source on-premises content collaboration platform. Teams access, share and edit their documents, chat and participate in video calls and manage their mail and calendar and projects across mobile, desktop and web interfaces. + +### YunoHost-specific features + +In addition to Nextcloud core features, the following are made available with this package: + + * Integrate with YunoHost users and SSO - i.e. logout button + * Allow one user to be the administrator (set at the installation) + * Allow multiple instances of this application + * Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default) + * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal + + +**Paketatutako bertsioa:** 28.0.5~ynh1 + +**Demoa:** + +## Pantaila-argazkiak + +![Nextcloud(r)en pantaila-argazkia](./doc/screenshots/screenshot.png) + +## Dokumentazioa eta baliabideak + +- Aplikazioaren webgune ofiziala: +- Erabiltzaileen dokumentazio ofiziala: +- Administratzaileen dokumentazio ofiziala: +- Jatorrizko aplikazioaren kode-gordailua: +- YunoHost Denda: +- Eman errore baten berri: + +## Garatzaileentzako informazioa + +Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). + +`testing` abarra probatzeko, ondorengoa egin: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +edo +sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +``` + +**Informazio gehiago aplikazioaren paketatzeari buruz:** diff --git a/README_fr.md b/README_fr.md index daedd3d..91de831 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,6 +1,6 @@ # Nextcloud pour YunoHost @@ -9,10 +9,10 @@ It shall NOT be edited by hand. [![Installer Nextcloud avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) -*[Read this readme in english.](./README.md)* +*[Lire le README dans d'autres langues.](./ALL_README.md)* -> *Ce package vous permet d’installer Nextcloud rapidement et simplement sur un serveur YunoHost. -Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* +> *Ce package vous permet d’installer Nextcloud rapidement et simplement sur un serveur YunoHost.* +> *Si vous n’avez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment l’installer et en profiter.* ## Vue d’ensemble @@ -29,9 +29,9 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv * Utilise l'adresse `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - par exemple, Baïkal -**Version incluse :** 28.0.2~ynh1 +**Version incluse :** 28.0.5~ynh1 -**Démo :** https://demo.nextcloud.com/ +**Démo :** ## Captures d’écran @@ -39,23 +39,23 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv ## Documentations et ressources -* Site officiel de l’app : -* Documentation officielle utilisateur : -* Documentation officielle de l’admin : -* Dépôt de code officiel de l’app : -* YunoHost Store: -* Signaler un bug : +- Site officiel de l’app : +- Documentation officielle utilisateur : +- Documentation officielle de l’admin : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs -Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). +Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). -Pour essayer la branche testing, procédez comme suit. +Pour essayer la branche `testing`, procédez comme suit : -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug ou sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** diff --git a/README_gl.md b/README_gl.md new file mode 100644 index 0000000..5078868 --- /dev/null +++ b/README_gl.md @@ -0,0 +1,61 @@ + + +# Nextcloud para YunoHost + +[![Nivel de integración](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) + +[![Instalar Nextcloud con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) + +*[Le este README en outros idiomas.](./ALL_README.md)* + +> *Este paquete permíteche instalar Nextcloud de xeito rápido e doado nun servidor YunoHost.* +> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.* + +## Vista xeral + +Nextcloud Hub is a fully open-source on-premises content collaboration platform. Teams access, share and edit their documents, chat and participate in video calls and manage their mail and calendar and projects across mobile, desktop and web interfaces. + +### YunoHost-specific features + +In addition to Nextcloud core features, the following are made available with this package: + + * Integrate with YunoHost users and SSO - i.e. logout button + * Allow one user to be the administrator (set at the installation) + * Allow multiple instances of this application + * Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default) + * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal + + +**Versión proporcionada:** 28.0.5~ynh1 + +**Demo:** + +## Capturas de pantalla + +![Captura de pantalla de Nextcloud](./doc/screenshots/screenshot.png) + +## Documentación e recursos + +- Web oficial da app: +- Documentación oficial para usuarias: +- Documentación oficial para admin: +- Repositorio de orixe do código: +- Tenda YunoHost: +- Informar dun problema: + +## Info de desenvolvemento + +Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). + +Para probar a rama `testing`, procede deste xeito: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +ou +sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +``` + +**Máis info sobre o empaquetado da app:** diff --git a/README_it.md b/README_it.md new file mode 100644 index 0000000..d3fa654 --- /dev/null +++ b/README_it.md @@ -0,0 +1,61 @@ + + +# Nextcloud per YunoHost + +[![Livello di integrazione](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) + +[![Installa Nextcloud con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) + +*[Leggi questo README in altre lingue.](./ALL_README.md)* + +> *Questo pacchetto ti permette di installare Nextcloud su un server YunoHost in modo semplice e veloce.* +> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.* + +## Panoramica + +Nextcloud Hub is a fully open-source on-premises content collaboration platform. Teams access, share and edit their documents, chat and participate in video calls and manage their mail and calendar and projects across mobile, desktop and web interfaces. + +### YunoHost-specific features + +In addition to Nextcloud core features, the following are made available with this package: + + * Integrate with YunoHost users and SSO - i.e. logout button + * Allow one user to be the administrator (set at the installation) + * Allow multiple instances of this application + * Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default) + * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal + + +**Versione pubblicata:** 28.0.4~ynh1 + +**Prova:** + +## Screenshot + +![Screenshot di Nextcloud](./doc/screenshots/screenshot.png) + +## Documentazione e risorse + +- Sito web ufficiale dell’app: +- Documentazione ufficiale per gli utenti: +- Documentazione ufficiale per gli amministratori: +- Repository upstream del codice dell’app: +- Store di YunoHost: +- Segnala un problema: + +## Informazioni per sviluppatori + +Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). + +Per provare la branch di `testing`, si prega di procedere in questo modo: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +o +sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +``` + +**Maggiori informazioni riguardo il pacchetto di quest’app:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md new file mode 100644 index 0000000..21fa41f --- /dev/null +++ b/README_zh_Hans.md @@ -0,0 +1,61 @@ + + +# YunoHost 的 Nextcloud + +[![集成程度](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![工作状态](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) + +[![使用 YunoHost 安装 Nextcloud](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) + +*[阅读此 README 的其它语言版本。](./ALL_README.md)* + +> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Nextcloud。* +> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。* + +## 概况 + +Nextcloud Hub is a fully open-source on-premises content collaboration platform. Teams access, share and edit their documents, chat and participate in video calls and manage their mail and calendar and projects across mobile, desktop and web interfaces. + +### YunoHost-specific features + +In addition to Nextcloud core features, the following are made available with this package: + + * Integrate with YunoHost users and SSO - i.e. logout button + * Allow one user to be the administrator (set at the installation) + * Allow multiple instances of this application + * Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default) + * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal + + +**分发版本:** 28.0.5~ynh1 + +**演示:** + +## 截图 + +![Nextcloud 的截图](./doc/screenshots/screenshot.png) + +## 文档与资源 + +- 官方应用网站: +- 官方用户文档: +- 官方管理文档: +- 上游应用代码库: +- YunoHost 商店: +- 报告 bug: + +## 开发者信息 + +请向 [`testing` 分支](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing) 发送拉取请求。 + +如要尝试 `testing` 分支,请这样操作: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +或 +sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug +``` + +**有关应用打包的更多信息:** diff --git a/conf/config.json b/conf/config.json index 1cd7f95..6e4790c 100644 --- a/conf/config.json +++ b/conf/config.json @@ -14,6 +14,7 @@ "hashing_default_password": true, "localstorage.allowsymlinks": true, "simpleSignUpLink.shown": false, + "maintenance_window_start": 1, "mail_smtpmode": "smtp", "mail_smtpport": "25", "mail_smtpauth": 1, diff --git a/conf/nginx.conf b/conf/nginx.conf index 369c117..0300bad 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,7 +19,7 @@ location ^~ /.well-known { location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; } location = /.well-known/webfinger { return 301 __PATH__/index.php$request_uri; } - location = /.well-known/nodeinfo { return 301 __PATH__/index.php$uri; } + location = /.well-known/nodeinfo { return 301 __PATH__/index.php$request_uri; } # Let Nextcloud's API for `/.well-known` URIs handle all other # requests by passing them to the front-end controller. @@ -55,7 +55,7 @@ location ^~ __PATH__/ { client_body_buffer_size 512k; # HTTP response headers borrowed from Nextcloud `.htaccess` - more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; + #more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; more_set_headers "Referrer-Policy: no-referrer"; more_set_headers "X-Content-Type-Options: nosniff"; more_set_headers "X-Download-Options: noopen"; diff --git a/config_panel.toml b/config_panel.toml index 7598044..4e458b6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -11,6 +11,15 @@ name = "Nextcloud configuration" type = "boolean" default = "0" + [main.addressbook] + name = "Address book configuration" + + [main.addressbook.system_addressbook_exposed] + ask = "Should there be a system address book listing all users, accessible by all users?" + type = "boolean" + yes = "yes" + no = "no" + [main.php_fpm_config] name = "PHP-FPM configuration" diff --git a/doc/PRE_UPGRADE.md b/doc/PRE_UPGRADE.d/28.0.3~ynh1.md similarity index 100% rename from doc/PRE_UPGRADE.md rename to doc/PRE_UPGRADE.d/28.0.3~ynh1.md diff --git a/manifest.toml b/manifest.toml index 6be1dc1..815e7cf 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 = "28.0.2~ynh1" +version = "28.0.5~ynh1" maintainers = ["kay0u"] @@ -61,13 +61,20 @@ ram.runtime = "512M" type = "boolean" default = false + [install.system_addressbook_exposed] + ask.en = "Should there be a system address book listing all users, accessible by all users?" + ask.fr = "Devrait-il y avoir un carnet d'adresses système listant tous les comptes, accessible par tous les comptes ?" + type = "select" + choices = ["yes", "no"] + default = "yes" + [resources] [resources.sources] [resources.sources.main] - url = 'https://download.nextcloud.com/server/releases/nextcloud-28.0.2.tar.bz2' - sha256 = 'de34d6baf3ecceacfdd138e85520cd85e1d2ce6798d9ffa478ac17eb1efa1d08' + url = 'https://download.nextcloud.com/server/releases/nextcloud-28.0.5.tar.bz2' + sha256 = 'dca1100f95b864bade113477723c71ac897193352c317e39cd286d87635706eb' [resources.sources.27] url = 'https://download.nextcloud.com/server/releases/nextcloud-27.0.0.tar.bz2' diff --git a/scripts/_common.sh b/scripts/_common.sh index 19e6a36..65cce78 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -40,45 +40,6 @@ is_url_handled() { fi } -#================================================= - -# Check available space before creating a temp directory. -# -# usage: ynh_smart_mktemp --min_size="Min size" -# -# | arg: -s, --min_size= - Minimal size needed for the temporary directory, in Mb -ynh_smart_mktemp () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=min_size= ) - local min_size - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - min_size="${min_size:-300}" - # Transform the minimum size from megabytes to kilobytes - min_size=$(( $min_size * 1024 )) - - # Check if there's enough free space in a directory - is_there_enough_space () { - local free_space=$(df --output=avail "$1" | sed 1d) - test $free_space -ge $min_size - } - - if is_there_enough_space /tmp; then - local tmpdir=/tmp - elif is_there_enough_space /var; then - local tmpdir=/var - elif is_there_enough_space /; then - local tmpdir=/ - elif is_there_enough_space /home; then - local tmpdir=/home - else - ynh_die "Insufficient free space to continue..." - fi - - echo "$(mktemp --directory --tmpdir="$tmpdir")" -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 924f0bd..da8f172 100755 --- a/scripts/backup +++ b/scripts/backup @@ -60,6 +60,12 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/cron.d/$app" +#================================================= +# BACKUP LOGS +#================================================= + +ynh_backup --src_path="/var/log/$app" + #================================================= # BACKUP THE MYSQL DATABASE #================================================= diff --git a/scripts/config b/scripts/config index 1b5e26b..93ced20 100644 --- a/scripts/config +++ b/scripts/config @@ -38,6 +38,11 @@ get__maintenance_mode() { fi } +get__system_addressbook_exposed() { + echo $(cd "$install_dir" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ config:app:get dav system_addressbook_exposed) +} + get__fpm_footprint() { # Free footprint value for php-fpm # Check if current_fpm_footprint is an integer @@ -80,6 +85,12 @@ set__maintenance_mode() { ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode" } +set__system_addressbook_exposed() { + (cd "$install_dir" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ config:app:set dav system_addressbook_exposed --value="$system_addressbook_exposed") + ynh_print_info "System addressbook is exposed: $system_addressbook_exposed" +} + set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then diff --git a/scripts/install b/scripts/install index d3063da..d70b4b2 100755 --- a/scripts/install +++ b/scripts/install @@ -98,6 +98,9 @@ exec_occ config:system:set default_locale --value="$language" country=$(echo "$language" | awk -F'_' '{print $2}') exec_occ config:system:set default_phone_region --value="$country" +# Move the logs from the data_dir to the standard /var/log +exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log" + # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -163,12 +166,13 @@ fi #================================================= # Add dynamic logout URL to the config +url_base64="$(echo -n "https://$domain$path" | base64)" exec_occ config:system:get logout_url >/dev/null 2>&1 \ || echo " //-YunoHost- // set logout_url according to main domain \$main_domain = exec('cat /etc/yunohost/current_host'); -\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; +\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout&r=${url_base64}'; //-YunoHost- " >> "$install_dir/config/config.php" @@ -188,6 +192,12 @@ ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name -- # And delete admin user exec_occ user:delete admin +#================================================= +# ENABLE OR DISABLE SYSTEM ADDRESS BOOK +#================================================= + +exec_occ config:app:set dav system_addressbook_exposed --value="$system_addressbook_exposed" + #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= @@ -251,7 +261,7 @@ chmod 750 $install_dir ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$data_dir/data/nextcloud.log" +ynh_use_logrotate #================================================= # SETUP FAIL2BAN @@ -259,7 +269,7 @@ ynh_use_logrotate --logfile="$data_dir/data/nextcloud.log" ynh_script_progression --message="Configuring Fail2Ban..." --weight=8 # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 +ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index c39ac68..f8d582f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,6 +16,9 @@ ynh_remove_nginx_config # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +# remove logs +ynh_secure_remove --file="/var/log/$app" + # Remove the app-specific logrotate config ynh_remove_logrotate diff --git a/scripts/restore b/scripts/restore index cca5de4..1b0f63c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -53,6 +53,12 @@ ynh_script_progression --message="Restoring cron job..." --weight=1 ynh_restore_file --origin_path="/etc/cron.d/$app" +#================================================= +# RESTORE LOGS +#================================================= + +ynh_restore_file --origin_path="/var/log/$app" + #================================================= # BACKUP THE LOGROTATE CONFIGURATION #================================================= @@ -109,10 +115,10 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" # Make sure a log file exists (mostly for CI tests) -logfile="$data_dir/data/nextcloud.log" +logfile="/var/log/$app/nextcloud.log" if [ ! -f "$logfile" ]; then touch "$logfile" - chown $app: "$logfile" + chown "$app:" "$logfile" fi ynh_systemd_action --action=restart --service_name=fail2ban diff --git a/scripts/upgrade b/scripts/upgrade index 7bce6fe..9d11edf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,6 @@ then ynh_die --message="Upgrading from Nextcloud < 22.2 is not supported anymore. You should first upgrade to 22.2 using: yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/41f5f902e7c7cd3c30a6793020562ba98b9bf3e9" fi - #================================================= # SPECIFIC UPGRADE #================================================= @@ -165,7 +164,7 @@ then fi # Create a temporary directory - tmpdir="$(ynh_smart_mktemp min_size=300)" + tmpdir="${install_dir}__tmp_upgrade" ynh_setup_source --dest_dir="$tmpdir" --source_id="$source_id" @@ -239,6 +238,17 @@ then # Update all installed apps exec_occ app:update --all + # 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 + # Load the config file in nextcloud exec_occ config:import "$nc_conf" @@ -250,14 +260,19 @@ then #================================================= # Add dynamic logout URL to the config - exec_occ config:system:get logout_url >/dev/null 2>&1 \ - || echo " + 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 = exec('cat /etc/yunohost/current_host'); - \$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; + \$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" + " >> "$install_dir/config/config.php" + fi #================================================= # CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS @@ -340,9 +355,10 @@ fi # Create a dedicated NGINX config ynh_add_nginx_config -#------------------------------------------------- +#================================================= # CRON JOB -#------------------------------------------------- +#================================================= + cron_path="/etc/cron.d/$app" ynh_add_config --template="nextcloud.cron" --destination="$cron_path" chown root: "$cron_path" @@ -350,17 +366,18 @@ chmod 644 "$cron_path" exec_occ background:cron -#------------------------------------------------- +#================================================= # LOGROTATE -#------------------------------------------------- +#================================================= + ynh_use_logrotate --non-append -#------------------------------------------------- +#================================================= # FAIL2BAN -#------------------------------------------------- +#================================================= # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 +ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= # END OF SCRIPT diff --git a/sources/patches_last_version/app-00-add-logout_url-conf.patch b/sources/patches_last_version/app-00-add-logout_url-conf.patch index 2c81a65..03f7fc2 100644 --- a/sources/patches_last_version/app-00-add-logout_url-conf.patch +++ b/sources/patches_last_version/app-00-add-logout_url-conf.patch @@ -1,20 +1,31 @@ diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php -index 13aef8f67a..55d8dbf9d1 100644 +index aa6617c..eb47b80 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php -@@ -97,11 +97,12 @@ class LoginController extends Controller { +@@ -111,16 +111,20 @@ class LoginController extends Controller { + #[UseSession] + public function logout() { + $loginToken = $this->request->getCookie('nc_token'); ++ $uuidUser = $this->userSession->getUser()->getUID(); ++ $isLdapUser = $this->config->getUserValue($uuidUser, 'user_ldap', 'uid'); + if (!is_null($loginToken)) { +- $this->config->deleteUserValue($this->userSession->getUser()->getUID(), 'login_token', $loginToken); ++ $this->config->deleteUserValue($uuidUser, 'login_token', $loginToken); } $this->userSession->logout(); - +- - $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( - 'core.login.showLoginForm', - ['clear' => true] // this param the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers -+ $redirectUrl = $this->config->getSystemValue('logout_url', -+ $this->urlGenerator->linkToRouteAbsolute( +- )); +- ++ $redirectUrl = $this->urlGenerator->linkToRouteAbsolute( + 'core.login.showLoginForm', + ['clear' => true] // this param the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers) - )); -- ++ ); ++ if (!is_null($isLdapUser)) { ++ $redirectUrl = $this->config->getSystemValue('logout_url', $redirectUrl); ++ } + $response = new RedirectResponse($redirectUrl); $this->session->set('clearingExecutionContexts', '1'); $this->session->close();