From ba4cd7f025507f8547164cffbc9a30a1f1253c11 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 25 Mar 2023 08:30:32 +0000 Subject: [PATCH 01/13] Auto-update README --- README.md | 4 ++-- README_fr.md | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 954743d..6032f8a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Lutim for YunoHost -[![Integration level](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Working status](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Working status](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) + [![Install Lutim with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim) *[Lire ce readme en français.](./README_fr.md)* @@ -20,7 +21,6 @@ Images are indefinitely stored unless you request that they will be deleted at f **Shipped version:** 0.12.1~ynh4 - **Demo:** https://lut.im/ ## Disclaimers / important information diff --git a/README_fr.md b/README_fr.md index 049f20a..ac84510 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,21 +5,21 @@ It shall NOT be edited by hand. # Lutim pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) + [![Installer Lutim avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Lutim 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 Lutim 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.* -## Vue d'ensemble +## Vue d’ensemble Lutim stocke les images et vous permet de les voir, de les télécharger ou de les partager sur les réseaux sociaux. Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles soient effacées à la première vue ou après 24 heures / une semaine / un mois / un an. -**Version incluse :** 0.12.1~ynh4 - +**Version incluse :** 0.12.1~ynh4 **Démo :** https://lut.im/ ## Avertissements / informations importantes @@ -31,9 +31,9 @@ Rechargez ensuite le service Lutim. ## Documentations et ressources -* Site officiel de l'app : +* Site officiel de l’app : * Documentation officielle utilisateur : -* Dépôt de code officiel de l'app : +* Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -49,4 +49,4 @@ ou sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 3d83ceb5adc8e2a2509e48a370b86085000311a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 16 Apr 2023 17:12:12 +0200 Subject: [PATCH 02/13] Version 2 (#73) * v2 * Auto-update README * v2 * Auto-update README * Update manifest.toml * Update _common.sh * Update manifest.toml * Update tests.toml * fix * fix * Update upgrade --------- Co-authored-by: yunohost-bot --- CHANGELOG.md | 83 ------------ README.md | 7 - README_fr.md | 7 - conf/app.src | 7 - conf/cron_lutim | 8 +- conf/nginx.conf | 2 +- conf/systemd.service | 40 +++++- doc/ADMIN.md | 4 + doc/ADMIN_fr.md | 2 + doc/DISCLAIMER.md | 4 - doc/DISCLAIMER_fr.md | 4 - manifest.json | 66 ---------- manifest.toml | 64 +++++++++ scripts/_common.sh | 306 ++----------------------------------------- scripts/backup | 19 +-- scripts/change_url | 115 +--------------- scripts/install | 136 ++----------------- scripts/remove | 36 ----- scripts/restore | 76 +---------- scripts/upgrade | 173 +++--------------------- tests.toml | 15 +++ 21 files changed, 181 insertions(+), 993 deletions(-) delete mode 100644 CHANGELOG.md delete mode 100644 conf/app.src create mode 100644 doc/ADMIN.md create mode 100644 doc/ADMIN_fr.md delete mode 100644 doc/DISCLAIMER.md delete mode 100644 doc/DISCLAIMER_fr.md delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 80f6cb1..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -Changelog -========= - -## [0.12.1~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-10-18 - -#### Changed -* [Update to Lutim 0.12.1](https://github.com/YunoHost-Apps/lutim_ynh/pull/52) - - -## [0.11.6~ynh4](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-04-25 - -#### Added -- [Add new badges](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/4e28257f0550378297789c77a5354b004100f5ae) -* [New reset actions](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/e1c90a7c1b2c0c66c4d7bfc8a8e2a221d5c817ab) - -#### Fixed -- [Fix potential error on install](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/e481e03e0511787f297e10f85d6a54b3fedb5470) - -#### Changed -- [Indentation](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/a934b7369842dfbdc45e7c1dfdf3483276d4c755) -- [Misc upgrade](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/750ea401950f4e8b3facfa7caa5bc2388b6a4272) - - -## [0.11.6~ynh3](https://github.com/YunoHost-Apps/lutim_ynh/pull/45) - 2020-03-12 - -#### Changed -- [ Fix migration to new permission system](https://github.com/YunoHost-Apps/lutim_ynh/pull/45/commits/e0d3764ffbcde3d354b7c27154f829cad8172e2e) - -## [0.11.6~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/43) - 2020-01-04 - -#### Fixed -- [Fix config-panel](https://github.com/YunoHost-Apps/lutim_ynh/pull/43/commits/a549f8139737d0ed3f641a8b0425dfdeefb50ef4) - - -## [0.11.6~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/42) - 2020-01-02 - -#### Added -* [Set workers according to cpu](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/58e291949769d678ec48306199bcc03e3be20631) -- [Add changelog](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/b0859ab1612c22d210321d6302cad7872ec17abd) - -#### Fixed -- [Fix cron tasks](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/dec8d0820fb46e984b2ca65e1012f5f737861965) - -#### Changed -- [Update to last standard](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/5e5bf7c7a8f68b0768555005797ec3024a223299) [(twice)](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/51113ba7544991a3400abc9a78258ba594d58b4b) -- [Use toml for actions and config-panel](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/4f7bac24481138654e3e3128ba6637cdf8855855) -* [Update to 0.11.6](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/4b50a261fb4515aa2a32b7ca20c750c322bfd5c0) - - -## [0.11.5~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/35) - 2019-05-06 - -#### Changed -* [Update to Lutim 0.11.5](https://github.com/YunoHost-Apps/lutim_ynh/pull/35) - - -## [0.11.4~ynh3](https://github.com/YunoHost-Apps/lutim_ynh/pull/33) - 2019-02-18 - -#### Changed -- [Upgrade protected_regex](https://github.com/YunoHost-Apps/lutim_ynh/pull/33) - - -## [0.11.4~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/31) - 2019-02-03 - -#### Added -- [Add progression bar](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/6b63a2ce2feca4550e55f2404e8b18f13ef58fc7) -- [Changelog & html email](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/746d00174c3fde429f64b514d4f113b01780e701) - -#### Fixed -- [Do not open port](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/0c2af89b610a420129588e62537bb248d7810777) -- [Delete dedicated user](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/f9d7f124f0966870004aa620ac4626dd8ebb19ff) - - -## [0.11.4~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/30) - 2019-01-21 - -#### Changed -* [Update to Lutim 0.11.4](https://github.com/YunoHost-Apps/lutim_ynh/pull/30/commits/0b3640581ce18b9f823baae7130ab0645f9f1e8e) -- [Update to last standart](https://github.com/YunoHost-Apps/lutim_ynh/pull/30/commits/9d37c8b9f50ef728ebe4a05031de4c70f76940b4) - - -## [0.10.4~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/29) - 2018-09-30 - -#### Added -* [Panel-config + actions fully tested](https://github.com/YunoHost-Apps/lutim_ynh/pull/29/commits/6cf6b6331170fd6f36575c9c06a17b11a9da66d0) diff --git a/README.md b/README.md index 6032f8a..b7ba3d5 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,6 @@ Images are indefinitely stored unless you request that they will be deleted at f **Shipped version:** 0.12.1~ynh4 **Demo:** https://lut.im/ -## Disclaimers / important information - -## Configuration - -Edit the file `/var/www/lutim/lutim.conf` to configure Lutim. -Then reload the lutim service. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index ac84510..b93dfde 100644 --- a/README_fr.md +++ b/README_fr.md @@ -22,13 +22,6 @@ Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles **Version incluse :** 0.12.1~ynh4 **Démo :** https://lut.im/ -## Avertissements / informations importantes - -## Configuration - -Éditez le fichier `/var/www/lutim/lutim.conf` pour configurer Lutim. -Rechargez ensuite le service Lutim. - ## Documentations et ressources * Site officiel de l’app : diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 11900b9..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.1/lutim-0.12.1.tar.gz -SOURCE_SUM=141f142d47e3a8367e0c292304ddbecfc34b49ae7e561e2c3526000040318973 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/cron_lutim b/conf/cron_lutim index f96f975..ee69a65 100644 --- a/conf/cron_lutim +++ b/conf/cron_lutim @@ -1,11 +1,11 @@ # Génération des statistiques. Tous les jours, à 5h. -0 5 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron stats +0 5 * * * __APP__ cd "__INSTALL_DIR__" && $(which carton) exec script/lutim cron stats # Suppression des adresses IP obsolètes. Tous les jours, à 6h. -0 6 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanbdd +0 6 * * * __APP__ cd "__INSTALL_DIR__" && $(which carton) exec script/lutim cron cleanbdd # Suppression des images dont le délai a expiré. Tous les jours, à 6h. -0 6 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanfiles +0 6 * * * __APP__ cd "__INSTALL_DIR__" && $(which carton) exec script/lutim cron cleanfiles # Vérification de l'occupation du dossier des images. Tous les jours, à 7h. -0 7 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron watch +0 7 * * * __APP__ cd "__INSTALL_DIR__" && $(which carton) exec script/lutim cron watch diff --git a/conf/nginx.conf b/conf/nginx.conf index 864e14e..f3f454a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location __PATH__/ { access_log off; error_log /var/log/nginx/lutim.error.log; - # This is important ! Make it OK with your Lutim configuration + # This is important! Make it OK with your Lutim configuration client_max_body_size 40M; proxy_pass http://127.0.0.1:__PORT__; diff --git a/conf/systemd.service b/conf/systemd.service index 23707fa..56f2521 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,16 +1,50 @@ [Unit] -Description=Lutim: Image hosting and sharing service +Description=Lutim: image hosting and sharing service After=network.target [Service] Type=forking User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -PIDFile=__FINALPATH__/script/hypnotoad.pid +WorkingDirectory=__INSTALL_DIR__/ +PIDFile=__INSTALL_DIR__/script/hypnotoad.pid ExecStart=/usr/bin/carton exec hypnotoad script/lutim >> /var/log/lutim/production.log 2>&1 ExecStop=/usr/bin/carton exec hypnotoad -s script/lutim >> /var/log/lutim/production.log 2>&1 ExecReload=/usr/bin/carton exec hypnotoad script/lutim >> /var/log/lutim/production.log 2>&1 +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..cc120df --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1,4 @@ +## Configuration + +Edit the file `__INSTALL_DIR__/lutim.conf` to configure Lutim. +Then reload the lutim service. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..3db28b2 --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1,2 @@ +Éditez le fichier `__INSTALL_DIR__/lutim.conf` pour configurer Lutim. +Rechargez ensuite le service Lutim. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 626ac96..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,4 +0,0 @@ -## Configuration - -Edit the file `/var/www/lutim/lutim.conf` to configure Lutim. -Then reload the lutim service. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index 3003f70..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1,4 +0,0 @@ -## Configuration - -Éditez le fichier `/var/www/lutim/lutim.conf` pour configurer Lutim. -Rechargez ensuite le service Lutim. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 8c4db3b..0000000 --- a/manifest.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "Lutim", - "id": "lutim", - "packaging_format": 1, - "description": { - "en": "Anonymous image hosting service", - "fr": "Service d'hébergement anonyme d'images" - }, - "version": "0.12.1~ynh4", - "url": "https://lut.im", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://lut.im", - "demo": "https://lut.im/", - "userdoc": "https://framagit.org/luc/lutim/wikis/home", - "code": "https://framagit.org/fiat-tux/hat-softwares/lutim" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "", - "email": "" - }, - "previous_maintainers": [{ - "name": "Maniack Crudelis et matlink", - "email": "maniackc_dev@crudelis.fr" - }], - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/lutim", - "default": "/lutim" - }, - { - "name": "is_public", - "type": "boolean", - "default": false, - "help": { - "en": "If you set Lutim as public, everyone will be able to upload images and share them.
But even if not public, everyone can see an image from a link shared with your Lutim.", - "fr": "Si vous définissez Lutim comme public, tout le monde pourra télécharger des images et les partager.
Mais même si ce n'est pas public, tout le monde peut voir une image à partir d'un lien partagé avec votre Lutim." - } - }, - { - "name": "always_encrypt", - "type": "boolean", - "ask": { - "en": "Force the encryption of images?", - "fr": "Forcer le chiffrement des images ?" - }, - "default": true - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..e49feec --- /dev/null +++ b/manifest.toml @@ -0,0 +1,64 @@ +packaging_format = 2 + +id = "lutim" +name = "Lutim" +description.en = "Anonymous image hosting service" +description.fr = "Service d'hébergement anonyme d'images" + +version = "0.12.1~ynh4" + +maintainers = [] + +[upstream] +license = "AGPL-3.0-only" +website = "https://lut.im" +demo = "https://lut.im/" +userdoc = "https://framagit.org/luc/lutim/wikis/home" +code = "https://framagit.org/fiat-tux/hat-softwares/lutim" + +[integration] +yunohost = ">= 11.1.17" +architectures = "all" +multi_instance = false +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/lutim" + + [install.init_main_permission] + help.en = "If you set Lutim as visitors, everyone will be able to upload images and share them.
But even if not public, everyone can see an image from a link shared with your Lutim." + help.fr = "Si vous définissez Lutim comme visitors, tout le monde pourra télécharger des images et les partager.
Mais même si ce n'est pas public, tout le monde peut voir une image à partir d'un lien partagé avec votre Lutim." + type = "group" + default = "visitors" + + [install.always_encrypt] + ask.en = "Force the encryption of images?" + ask.fr = "Forcer le chiffrement des images ?" + type = "boolean" + default = true + +[resources] + [resources.sources.main] + url = "https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.1/lutim-0.12.1.tar.gz" + sha256 = "141f142d47e3a8367e0c292304ddbecfc34b49ae7e561e2c3526000040318973" + + [resources.ports] + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = "carton perlmagick libpq-dev shared-mime-info" diff --git a/scripts/_common.sh b/scripts/_common.sh index 79b3e7d..62a03b2 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="carton perlmagick libpq-dev shared-mime-info" - #================================================= # PERSONAL HELPERS #================================================= @@ -15,152 +12,10 @@ pkg_dependencies="carton perlmagick libpq-dev shared-mime-info" # EXPERIMENTAL HELPERS #================================================= -# Send an email to inform the administrator -# -# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] -# | arg: -m --app_message= - The file with the content to send to the administrator. -# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root -# example: "root admin@domain" -# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you -# example: "root admin@domain user1 user2" -# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' -ynh_send_readme_to_admin() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) - local app_message - local recipients - local type - # Manage arguments with getopts - - ynh_handle_getopts_args "$@" - app_message="${app_message:-}" - recipients="${recipients:-root}" - type="${type:-install}" - - # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) - admin_mail_html="${admin_mail_html:-0}" - - # Retrieve the email of users - find_mails () { - local list_mails="$1" - local mail - local recipients=" " - # Read each mail in argument - for mail in $list_mails - do - # Keep root or a real email address as it is - if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" - then - recipients="$recipients $mail" - else - # But replace an user name without a domain after by its email - if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) - then - recipients="$recipients $mail" - fi - fi - done - echo "$recipients" - } - recipients=$(find_mails "$recipients") - - # Subject base - local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" - - # Adapt the subject according to the type of mail required. - if [ "$type" = "backup" ]; then - mail_subject="$mail_subject has just been backup." - elif [ "$type" = "change_url" ]; then - mail_subject="$mail_subject has just been moved to a new URL!" - elif [ "$type" = "remove" ]; then - mail_subject="$mail_subject has just been removed!" - elif [ "$type" = "restore" ]; then - mail_subject="$mail_subject has just been restored!" - elif [ "$type" = "upgrade" ]; then - mail_subject="$mail_subject has just been upgraded!" - else # install - mail_subject="$mail_subject has just been installed!" - fi - - local mail_message="This is an automated message from your beloved YunoHost server. - -Specific information for the application $app. - -$(if [ -n "$app_message" ] -then - cat "$app_message" -else - echo "...No specific information..." -fi) - ---- -Automatic diagnosis data from YunoHost - -__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__" - - # Store the message into a file for further modifications. - echo "$mail_message" > mail_to_send - - # If a html email is required. Apply html tags to the message. - if [ "$admin_mail_html" -eq 1 ] - then - # Insert 'br' tags at each ending of lines. - ynh_replace_string "$" "
" mail_to_send - - # Insert starting HTML tags - sed --in-place '1s@^@\n\n\n\n@' mail_to_send - - # Keep tabulations - ynh_replace_string " " "\ \ " mail_to_send - ynh_replace_string "\t" "\ \ " mail_to_send - - # Insert url links tags - ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - - # Insert pre tags - ynh_replace_string "__PRE_TAG1__" "
" mail_to_send
-		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
-
-		# Insert finishing HTML tags
-		echo -e "\n\n" >> mail_to_send
-
-	# Otherwise, remove tags to keep a plain text.
-	else
-		# Remove URL tags
-		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
-		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
-
-		# Remove PRE tags
-		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
-	fi
-
-	# Define binary to use for mail command
-	if [ -e /usr/bin/bsd-mailx ]
-	then
-		local mail_bin=/usr/bin/bsd-mailx
-	else
-		local mail_bin=/usr/bin/mail.mailutils
-	fi
-
-	if [ "$admin_mail_html" -eq 1 ]
-	then
-		content_type="text/html"
-	else
-		content_type="text/plain"
-	fi
-
-	# Send the email to the recipients
-	cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
-}
-
-
-#=================================================
-
 ynh_maintenance_mode_ON () {
-	# Load value of $path_url and $domain from the config if their not set
-	if [ -z $path_url ]; then
-		path_url=$(ynh_app_setting_get $app path)
+	# Load value of $path and $domain from the config if their not set
+	if [ -z $path ]; then
+		path=$(ynh_app_setting_get $app path)
 	fi
 	if [ -z $domain ]; then
 		domain=$(ynh_app_setting_get $app domain)
@@ -190,10 +45,10 @@ ynh_maintenance_mode_ON () {
 " > "/var/www/html/maintenance.$app.html"
 
 	# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
-	echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
-rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
+	echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice
+rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect;
 # Use another location, to not be in conflict with the original config file
-location ${path_url}_maintenance/ {
+location ${path}_maintenance/ {
 alias /var/www/html/ ;
 
 try_files maintenance.$app.html =503;
@@ -204,7 +59,7 @@ include conf.d/yunohost_panel.conf.inc;
 
 	# The current config file will redirect all requests to the root of the app.
 	# To keep the full path, we can use the following rewrite rule:
-	# 	rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
+	# 	rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect;
 	# The difference will be in the $1 at the end, which keep the following queries.
 	# But, if it works perfectly for a html request, there's an issue with any php files.
 	# This files are treated as simple files, and will be downloaded by the browser.
@@ -214,16 +69,16 @@ include conf.d/yunohost_panel.conf.inc;
 }
 
 ynh_maintenance_mode_OFF () {
-	# Load value of $path_url and $domain from the config if their not set
-	if [ -z $path_url ]; then
-		path_url=$(ynh_app_setting_get $app path)
+	# Load value of $path and $domain from the config if their not set
+	if [ -z $path ]; then
+		path=$(ynh_app_setting_get $app path)
 	fi
 	if [ -z $domain ]; then
 		domain=$(ynh_app_setting_get $app domain)
 	fi
 
-	# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
-	echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
+	# Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
+	echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
 	systemctl reload nginx
 
 	# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
@@ -236,143 +91,6 @@ ynh_maintenance_mode_OFF () {
 	systemctl reload nginx
 }
 
-#=================================================
-
-# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
-#
-# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
-# | arg: -f --format= - Format in which the changelog will be printed
-#       markdown: Default format.
-#       html:     Turn urls into html format.
-#       plain:    Plain text changelog
-# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
-# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
-#
-# The changelog is printed into the file ./changelog and ./changelog_lite
-ynh_app_changelog () {
-    # Declare an array to define the options of this helper.
-    local legacy_args=foc
-    declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
-    local format
-    local output
-    local changelog
-    # Manage arguments with getopts
-    ynh_handle_getopts_args "$@"
-    format=${format:-markdown}
-    output=${output:-changelog}
-    changelog=${changelog:-../CHANGELOG.md}
-
-    local original_changelog="$changelog"
-    local temp_changelog="changelog_temp"
-    local final_changelog="$output"
-
-    if [ ! -n "$original_changelog" ]
-    then
-        echo "No changelog available..." > "$final_changelog"
-        echo "No changelog available..." > "${final_changelog}_lite"
-        return 0
-    fi
-
-    local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
-    local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
-
-    # Get the line of the version to update to into the changelog
-    local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
-    # If there's no entry for this version yet into the changelog
-    # Get the first available version
-    if [ -z "$update_version_line" ]
-    then
-        update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
-    fi
-
-    # Get the length of the complete changelog.
-    local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
-    # Cut the file before the version to update to.
-    tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
-
-    # Get the length of the troncated changelog.
-    changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
-    # Get the line of the current version into the changelog
-    # Keep only the last line found
-    local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
-    # If there's no entry for this version into the changelog
-    # Get the last available version
-    if [ -z "$current_version_line" ]
-    then
-        current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
-    fi
-    # Cut the file before the current version.
-    # Then grep the previous version into the changelog to get the line number of the previous version
-    local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
-        "$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
-    # If there's no previous version into the changelog
-    # Go until the end of the changelog
-    if [ -z "$previous_version_line" ]
-    then
-        previous_version_line=$changelog_length
-    fi
-
-    # Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
-    head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
-
-    if [ "$format" = "html" ]
-    then
-        # Replace markdown links by html links
-        ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="\1)" --target_file="$final_changelog"
-        ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="\1" --target_file="$final_changelog"
-    elif [ "$format" = "plain" ]
-    then
-        # Change title format.
-        ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
-        # Change modifications lines format.
-        ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
-    fi
-    # else markdown. As the file is already in markdown, nothing to do.
-
-    # Keep only important changes into the changelog
-    # Remove all minor changes
-    sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
-    # Remove all blank lines (to keep a clear workspace)
-    sed --in-place '/^$/d' "${final_changelog}_lite"
-    # Add a blank line at the end
-    echo "" >> "${final_changelog}_lite"
-
-    # Clean titles if there's no significative changes
-    local line
-    local previous_line=""
-    while read line <&3
-    do
-        if [ -n "$previous_line" ]
-        then
-            # Remove the line if it's a title or a blank line, and the previous one was a title as well.
-            if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
-            then
-                ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
-            fi
-        fi
-        previous_line="$line"
-    done 3< "${final_changelog}_lite"
-
-    # Remove all blank lines again
-    sed --in-place '/^$/d' "${final_changelog}_lite"
-
-    # Restore changelog format with blank lines
-    ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
-    # Remove the 2 first blank lines
-    sed --in-place '1,2d' "${final_changelog}_lite"
-    # Add a blank line at the end
-    echo "" >> "${final_changelog}_lite"
-
-    # If changelog are empty, add an info
-    if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
-    then
-        echo "No changes from the changelog..." > "$final_changelog"
-    fi
-    if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
-    then
-        echo "No significative changes from the changelog..." > "${final_changelog}_lite"
-    fi
-}
 
 #=================================================
 
diff --git a/scripts/backup b/scripts/backup
index 8bdcf21..8291d91 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -10,23 +10,6 @@
 source ../settings/scripts/_common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_print_info --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-
 #=================================================
 # DECLARE DATA AND CONF FILES TO BACKUP
 #=================================================
@@ -36,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
 # BACKUP THE APP MAIN DIR
 #=================================================
 
-ynh_backup --src_path="$final_path"
+ynh_backup --src_path="$install_dir"
 
 #=================================================
 # BACKUP THE NGINX CONFIGURATION
diff --git a/scripts/change_url b/scripts/change_url
index 62b9ef5..19f7c35 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -9,73 +9,15 @@
 source _common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-old_domain=$YNH_APP_OLD_DOMAIN
-old_path=$YNH_APP_OLD_PATH
-
-new_domain=$YNH_APP_NEW_DOMAIN
-new_path=$YNH_APP_NEW_PATH
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=2
-
-# Needed for helper "ynh_add_nginx_config"
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-# Add settings here as needed by your application
-is_public=$(ynh_app_setting_get --app=$app --key=is_public)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
-#=================================================
-# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=20
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
-	ynh_clean_check_starting
-	# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
-	ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-
-	# Restore it if the upgrade fails
-	ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Activating maintenance mode..."
 
-path_url=$old_path
+path=$old_path
 domain=$old_domain
+
 ynh_maintenance_mode_ON
 
-#=================================================
-# CHECK WHICH PARTS SHOULD BE CHANGED
-#=================================================
-
-change_domain=0
-if [ "$old_domain" != "$new_domain" ]
-then
-	change_domain=1
-fi
-
-change_path=0
-if [ "$old_path" != "$new_path" ]
-then
-	change_path=1
-fi
-
 #=================================================
 # STANDARD MODIFICATIONS
 #=================================================
@@ -90,46 +32,7 @@ ynh_systemd_action --service_name=$app --action="stop"
 #=================================================
 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
 
-nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
-
-# Change the path in the NGINX config file
-if [ $change_path -eq 1 ]
-then
-	# Make a backup of the original NGINX config file if modified
-	ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
-	# Set global variables for NGINX helper
-	domain="$old_domain"
-	path_url="$new_path"
-	# Create a dedicated NGINX config
-	ynh_add_nginx_config
-fi
-
-# Change the domain for NGINX
-if [ $change_domain -eq 1 ]
-then
-	# Delete file checksum for the old conf file location
-	ynh_delete_file_checksum --file="$nginx_conf_path"
-	mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
-	# Store file checksum for the new config file location
-	ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-fi
-
-#=================================================
-# UPDATE SSOWAT
-#=================================================
-ynh_script_progression --message="Reconfiguring SSOwat..."
-
-if [ $is_public -eq 0 ] # Only user with a yunohost account can upload an image
-then
-	# If the app is private, viewing images stays publicly accessible.
-	if [ "$new_path" == "/" ]; then
-		# If the path is /, clear it to prevent any error with the regex.
-		new_path=""
-	fi
-	# Modify the domain to be used in a regex
-	domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
-	ynh_app_setting_set  --app=$app --key=protected_regex --value="$domain_regex$new_path/stats/?$","$domain_regex$new_path/manifest.webapp/?$","$domain_regex$new_path/?$","$domain_regex$new_path/[d-m]/.*$"
-fi
+ynh_change_url_nginx_config
 
 #=================================================
 # SPECIFIC MODIFICATIONS
@@ -137,7 +40,7 @@ fi
 # REPLACE THE PATH IN THE CONFIG OF LUTIM
 #=================================================
 
-ynh_replace_string --match_string="\(^ *prefix.*=> '\).*" --replace_string="\1$new_path'," --target_file="$final_path/lutim.conf"
+ynh_replace_string --match_string="\(^ *prefix.*=> '\).*" --replace_string="\1$new_path'," --target_file="$install_dir/lutim.conf"
 
 #=================================================
 # GENERIC FINALISATION
@@ -149,19 +52,11 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
 # Start a systemd service
 ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
 
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
-
-ynh_systemd_action --service_name=nginx --action=reload
-
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disabling maintenance mode..."
 
-path_url=$old_path
+path=$old_path
 domain=$old_domain
 ynh_maintenance_mode_OFF
 
diff --git a/scripts/install b/scripts/install
index 7c6e61d..8647078 100644
--- a/scripts/install
+++ b/scripts/install
@@ -9,48 +9,16 @@
 source _common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
-	ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
 #=================================================
 # RETRIEVE ARGUMENTS FROM THE MANIFEST
 #=================================================
 
-domain=$YNH_APP_ARG_DOMAIN
-path_url=$YNH_APP_ARG_PATH
-is_public=$YNH_APP_ARG_IS_PUBLIC
-always_encrypt=$YNH_APP_ARG_ALWAYS_ENCRYPT
-
-app=$YNH_APP_INSTANCE_NAME
-
 secret=$(ynh_string_random)
 
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
-#=================================================
-ynh_script_progression --message="Validating installation parameters..." --weight=2
-
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
-
-# Register (book) web path
-ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
-
 #=================================================
 # STORE SETTINGS FROM MANIFEST
 #=================================================
-ynh_script_progression --message="Storing installation settings..." --weight=2
 
-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=is_public --value=$is_public
 ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt
 ynh_app_setting_set --app=$app --key=secret --value="$secret"
 
@@ -59,44 +27,16 @@ ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
 ynh_app_setting_set --app=$app --key=overwrite_systemd --value=1
 ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
 
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=3
-
-# Find an available port
-port=$(ynh_find_port --port=8095)
-ynh_app_setting_set --app=$app --key=port --value=$port
-
-#=================================================
-# INSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=60
-
-ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Configuring system user..." --weight=2
-
-# Create a system user
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
 #=================================================
 # DOWNLOAD, CHECK AND UNPACK SOURCE
 #=================================================
 ynh_script_progression --message="Setting up source files..."
 
-ynh_app_setting_set --app=$app --key=final_path --value=$final_path
 # Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$final_path"
+ynh_setup_source --dest_dir="$install_dir"
 
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:$app "$final_path"
+chmod -R o-rwx "$install_dir"
+chown -R $app:$app "$install_dir"
 
 #=================================================
 # NGINX CONFIGURATION
@@ -114,10 +54,10 @@ ynh_add_nginx_config
 ynh_script_progression --message="Adding a configuration file..." --weight=2
 
 workers="$(( $(nproc) * 2 ))"
-ynh_add_config --template="../conf/lutim.conf.template" --destination="$final_path/lutim.conf"
+ynh_add_config --template="../conf/lutim.conf.template" --destination="$install_dir/lutim.conf"
 
-chmod 400 "$final_path/lutim.conf"
-chown $app:$app "$final_path/lutim.conf"
+chmod 400 "$install_dir/lutim.conf"
+chown $app:$app "$install_dir/lutim.conf"
 
 #=================================================
 # SETUP HOOKS FILE
@@ -131,7 +71,7 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil
 #=================================================
 
 ynh_add_config --template="../conf/cron_lutim" --destination="/etc/cron.d/$app"
-chmod +x $final_path/script/lutim
+chmod +x $install_dir/script/lutim
 
 #=================================================
 # INSTALL LUTIM WITH CARTON
@@ -139,16 +79,16 @@ chmod +x $final_path/script/lutim
 ynh_script_progression --message="Installing $app with Carton..." --weight=60
 
 mkdir -p /var/log/$app/
-(cd $final_path
+(cd $install_dir
 carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log")
 
 # Use a perl path adapted to the system architecture
-arch_dir=$(ls -1 $final_path/local/lib/perl5/ | grep linux-gnu)
+arch_dir=$(ls -1 $install_dir/local/lib/perl5/ | grep linux-gnu)
 if [ "$?" -ne 0 ]
 then
 	ynh_die --message="Unable to find the perl directory for your architecture."
 fi
-ynh_replace_string --match_string="__ARCHDIR__" --replace_string="$arch_dir" --target_file="$final_path/script/lutim"
+ynh_replace_string --match_string="__ARCHDIR__" --replace_string="$arch_dir" --target_file="$install_dir/script/lutim"
 
 #=================================================
 # SETUP LOG FILE
@@ -157,7 +97,7 @@ ynh_replace_string --match_string="__ARCHDIR__" --replace_string="$arch_dir" --t
 # Making log a symbolic link to /var/log
 touch /var/log/$app/production.log
 chown $app -R /var/log/$app
-ln -s /var/log/$app/production.log "$final_path/log/production.log"
+ln -s /var/log/$app/production.log "$install_dir/log/production.log"
 
 #=================================================
 # SETUP SYSTEMD
@@ -182,7 +122,7 @@ ynh_use_logrotate
 #=================================================
 ynh_script_progression --message="Integrating service in YunoHost..."
 
-yunohost service add $app --log="$final_path/log/production.log"
+yunohost service add $app --log="$install_dir/log/production.log"
 
 #=================================================
 # START SYSTEMD SERVICE
@@ -194,61 +134,11 @@ ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="
 ynh_systemd_action --action=stop
 
 # Set right permissions on new files created at first start
-chown -R $app:$app $final_path
+chown -R $app:$app $install_dir
 
 # Wait for lutim to be fully started
 ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
 
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..."
-
-ynh_permission_update --permission="main" --add="visitors"
-
-# This is a fake permission without any URL.
-# The purpose of this permission is only to trigger hooks post_app_add/removeaccess when it's modified.
-# We can't use a real permission for now because the actual permision system doesn't support regex.
-ynh_permission_create --permission="upload images" --allowed="visitors"
-
-if [ $is_public -eq 0 ]
-then
-	# If the app is private, viewing images stays publicly accessible.
-	if [ "$path_url" == "/" ]; then
-		# If the path is /, clear it to prevent any error with the regex.
-		path_url=""
-	fi
-	# Modify the domain to be used in a regex
-	domain_regex=$(echo "$domain" | sed 's@-@.@g')
-	ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
-
-	# If the app is not public, then the "visitors" group doesn't have this permission
-	ynh_permission_update --permission="upload images" --remove="visitors"
-fi
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=2
-
-ynh_systemd_action --service_name=nginx --action=reload
-
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the URL of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-echo "You can find a config file at $final_path/lutim.conf
-
-You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
-
 #=================================================
 # END OF SCRIPT
 #=================================================
diff --git a/scripts/remove b/scripts/remove
index 9deea7b..4b643b6 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,16 +9,6 @@
 source _common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=2
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
 #=================================================
 # STANDARD REMOVE
 #=================================================
@@ -48,14 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..."
 # Remove the app-specific logrotate config
 ynh_remove_logrotate
 
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Removing app main directory..." --weight=2
-
-# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
-
 #=================================================
 # REMOVE NGINX CONFIGURATION
 #=================================================
@@ -64,14 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
 # Remove the dedicated NGINX config
 ynh_remove_nginx_config
 
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=20
-
-# Remove metapackage and its dependencies
-ynh_remove_app_dependencies
-
 #=================================================
 # SPECIFIC REMOVE
 #=================================================
@@ -82,16 +56,6 @@ ynh_script_progression --message="Removing various files..."
 # Remove a cron file
 ynh_secure_remove --file="/etc/cron.d/$app"
 
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Removing the dedicated system user..." --weight=5
-
-# Delete a system user
-ynh_system_user_delete --username=$app
-
 #=================================================
 # END OF SCRIPT
 #=================================================
diff --git a/scripts/restore b/scripts/restore
index 5714c5b..9a38857 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -10,72 +10,21 @@
 source ../settings/scripts/_common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
-	ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=2
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# CHECK IF THE APP CAN BE RESTORED
-#=================================================
-ynh_script_progression --message="Validating restoration parameters..."
-
-test ! -d $final_path \
-	|| ynh_die --message="There is already a directory: $final_path "
-
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Activating maintenance mode..." --weight=2
 
 ynh_maintenance_mode_ON
 
-#=================================================
-# STANDARD RESTORATION STEPS
-#=================================================
-# RECREATE THE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
-
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
 #=================================================
 # RESTORE THE APP MAIN DIR
 #=================================================
 ynh_script_progression --message="Restoring the app main directory..."
 
-ynh_restore_file --origin_path="$final_path"
+ynh_restore_file --origin_path="$install_dir"
 
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:$app "$final_path"
-
-#=================================================
-# SPECIFIC RESTORATION
-#=================================================
-# REINSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Reinstalling dependencies..." --weight=60
-
-# Define and install dependencies
-ynh_install_app_dependencies $pkg_dependencies
+chmod -R o-rwx "$install_dir"
+chown -R $app:$app "$install_dir"
 
 #=================================================
 # RESTORE THE NGINX CONFIGURATION
@@ -116,7 +65,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
 #=================================================
 ynh_script_progression --message="Integrating service in YunoHost..."
 
-yunohost service add $app --log="$final_path/log/production.log"
+yunohost service add $app --log="$install_dir/log/production.log"
 
 #=================================================
 # START SYSTEMD SERVICE
@@ -137,26 +86,9 @@ ynh_systemd_action --service_name=nginx --action=reload
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disabling maintenance mode..." --weight=7
 
 ynh_maintenance_mode_OFF
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the url of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-echo "You can find a config file at $final_path/lutim.conf
-
-You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
-
 #=================================================
 # END OF SCRIPT
 #=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index d7d7fa7..3df00d9 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,52 +9,12 @@
 source _common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=4
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-is_public=$(ynh_app_setting_get --app=$app --key=is_public)
-port=$(ynh_app_setting_get --app=$app --key=port)
-always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-secret=$(ynh_app_setting_get --app=$app --key=secret)
-
-overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
-overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
-overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
-admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
-
-# Optional parameters from config-panel feature
-antiflood=$(ynh_app_setting_get --app=$app --key=antiflood)
-delay=$(ynh_app_setting_get --app=$app --key=delay)
-
 #=================================================
 # CHECK VERSION
 #=================================================
-ynh_script_progression --message="Checking version..."
 
 upgrade_type=$(ynh_check_app_version_changed)
 
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
-	ynh_clean_check_starting
-	# Restore it if the upgrade fails
-	ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
@@ -76,94 +36,39 @@ ynh_systemd_action --service_name=$app --action="stop"
 #=================================================
 ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
 
-skipped_uris=$(ynh_app_setting_get --app=$app --key=skipped_uris)
-
-# Unused with the permission system
-if [ ! -z "$skipped_uris" ]; then
-	ynh_app_setting_delete --app=$app --key=skipped_uris
-fi
-
-# Create the permission "upload images" only if it doesn't exist.
-if ! ynh_permission_exists --permission="upload images"
-then
-	# This is a fake permission without any URL.
-	# The purpose of this permission is only to trigger hooks post_app_add/removeaccess when it's modified.
-	# We can't use a real permission for now because the actual permision system doesn't support regex.
-	ynh_permission_create --permission="upload images" --allowed="visitors"
-
-	if [ $is_public -eq 0 ]
-	then
-		# If the app is private, viewing images stays publicly accessible.
-		if [ "$path_url" == "/" ]; then
-			# If the path is /, clear it to prevent any error with the regex.
-			path_url=""
-		fi
-		# Modify the domain to be used in a regex
-		domain_regex=$(echo "$domain" | sed 's@-@.@g')
-		ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
-
-		# If the app is not public, then the "visitors" group doesn't have this permission
-		ynh_permission_update --permission="upload images" --remove="visitors"
-	fi
-fi
-
-# if final_path isn't set, which can happens with old scripts, set final_path.
-if [ -z "$final_path" ]; then
-	final_path=/var/www/$app
-	ynh_app_setting_set --app=$app --key=final_path --value=$final_path
-fi
-
 # Fix always_encrypt as a boolean
-if [ "$always_encrypt" = "Yes" ]; then
+if [ "${always_encrypt:-}" = "Yes" ]; then
 	ynh_app_setting_set --app=$app --key=always_encrypt --value=1
 	always_encrypt=1
-elif [ "$always_encrypt" = "No" ]; then
+elif [ "${always_encrypt:-}" = "No" ]; then
 	ynh_app_setting_set --app=$app --key=always_encrypt --value=0
 	always_encrypt=0
 fi
 
 # If overwrite_settings doesn't exist, create it
-if [ -z "$overwrite_settings" ]; then
+if [ -z "${overwrite_settings:-}" ]; then
 	overwrite_settings=1
 	ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
 fi
 
 # If overwrite_nginx doesn't exist, create it
-if [ -z "$overwrite_nginx" ]; then
+if [ -z "${overwrite_nginx:-}" ]; then
 	overwrite_nginx=1
 	ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
 fi
 
 # If overwrite_systemd doesn't exist, create it
-if [ -z "$overwrite_systemd" ]; then
+if [ -z "${overwrite_systemd:-}" ]; then
 	overwrite_systemd=1
 	ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
 fi
 
 # If secret doesn't exist, create it
-if [ -z "$secret" ]; then
-	secret=$(grep "secrets *=>" "$final_path/lutim.conf" | cut -d\' -f2)
+if [ -z "${secret:-}" ]; then
+	secret=$(grep "secrets *=>" "$install_dir/lutim.conf" | cut -d\' -f2)
 	ynh_app_setting_set --app=$app --key=secret --value=$secret
 fi
 
-# Close opened port
-if yunohost firewall list | grep -q "\- $port$"
-then
-	ynh_exec_quiet yunohost firewall disallow TCP $port
-fi
-
-# Replace skipped_uris by unprotected_uris for the migration to the new permission system.
-ynh_app_setting_delete --app=$app --key=skipped_uris
-ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..."
-
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
 #=================================================
 # DOWNLOAD, CHECK AND UNPACK SOURCE
 #=================================================
@@ -173,19 +78,11 @@ then
 	ynh_script_progression --message="Upgrading source files..."
 
 	# Download, check integrity, uncompress and patch the source from app.src
-	ynh_setup_source --dest_dir="$final_path"
+	ynh_setup_source --dest_dir="$install_dir"
 fi
 
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
-
-#=================================================
-# UPGRADE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Upgrading dependencies..." --weight=9
-
-ynh_install_app_dependencies $pkg_dependencies
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
 
 #=================================================
 # NGINX CONFIGURATION
@@ -209,21 +106,21 @@ ynh_script_progression --message="Reconfiguring $app..."
 if [ $overwrite_settings -eq 1 ]
 then
 	workers="$(( $(nproc) * 2 ))"
-	ynh_add_config --template="../conf/lutim.conf.template" --destination="$final_path/lutim.conf"
+	ynh_add_config --template="../conf/lutim.conf.template" --destination="$install_dir/lutim.conf"
 
-	chmod 400 "$final_path/lutim.conf"
-	chown $app:$app "$final_path/lutim.conf"
+	chmod 400 "$install_dir/lutim.conf"
+	chown $app:$app "$install_dir/lutim.conf"
 
 	# Optional parameters from config-panel feature
 	if [ -n "$antiflood" ]; then
-		ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string="	anti_flood_delay  => $antiflood," --target_file="$final_path/lutim.conf"
+		ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string="	anti_flood_delay  => $antiflood," --target_file="$install_dir/lutim.conf"
 		# Disable anti_flood_delay if the delay is 0
 		if [ $antiflood = 0 ]; then
-			ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$final_path/lutim.conf"
+			ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$install_dir/lutim.conf"
 		fi
 	fi
 	if [ -n "$delay" ]; then
-		ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string="	default_delay	 => $delay," --target_file="$final_path/lutim.conf"
+		ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string="	default_delay	 => $delay," --target_file="$install_dir/lutim.conf"
 	fi
 fi
 
@@ -247,8 +144,8 @@ ynh_add_config --template="../conf/cron_lutim" --destination="/etc/cron.d/$app"
 if [ "$upgrade_type" == "UPGRADE_APP" ]
 then
 	ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
-	pushd "$final_path"
-		ynh_secure_remove --file="$final_path/local"
+	pushd "$install_dir"
+#REMOVEME? 		ynh_secure_remove --file="$install_dir/local"
 		carton install --without=mysql --without=htpasswd --without=test
 	popd
 fi
@@ -280,7 +177,7 @@ chown $app -R /var/log/$app
 #=================================================
 ynh_script_progression --message="Integrating service in YunoHost..."
 
-yunohost service add $app --log="$final_path/log/production.log"
+yunohost service add $app --log="$install_dir/log/production.log"
 
 #=================================================
 # START SYSTEMD SERVICE
@@ -289,44 +186,12 @@ ynh_script_progression --message="Starting a systemd service..." --weight=4
 
 ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
 
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
-
-ynh_systemd_action --service_name=nginx --action=reload
-
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disabling maintenance mode..." --weight=7
 
 ynh_maintenance_mode_OFF
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the url of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-# Build the changelog
-ynh_app_changelog || true
-
-echo "You can find a config file at $final_path/lutim.conf
-
-You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__.
-
----
-
-Changelog since your last upgrade:
-$(cat changelog)" > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
-
 #=================================================
 # END OF SCRIPT
 #=================================================
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..8c101f2
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,15 @@
+test_format = 1.0
+
+[default]
+
+    # -------------------------------
+    # Default args to use for install
+    # -------------------------------
+
+        args.always_encrypt=1
+
+    # -------------------------------
+    # Commits to test upgrade from
+    # -------------------------------
+
+    test_upgrade_from.ec8858ed0d054049a0c8f46c6126ee8ae0798e8f.name = "Upgrade from 22 May 2020"

From d2fe384b0e3ef352e8641b4660efbbc874e3d1a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
 <46165813+ericgaspar@users.noreply.github.com>
Date: Sun, 16 Apr 2023 17:18:31 +0200
Subject: [PATCH 03/13] fix

---
 doc/ADMIN.md    | 5 +----
 doc/ADMIN_fr.md | 3 +--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/doc/ADMIN.md b/doc/ADMIN.md
index cc120df..7fd9510 100644
--- a/doc/ADMIN.md
+++ b/doc/ADMIN.md
@@ -1,4 +1 @@
-## Configuration
-
-Edit the file `__INSTALL_DIR__/lutim.conf` to configure Lutim.
-Then reload the lutim service.
+You can edit `__INSTALL_DIR__/lutim.conf` to configure Lutim, then reload the `lutim` service.
\ No newline at end of file
diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md
index 3db28b2..134878b 100644
--- a/doc/ADMIN_fr.md
+++ b/doc/ADMIN_fr.md
@@ -1,2 +1 @@
-Éditez le fichier `__INSTALL_DIR__/lutim.conf` pour configurer Lutim.
-Rechargez ensuite le service Lutim.
+Vous pouvez modifier `__INSTALL_DIR__/lutim.conf` pour configurer Lutim, puis rechargez le service `lutim`.
\ No newline at end of file

From 4dd19ae0ca4fa6c9b5d500ed07c2a70173089eb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
 <46165813+ericgaspar@users.noreply.github.com>
Date: Sun, 16 Apr 2023 17:19:19 +0200
Subject: [PATCH 04/13] Update upgrade

---
 scripts/upgrade | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/upgrade b/scripts/upgrade
index 3df00d9..d7725cf 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -145,7 +145,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
 then
 	ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
 	pushd "$install_dir"
-#REMOVEME? 		ynh_secure_remove --file="$install_dir/local"
+		ynh_secure_remove --file="$install_dir/local"
 		carton install --without=mysql --without=htpasswd --without=test
 	popd
 fi

From 61864e0ac99de7ef519930271a2d7281fcaa74db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
 <46165813+ericgaspar@users.noreply.github.com>
Date: Sun, 16 Apr 2023 18:31:54 +0200
Subject: [PATCH 05/13] Update upgrade

---
 scripts/upgrade | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/upgrade b/scripts/upgrade
index d7725cf..531606f 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -112,14 +112,14 @@ then
 	chown $app:$app "$install_dir/lutim.conf"
 
 	# Optional parameters from config-panel feature
-	if [ -n "$antiflood" ]; then
+	if [ -n "${antiflood:-}" ]; then
 		ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string="	anti_flood_delay  => $antiflood," --target_file="$install_dir/lutim.conf"
 		# Disable anti_flood_delay if the delay is 0
 		if [ $antiflood = 0 ]; then
 			ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$install_dir/lutim.conf"
 		fi
 	fi
-	if [ -n "$delay" ]; then
+	if [ -n "${delay:-}" ]; then
 		ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string="	default_delay	 => $delay," --target_file="$install_dir/lutim.conf"
 	fi
 fi

From 3fb44fc967b26adb7c6362809e8340e9321a6eb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
 <46165813+ericgaspar@users.noreply.github.com>
Date: Sun, 16 Apr 2023 20:29:28 +0200
Subject: [PATCH 06/13] Update manifest.toml

---
 manifest.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/manifest.toml b/manifest.toml
index e49feec..60b0f74 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -5,7 +5,7 @@ name = "Lutim"
 description.en = "Anonymous image hosting service"
 description.fr = "Service d'hébergement anonyme d'images"
 
-version = "0.12.1~ynh4"
+version = "0.12.1~ynh5"
 
 maintainers = []
 

From 164bee6f683909def12b0fd33fbad51fccb26751 Mon Sep 17 00:00:00 2001
From: yunohost-bot 
Date: Sun, 16 Apr 2023 18:29:37 +0000
Subject: [PATCH 07/13] Auto-update README

---
 README.md    | 2 +-
 README_fr.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index b7ba3d5..537f7b7 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
 Lutim stores images and allows you to see them, download them or share them on social networks.
 Images are indefinitely stored unless you request that they will be deleted at first view or after 24 hours / one week / one month / one year.
 
-**Shipped version:** 0.12.1~ynh4
+**Shipped version:** 0.12.1~ynh5
 
 **Demo:** https://lut.im/
 ## Documentation and resources
diff --git a/README_fr.md b/README_fr.md
index b93dfde..38dc4a0 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
 Lutim stocke les images et vous permet de les voir, de les télécharger ou de les partager sur les réseaux sociaux.
 Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles soient effacées à la première vue ou après 24 heures / une semaine / un mois / un an.
 
-**Version incluse :** 0.12.1~ynh4
+**Version incluse :** 0.12.1~ynh5
 
 **Démo :** https://lut.im/
 ## Documentations et ressources

From 5836b133ca5c8b953c24a4c467f3d2b8529cdf1d Mon Sep 17 00:00:00 2001
From: OniriCorpe 
Date: Mon, 19 Feb 2024 21:54:59 +0100
Subject: [PATCH 08/13] Update manifest.toml

---
 manifest.toml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/manifest.toml b/manifest.toml
index 60b0f74..b8735de 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -50,6 +50,7 @@ ram.runtime = "50M"
         [resources.sources.main]
         url = "https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.1/lutim-0.12.1.tar.gz"
         sha256 = "141f142d47e3a8367e0c292304ddbecfc34b49ae7e561e2c3526000040318973"
+        autoupdate.strategy = "latest_gitlab_release"
 
     [resources.ports]
 

From e93a080b733d7591cafa41fcd487fe20ea76b777 Mon Sep 17 00:00:00 2001
From: yunohost-bot 
Date: Mon, 19 Feb 2024 20:55:07 +0000
Subject: [PATCH 09/13] Auto-update README

---
 README.md    | 6 +++---
 README_fr.md | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 537f7b7..35d9729 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 
 
@@ -27,7 +27,7 @@ Images are indefinitely stored unless you request that they will be deleted at f
 * Official app website: 
 * Official user documentation: 
 * Upstream app code repository: 
-* YunoHost documentation for this app: 
+* YunoHost Store: 
 * Report a bug: 
 
 ## Developer info
@@ -42,4 +42,4 @@ or
 sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
 ```
 
-**More info regarding app packaging:** 
+**More info regarding app packaging:** 
\ No newline at end of file
diff --git a/README_fr.md b/README_fr.md
index 38dc4a0..6499715 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -1,5 +1,5 @@
 
 
@@ -27,7 +27,7 @@ Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles
 * Site officiel de l’app : 
 * Documentation officielle utilisateur : 
 * Dépôt de code officiel de l’app : 
-* Documentation YunoHost pour cette app : 
+* YunoHost Store: 
 * Signaler un bug : 
 
 ## Informations pour les développeurs

From f22071d26b1bb7f3f2cb1d118ed826ed9c55024f Mon Sep 17 00:00:00 2001
From: OniriCorpe 
Date: Mon, 19 Feb 2024 22:59:48 +0100
Subject: [PATCH 10/13] Add trailing slash to the proxy_pass

---
 conf/nginx.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf/nginx.conf b/conf/nginx.conf
index f3f454a..1273cb8 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -8,7 +8,7 @@ location __PATH__/ {
   # This is important! Make it OK with your Lutim configuration
   client_max_body_size 40M;
 
-  proxy_pass http://127.0.0.1:__PORT__;
+  proxy_pass http://127.0.0.1:__PORT__/;
 
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;

From 2f638b307a4b197a6e526cb5a23d68efb2981705 Mon Sep 17 00:00:00 2001
From: OniriCorpe 
Date: Tue, 20 Feb 2024 06:44:03 +0100
Subject: [PATCH 11/13] Revert trailing slash

---
 conf/nginx.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf/nginx.conf b/conf/nginx.conf
index 1273cb8..f3f454a 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -8,7 +8,7 @@ location __PATH__/ {
   # This is important! Make it OK with your Lutim configuration
   client_max_body_size 40M;
 
-  proxy_pass http://127.0.0.1:__PORT__/;
+  proxy_pass http://127.0.0.1:__PORT__;
 
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;

From 31bf003d40a12fbcc3866e7dbc0af3722a56899a Mon Sep 17 00:00:00 2001
From: yunohost-bot 
Date: Mon, 22 Apr 2024 16:11:07 +0000
Subject: [PATCH 12/13] Auto-update READMEs

---
 ALL_README.md     |  3 ++-
 README.md         |  4 ++--
 README_eu.md      | 45 +++++++++++++++++++++++++++++++++++++++++++++
 README_zh_Hans.md | 45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+), 3 deletions(-)
 create mode 100644 README_eu.md
 create mode 100644 README_zh_Hans.md

diff --git a/ALL_README.md b/ALL_README.md
index 3d6c579..a01b345 100644
--- a/ALL_README.md
+++ b/ALL_README.md
@@ -1,6 +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)
-- [Leggi il “README” in italiano](README_it.md)
+- [阅读中文(简体)的 README](README_zh_Hans.md)
diff --git a/README.md b/README.md
index fc6eaea..2f7a13e 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ It shall NOT be edited by hand.
 
 [![Install Lutim with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim)
 
-*[Read this README is other languages.](./ALL_README.md)*
+*[Read this README in other languages.](./ALL_README.md)*
 
 > *This package allows you to install Lutim 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.*
@@ -42,4 +42,4 @@ or
 sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
 ```
 
-**More info regarding app packaging:** 
\ No newline at end of file
+**More info regarding app packaging:** 
diff --git a/README_eu.md b/README_eu.md
new file mode 100644
index 0000000..9e4c9ca
--- /dev/null
+++ b/README_eu.md
@@ -0,0 +1,45 @@
+
+
+# Lutim YunoHost-erako
+
+[![Integrazio maila](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg)
+
+[![Instalatu Lutim YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim)
+
+*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
+
+> *Pakete honek Lutim YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*  
+> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
+
+## Aurreikuspena
+
+Lutim stores images and allows you to see them, download them or share them on social networks.
+Images are indefinitely stored unless you request that they will be deleted at first view or after 24 hours / one week / one month / one year.
+
+**Paketatutako bertsioa:** 0.12.1~ynh5
+
+**Demoa:** 
+## Dokumentazioa eta baliabideak
+
+- Aplikazioaren webgune ofiziala: 
+- Erabiltzaileen 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/lutim_ynh/tree/testing).
+
+`testing` abarra probatzeko, ondorengoa egin:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
+edo
+sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
+```
+
+**Informazio gehiago aplikazioaren paketatzeari buruz:** 
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
new file mode 100644
index 0000000..919e2a0
--- /dev/null
+++ b/README_zh_Hans.md
@@ -0,0 +1,45 @@
+
+
+# YunoHost 的 Lutim
+
+[![集成程度](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![工作状态](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg)
+
+[![使用 YunoHost 安装 Lutim](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim)
+
+*[阅读此 README 的其它语言版本。](./ALL_README.md)*
+
+> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Lutim。*  
+> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。*
+
+## 概况
+
+Lutim stores images and allows you to see them, download them or share them on social networks.
+Images are indefinitely stored unless you request that they will be deleted at first view or after 24 hours / one week / one month / one year.
+
+**分发版本:** 0.12.1~ynh5
+
+**演示:** 
+## 文档与资源
+
+- 官方应用网站: 
+- 官方用户文档: 
+- 上游应用代码库: 
+- YunoHost 商店: 
+- 报告 bug: 
+
+## 开发者信息
+
+请向 [`testing` 分支](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing) 发送拉取请求。
+
+如要尝试 `testing` 分支,请这样操作:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
+或
+sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
+```
+
+**有关应用打包的更多信息:** 

From 3abcce2fadb5a874cfb0fa3218aff049f53377db Mon Sep 17 00:00:00 2001
From: Alexandre Aubin 
Date: Mon, 22 Apr 2024 18:14:33 +0200
Subject: [PATCH 13/13] Remove dummy files or super legacy/unused/misleading
 stuff...

---
 actions.toml                         |  52 ---------
 check_process                        |  26 -----
 config_panel.toml.example            |  55 ----------
 hooks/post_app_addaccess             |  26 -----
 hooks/post_app_removeaccess          |  34 ------
 scripts/_common.sh                   |  72 ------------
 scripts/actions/check_quota          |  48 --------
 scripts/actions/clean_images         |  48 --------
 scripts/actions/clean_ip             |  48 --------
 scripts/actions/reset_default_app    | 158 ---------------------------
 scripts/actions/reset_default_config |  84 --------------
 scripts/actions/reset_default_system |  67 ------------
 12 files changed, 718 deletions(-)
 delete mode 100644 actions.toml
 delete mode 100644 check_process
 delete mode 100644 config_panel.toml.example
 delete mode 100644 hooks/post_app_addaccess
 delete mode 100644 hooks/post_app_removeaccess
 delete mode 100755 scripts/actions/check_quota
 delete mode 100755 scripts/actions/clean_images
 delete mode 100755 scripts/actions/clean_ip
 delete mode 100755 scripts/actions/reset_default_app
 delete mode 100755 scripts/actions/reset_default_config
 delete mode 100755 scripts/actions/reset_default_system

diff --git a/actions.toml b/actions.toml
deleted file mode 100644
index 48f0d88..0000000
--- a/actions.toml
+++ /dev/null
@@ -1,52 +0,0 @@
-[clean_ip]
-name = "Clean old ip from database"
-command = "/bin/bash scripts/actions/clean_ip"
-accepted_return_codes = [0]
-description = "Remove obsolete IP from the database."
-
-[clean_images]
-name = "Clean old images"
-command = "/bin/bash scripts/actions/clean_images"
-accepted_return_codes = [0]
-description = "Remove expired images."
-
-[check_quota]
-name = "Check disk quota"
-command = "/bin/bash scripts/actions/check_quota"
-accepted_return_codes = [0]
-description = "Check the disk quota for images stored by Lutim."
-
-[reset_default_config]
-name = "Reset the config file and restore a default one."
-command = "/bin/bash scripts/actions/reset_default_config \"lutim.conf\""
-accepted_return_codes = [0]
-description = "Reset the config file lutim.conf."
-
-
-[reset_default_nginx]
-name = "Reset the nginx config for this app."
-command = "/bin/bash scripts/actions/reset_default_system nginx"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the nginx config for this app."
-
-[reset_default_systemd]
-name = "Reset the systemd config for this app."
-command = "/bin/bash scripts/actions/reset_default_system systemd"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the systemd config for this app."
-
-
-[reset_default_app]
-name = "Reset the app with a default configuration."
-command = "/bin/bash scripts/actions/reset_default_app"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the app to its default configuration to try to fix potential issues.
This action won't remove any data added to the app.
However, if you have modified any configuration, it will be overwritten." diff --git a/check_process b/check_process deleted file mode 100644 index 56ff100..0000000 --- a/check_process +++ /dev/null @@ -1,26 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - always_encrypt=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f - name=22 May 2020 ec8858ed0d054049a0c8f46c6126ee8ae0798e8f - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&always_encrypt=1& diff --git a/config_panel.toml.example b/config_panel.toml.example deleted file mode 100644 index b24d3b3..0000000 --- a/config_panel.toml.example +++ /dev/null @@ -1,55 +0,0 @@ -version = "0.1" -name = "Lutim configuration panel" - -[main] -name = "Lutim configuration" - - [main.configuration] - name = "Lutim configuration" - - [main.configuration.always_encrypt] - ask = "Force the encryption of images?" - type = "boolean" - default = true - - [main.configuration.antiflood] - ask = "Anti-flood protection delay (seconds)" - type = "number" - default = 0 - help = "Users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds." - - [main.configuration.delay] - ask = "Default time limit for files" - choices = ["None", "Day", "Week", "Month", "Year"] - default = "Year" - help = "Users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds." - - [main.overwrite_files] - name = "Overwriting config files" - - [main.overwrite_files.overwrite_settings] - ask = "Overwrite the config file lutim.conf?" - type = "boolean" - default = true - help = "If the file is overwritten, a backup will be created." - - [main.overwrite_files.overwrite_nginx] - ask = "Overwrite the nginx config file?" - type = "boolean" - default = true - help = "If the file is overwritten, a backup will be created." - - [main.overwrite_files.overwrite_systemd] - ask = "Overwrite the systemd config file?" - type = "boolean" - default = true - help = "If the file is overwritten, a backup will be created." - - [main.global_config] - name = "Global configuration" - - [main.global_config.email_type] - ask = "Send HTML email to admin?" - type = "boolean" - default = true - help = "Allow app scripts to send HTML mails instead of plain text." diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess deleted file mode 100644 index 2218b35..0000000 --- a/hooks/post_app_addaccess +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Source app helpers -source /usr/share/yunohost/helpers - -app=$1 -added_users=$2 -permission=$3 -added_groups=$4 - -if [ "$app" == __APP__ ]; then - if [ "$permission" = "upload images" ]; then # The fake permission "upload images" is modifed. - if [ "$added_groups" = "visitors" ]; then # As is it a fake permission we can only grant/remove the "visitors" group. - - # We remove the regex, no more protection is needed. - ynh_app_setting_delete --app=$app --key=protected_regex - - # Sync the is_public variable according to the permission - ynh_app_setting_set --app=$app --key=is_public --value=1 - - yunohost app ssowatconf - else - ynh_print_warn --message="This app doesn't support this authorisation, you can only add or remove visitors group." - fi - fi -fi \ No newline at end of file diff --git a/hooks/post_app_removeaccess b/hooks/post_app_removeaccess deleted file mode 100644 index d0ca2f7..0000000 --- a/hooks/post_app_removeaccess +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Source app helpers -source /usr/share/yunohost/helpers - -app=$1 -removed_users=$2 -permission=$3 -removed_groups=$4 - -if [ "$app" == __APP__ ]; then - if [ "$permission" = "upload images" ]; then # The fake permission "upload images" is modifed. - if [ "$removed_groups" = "visitors" ]; then # As is it a fake permission we can only grant/remove the "visitors" group. - domain=$(ynh_app_setting_get --app=$app --key=domain) - path_url=$(ynh_app_setting_get --app=$app --key=path) - - # If the app is private, viewing images stays publicly accessible. - if [ "$path_url" == "/" ]; then - # If the path is /, clear it to prevent any error with the regex. - path_url="" - fi - # Modify the domain to be used in a regex - domain_regex=$(echo "$domain" | sed 's@-@.@g') - ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$" - - # Sync the is_public variable according to the permission - ynh_app_setting_set --app=$app --key=is_public --value=0 - - yunohost app ssowatconf - else - ynh_print_warn --message="This app doesn't support this authorisation, you can only add or remove visitors group." - fi - fi -fi \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index 62a03b2..7ee4e10 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -92,75 +92,3 @@ ynh_maintenance_mode_OFF () { } -#================================================= - -# Check the amount of available RAM -# -# usage: ynh_check_ram [--required=RAM required in Mb] [--no_swap|--only_swap] [--free_ram] -# | arg: -r, --required= - Amount of RAM required in Mb. The helper will return 0 is there's enough RAM, or 1 otherwise. -# If --required isn't set, the helper will print the amount of RAM, in Mb. -# | arg: -s, --no_swap - Ignore swap -# | arg: -o, --only_swap - Ignore real RAM, consider only swap. -# | arg: -f, --free_ram - Count only free RAM, not the total amount of RAM available. -ynh_check_ram () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [r]=required= [s]=no_swap [o]=only_swap [f]=free_ram ) - local required - local no_swap - local only_swap - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - required=${required:-} - no_swap=${no_swap:-0} - only_swap=${only_swap:-0} - - local total_ram=$(vmstat --stats --unit M | grep "total memory" | awk '{print $1}') - local total_swap=$(vmstat --stats --unit M | grep "total swap" | awk '{print $1}') - local total_ram_swap=$(( total_ram + total_swap )) - - local free_ram=$(vmstat --stats --unit M | grep "free memory" | awk '{print $1}') - local free_swap=$(vmstat --stats --unit M | grep "free swap" | awk '{print $1}') - local free_ram_swap=$(( free_ram + free_swap )) - - # Use the total amount of ram - local ram=$total_ram_swap - if [ $free_ram -eq 1 ] - then - # Use the total amount of free ram - ram=$free_ram_swap - if [ $no_swap -eq 1 ] - then - # Use only the amount of free ram - ram=$free_ram - elif [ $only_swap -eq 1 ] - then - # Use only the amount of free swap - ram=$free_swap - fi - else - if [ $no_swap -eq 1 ] - then - # Use only the amount of free ram - ram=$total_ram - elif [ $only_swap -eq 1 ] - then - # Use only the amount of free swap - ram=$total_swap - fi - fi - - if [ -n "$required" ] - then - # Return 1 if the amount of ram isn't enough. - if [ $ram -lt $required ] - then - return 1 - else - return 0 - fi - - # If no RAM is required, return the amount of available ram. - else - echo $ram - fi -} diff --git a/scripts/actions/check_quota b/scripts/actions/check_quota deleted file mode 100755 index 8113a22..0000000 --- a/scripts/actions/check_quota +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -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 -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -#================================================= -# SPECIFIC ACTION -#================================================= -# CHECK THE DISK QUOTA FOR IMAGES STORED BY LUTIM -#================================================= -ynh_script_progression --message="Checking the disk quota for images stored by lutim..." --weight=9 - -(cd "$final_path" && ynh_exec_as $app $(which carton) exec script/lutim cron watch) - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/clean_images b/scripts/actions/clean_images deleted file mode 100755 index 4ac8407..0000000 --- a/scripts/actions/clean_images +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -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 -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE EXPIRED IMAGES -#================================================= -ynh_script_progression --message="Removing expired images..." --weight=9 - -(cd "$final_path" && ynh_exec_as $app $(which carton) exec script/lutim cron cleanfiles) - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/clean_ip b/scripts/actions/clean_ip deleted file mode 100755 index 03d9ad1..0000000 --- a/scripts/actions/clean_ip +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -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 -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE OBSOLETE IP FROM THE DATABASE -#================================================= -ynh_script_progression --message="Removing obsolete ip from the database..." --weight=9 - -(cd "$final_path" && ynh_exec_as $app $(which carton) exec script/lutim cron cleanbdd) - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/reset_default_app b/scripts/actions/reset_default_app deleted file mode 100755 index f2cc664..0000000 --- a/scripts/actions/reset_default_app +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -# Load common variables for all scripts. -source scripts/_variables - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { -# Clean installation remaining that are not handle by the remove script. - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) -port=$(ynh_app_setting_get --app=$app --key=port) -always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -secret=$(ynh_app_setting_get --app=$app --key=secret) - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - -ynh_app_setting_set --app=$app --key=overwrite_settings --value=1 -ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 -ynh_app_setting_set --app=$app --key=overwrite_systemd --value=1 -ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 - -#================================================= -# SPECIFIC ACTION -#================================================= -# ACTIVATE MAINTENANCE MODE -#================================================= -ynh_script_progression --message="Activating maintenance mode..." - -ynh_maintenance_mode_ON - -#================================================= -# STOP LUTIM -#================================================= - -ynh_systemd_action --action=stop - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -ynh_script_progression --message="Resetting source files..." --weight=2 - -# Download, check integrity, uncompress and patch the source from app.src -(cd scripts; YNH_CWD=$PWD ynh_setup_source --dest_dir="$final_path") - -#================================================= -# NGINX CONFIGURATION -#================================================= - -ynh_script_progression --message="Resetting nginx web server configuration..." --weight=4 - -# Create a dedicated nginx config -yunohost app action run $app reset_default_nginx - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RECONFIGURE APP -#================================================= - -ynh_script_progression --message="Reconfiguring Lutim..." --weight=2 - -# Configure Lutim -# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -ynh_backup_if_checksum_is_different --file="$final_path/lutim.conf" -(cd scripts; cp ../conf/lutim.conf.template "$final_path/lutim.conf") -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/lutim.conf" -ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf" -ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf" -ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf" -# Set the number of process for Lutim to twice the number of CPU core. -ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/lutim.conf" - -#================================================= -# SETUP CRON -#================================================= - -(cd scripts; cp ../conf/cron_lutim /etc/cron.d/$app) -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file=/etc/cron.d/$app -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/etc/cron.d/$app - -#================================================= -# SECURING FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R $app: $final_path - -#================================================= -# SETUP SYSTEMD -#================================================= - -ynh_script_progression --message="Resetting systemd configuration..." -yunohost app action run $app reset_default_systemd - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Resetting logrotate configuration..." - -ynh_use_logrotate --non-append -chown $app -R /var/log/$app - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading nginx web server..." - -ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# DEACTIVE MAINTENANCE MODE -#================================================= -ynh_script_progression --message="Disabling maintenance mode..." - -ynh_maintenance_mode_OFF - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config deleted file mode 100755 index f7239cf..0000000 --- a/scripts/actions/reset_default_config +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { -# Clean installation remaining that are not handle by the remove script. - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) -always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt) -secret=$(ynh_app_setting_get --app=$app --key=secret) - -#================================================= -# SORT OUT THE CONFIG FILE TO HANDLE -#================================================= - -file="$1" - -if [ "$file" = "lutim.conf" ]; then - config_file="$final_path/lutim.conf" -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# RESET THE CONFIG FILE -#================================================= -ynh_script_progression --message="Resetting the config file $config_file..." --weight=9 - -# Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different --file="$config_file" - -if [ "$file" = "lutim.conf" ] -then - # Get the default file and overwrite the current config - cp /etc/yunohost/apps/$app/conf/lutim.conf.template "$config_file" - - # Recreate the default config - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config_file" - ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config_file" - ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" - ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$config_file" - ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config_file" - # Set the number of process for Lutim to twice the number of CPU core. - ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" -fi - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$config_file" - -ynh_script_progression --message="Restarting Lutim..." --weight=5 - -# Wait for lutim to be fully started -ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last - diff --git a/scripts/actions/reset_default_system b/scripts/actions/reset_default_system deleted file mode 100755 index 25fd088..0000000 --- a/scripts/actions/reset_default_system +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { -# Clean installation remaining that are not handle by the remove script. - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -type=$1 - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# SPECIFIC ACTION -#================================================= -# RESET THE CONFIG FILE -#================================================= - -if [ $type == nginx ]; then - name=Nginx -elif [ $type == systemd ]; then - name=systemd -else - ynh_die --message="The type $type is not recognized" -fi - -ynh_script_progression --message="Resetting the specific configuration of $name for the app $app..." --weight=3 - -if [ $type == nginx ] -then - (cd scripts; ynh_add_nginx_config) - -elif [ $type == systemd ] -then - ynh_systemd_action --action=stop - (cd scripts; ynh_add_systemd_config) - ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="300" -fi - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last