From 2a24244fc39c2bc107ba500861700131cb62622c Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 2 Jun 2023 17:57:21 -0400 Subject: [PATCH 1/6] Update to version from 2023-05-30 --- README.md | 2 +- README_fr.md | 2 +- conf/amd64.src | 6 +++--- conf/app.src | 6 +++--- conf/arm64.src | 6 +++--- conf/armhf.src | 6 +++--- conf/i386.src | 6 +++--- manifest.json | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index adcbcd8..bf37329 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Inspired by the Invidious project. - Mobile support (responsive design) -**Shipped version:** 2023.04.21~ynh1 +**Shipped version:** 2023.05.30~ynh1 **Demo:** https://nitter.net/ diff --git a/README_fr.md b/README_fr.md index 765cfb0..f1a1580 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,7 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit - Support mobile (conception réactive) -**Version incluse :** 2023.04.21~ynh1 +**Version incluse :** 2023.05.30~ynh1 **Démo :** https://nitter.net/ diff --git a/conf/amd64.src b/conf/amd64.src index efdaf1c..6e800f3 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://nim-lang.org/download/nim-1.6.10-linux_x64.tar.xz -SOURCE_SUM=2cdf8f4666f731a0197805fa16e147c739e47fbbced35c1d3d1fa33d8659efc3 +SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz +SOURCE_SUM=6b22894d0db974e10bd271217ce7f01a5fcd0b37cb3ea9d539734cb46f2cac75 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.10-linux_x64.tar.xz +SOURCE_FILENAME=nim-1.6.12-linux_x64.tar.xz SOURCE_EXTRACT=true diff --git a/conf/app.src b/conf/app.src index 6a215b1..113aa4a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/zedeus/nitter/tarball/2254a0728c587ebcec51ff08da0bf145606a629e -SOURCE_SUM=75f7e34f68912bcfaea5a04cf3789fb7dc56b8ea1c364bf537d281f5a0034416 +SOURCE_URL=https://github.com/zedeus/nitter/tarball/38985af6ed30f050201b15425cdac0dc2e286b6d +SOURCE_SUM=e3d4c27d6287ad382502ae2e577182d67d99fb305bea498200c7c34215236f55 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=36c72f98603e6387431224b3fb65ada765e9ab65 +SOURCE_FILENAME=38985af6ed30f050201b15425cdac0dc2e286b6d SOURCE_EXTRACT=true diff --git a/conf/arm64.src b/conf/arm64.src index 06a526b..71c1a5e 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-02-19-version-1-6-6af6818fe934e8e66d7024cfda6197632896b91c/nim-1.6.11-linux_arm64.tar.xz -SOURCE_SUM=bf072554f6d2352fa4806a6c8b6b74e10767a4a99a0b196409a3aabd4369465a +SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_arm64.tar.xz +SOURCE_SUM=730f4d6d98e65a5587ff4b198161725b7f787aed729d69045fbe38e0035ae8fb SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.11-linux_arm64.tar.xz +SOURCE_FILENAME=nim-1.6.13-linux_arm64.tar.xz SOURCE_EXTRACT=true diff --git a/conf/armhf.src b/conf/armhf.src index d753ce9..e2b081e 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-02-19-version-1-6-6af6818fe934e8e66d7024cfda6197632896b91c/nim-1.6.11-linux_armv7l.tar.xz -SOURCE_SUM=c7ee22c8f1153c5872fa08f0f288a0b52eb27d8c2ec39aa46e4b7125515185a3 +SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_armv7l.tar.xz +SOURCE_SUM=c34bc29d20c70c513382df8ef6d834d0588e4e99692a012c9b399020f49a4c1a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.11-linux_armv7l.tar.xz +SOURCE_FILENAME=nim-1.6.13-linux_armv7l.tar.xz SOURCE_EXTRACT=true diff --git a/conf/i386.src b/conf/i386.src index 947b9d6..1970ccf 100644 --- a/conf/i386.src +++ b/conf/i386.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://nim-lang.org/download/nim-1.6.10-linux_x32.tar.xz -SOURCE_SUM=e5fd9efe1a2b22e4f4c88574db9bc5a22bc511b5e101cf9e16b1f2c7cf4d657c +SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz +SOURCE_SUM=23b8069b54c22a0512e2e90c22abf7f976badd9277b03b25edd992e49ac4ea9e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.10-linux_x32.tar.xz +SOURCE_FILENAME=nim-1.6.12-linux_x32.tar.xz SOURCE_EXTRACT=true diff --git a/manifest.json b/manifest.json index b9d9d27..a1aec70 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Alternative front-end for Twitter that respects your privacy", "fr": "Interface alternative pour Twitter qui respecte votre vie privée" }, - "version": "2023.04.21~ynh1", + "version": "2023.05.30~ynh1", "url": "https://github.com/zedeus/nitter", "upstream": { "license": "AGPL-3.0-only", From d3894866851b61dba130b748cc5d85fb5aafc045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 3 Jun 2023 19:23:20 +0200 Subject: [PATCH 2/6] Version 2 (#32) --------- Co-authored-by: yunohost-bot Co-authored-by: Jules Bertholet --- README.md | 9 +- README_fr.md | 9 +- check_process | 21 ---- conf/amd64.src | 7 -- conf/app.src | 7 -- conf/arm64.src | 7 -- conf/armhf.src | 7 -- conf/i386.src | 7 -- conf/nginx.conf | 2 +- conf/nitter.conf | 1 - conf/systemd.service | 6 +- config_panel.toml | 81 +++++++------- doc/{DISCLAIMER.md => ADMIN.md} | 6 +- doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 6 +- manifest.json | 121 --------------------- manifest.toml | 89 +++++++++++++++ scripts/_common.sh | 27 +++-- scripts/backup | 22 +--- scripts/change_url | 91 +--------------- scripts/install | 150 ++++---------------------- scripts/remove | 57 +--------- scripts/restore | 83 ++------------ scripts/upgrade | 70 +++--------- tests.toml | 9 ++ 24 files changed, 201 insertions(+), 694 deletions(-) delete mode 100644 check_process delete mode 100644 conf/amd64.src delete mode 100644 conf/app.src delete mode 100644 conf/arm64.src delete mode 100644 conf/armhf.src delete mode 100644 conf/i386.src rename doc/{DISCLAIMER.md => ADMIN.md} (61%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (69%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/README.md b/README.md index bf37329..eb585a1 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Inspired by the Invidious project. - Mobile support (responsive design) -**Shipped version:** 2023.05.30~ynh1 +**Shipped version:** 2023.05.30~ynh2 **Demo:** https://nitter.net/ @@ -39,13 +39,6 @@ Inspired by the Invidious project. ![Screenshot of Nitter](./doc/screenshots/screenshot.png) -## Disclaimers / important information - -### Configuration - -This app requires a dedicated root domain. - -Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://instance-domain.tld/settings`. ## :red_circle: Antifeatures - **Non-free Network Services**: Promotes or depends entirely on a non-free network service. diff --git a/README_fr.md b/README_fr.md index f1a1580..ece097d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,7 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit - Support mobile (conception réactive) -**Version incluse :** 2023.05.30~ynh1 +**Version incluse :** 2023.05.30~ynh2 **Démo :** https://nitter.net/ @@ -38,13 +38,6 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit ![Capture d’écran de Nitter](./doc/screenshots/screenshot.png) -## Avertissements / informations importantes - -### Configuration - -Cette application nécéssite un domaine dedié. - -Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://instance-domain.tld/settings`. ## :red_circle: Fonctions indésirables - **Non-free Network Services**: Promotes or depends entirely on a non-free network service. diff --git a/check_process b/check_process deleted file mode 100644 index 7f28b60..0000000 --- a/check_process +++ /dev/null @@ -1,21 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 2022.06.09~ynh1 - upgrade=0 from_commit=0f1e8c0d23500b4ec4aa8085c287fac1adbe0db8 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index 6e800f3..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz -SOURCE_SUM=6b22894d0db974e10bd271217ce7f01a5fcd0b37cb3ea9d539734cb46f2cac75 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.12-linux_x64.tar.xz -SOURCE_EXTRACT=true diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 113aa4a..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/zedeus/nitter/tarball/38985af6ed30f050201b15425cdac0dc2e286b6d -SOURCE_SUM=e3d4c27d6287ad382502ae2e577182d67d99fb305bea498200c7c34215236f55 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=38985af6ed30f050201b15425cdac0dc2e286b6d -SOURCE_EXTRACT=true diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index 71c1a5e..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_arm64.tar.xz -SOURCE_SUM=730f4d6d98e65a5587ff4b198161725b7f787aed729d69045fbe38e0035ae8fb -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.13-linux_arm64.tar.xz -SOURCE_EXTRACT=true diff --git a/conf/armhf.src b/conf/armhf.src deleted file mode 100644 index e2b081e..0000000 --- a/conf/armhf.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_armv7l.tar.xz -SOURCE_SUM=c34bc29d20c70c513382df8ef6d834d0588e4e99692a012c9b399020f49a4c1a -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.13-linux_armv7l.tar.xz -SOURCE_EXTRACT=true diff --git a/conf/i386.src b/conf/i386.src deleted file mode 100644 index 1970ccf..0000000 --- a/conf/i386.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz -SOURCE_SUM=23b8069b54c22a0512e2e90c22abf7f976badd9277b03b25edd992e49ac4ea9e -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.6.12-linux_x32.tar.xz -SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 9cd1c0b..1653f5f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/public/ ; + alias __INSTALL_DIR__/public/; try_files $uri @proxy_to_app; } diff --git a/conf/nitter.conf b/conf/nitter.conf index 917b6a2..3b6f3f0 100644 --- a/conf/nitter.conf +++ b/conf/nitter.conf @@ -34,7 +34,6 @@ theme = "__THEME__" replaceTwitter = "__DOMAIN__" replaceYouTube = "__REPLACE_YOUTUBE__" replaceReddit = "__REPLACE_REDDIT__" -replaceInstagram = "__REPLACE_INSTAGRAM__" proxyVideos = true hlsPlayback = true infiniteScroll = false diff --git a/conf/systemd.service b/conf/systemd.service index 2baab68..a2dae61 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,13 +1,13 @@ [Unit] -Description=Nitter: Alternative Twitter front-end +Description=Nitter: alternative Twitter front-end After=network.target redis.service [Service] Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/nitter +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/nitter StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/config_panel.toml b/config_panel.toml index 3600fb9..8d5e429 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -4,52 +4,45 @@ version = "1.0" name = "Nitter configuration" services = ["__APP__"] -[main.config] -name = "Configuration Options" + [main.config] + name = "Configuration Options" -[main.config.title] -ask = "Default title" -type = "string" -default = "Nitter" -help = "Choose a default title for this instance" -bind = "title:__FINALPATH__/nitter.conf" + [main.config.title] + ask = "Default title" + type = "string" + default = "Nitter" + help = "Choose a default title for this instance" + bind = "title:__INSTALL_DIR__/nitter.conf" -[main.config.theme] -ask = "Default theme" -type = "select" -choices = [ - "Auto", - "Auto (Twitter)", - "Black", - "Dracula", - "Mastodon", - "Nitter", - "Pleroma", - "Twitter", - "Twitter dark", -] -default = "Auto" -help = "Choose a default theme for this instance" -bind = "theme:__FINALPATH__/nitter.conf" + [main.config.theme] + ask = "Default theme" + type = "select" + choices = [ + "Auto", + "Auto (Twitter)", + "Black", + "Dracula", + "Mastodon", + "Nitter", + "Pleroma", + "Twitter", + "Twitter dark", + ] + default = "Auto" + help = "Choose a default theme for this instance" + bind = "theme:__INSTALL_DIR__/nitter.conf" -[main.config.replace_youtube] -ask = "Piped/Invidious instance" -type = "string" -default = "https://invidious.fdn.fr/" -help = "Replace YouTube links with a Piped or Invidious instance" -bind = "replaceYouTube:__FINALPATH__/nitter.conf" + [main.config.replace_youtube] + ask = "Piped/Invidious instance" + type = "string" + default = "https://invidious.fdn.fr/" + help = "Replace YouTube links with a Piped or Invidious instance" + bind = "replaceYouTube:__INSTALL_DIR__/nitter.conf" -[main.config.replace_reddit] -ask = "Teddit/Libreddit instance" -type = "string" -default = "https://libredd.it/" -help = "Replace Reddit links with a Teddit or Libreddit instance" -bind = "replaceReddit:__FINALPATH__/nitter.conf" - -[main.config.replace_instagram] -ask = "Bibliogram instance" -type = "string" -default = "https://bibliogram.art/" -help = "Replace Instagram links with a Bibliogram instance" -bind = "replaceInstagram:__FINALPATH__/nitter.conf" + [main.config.replace_reddit] + ask = "Teddit/Libreddit instance" + type = "string" + default = "https://libredd.it/" + help = "Replace Reddit links with a Teddit or Libreddit instance" + bind = "replaceReddit:__INSTALL_DIR__/nitter.conf" diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 61% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 13498c0..cf788a5 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -1,5 +1 @@ -### Configuration - -This app requires a dedicated root domain. - -Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://instance-domain.tld/settings`. \ No newline at end of file +Nitter config file is stored in `/var/www/nitter/nitter.conf` (for the first instance, subsequent installs will go in `nitter__2`, `nitter__3`, etc). Users can override the defaults and set custom settings at `https://__DOMAIN__/settings`. \ No newline at end of file diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 69% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md index c4e2e4a..ad1f35f 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1 @@ -### Configuration - -Cette application nécéssite un domaine dedié. - -Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://instance-domain.tld/settings`. \ No newline at end of file +Le ficher de configuration de Nitter se trouve à `/var/www/nitter/nitter.conf` (pour la première installation, les prochaines installations iront dans `nitter__2`, `nitter__3`, etc). Les utilisateurs peuvent modifier les paramétres par défaut en visitant `https://__DOMAIN__/settings`. \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index a1aec70..0000000 --- a/manifest.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "name": "Nitter", - "id": "nitter", - "packaging_format": 1, - "description": { - "en": "Alternative front-end for Twitter that respects your privacy", - "fr": "Interface alternative pour Twitter qui respecte votre vie privée" - }, - "version": "2023.05.30~ynh1", - "url": "https://github.com/zedeus/nitter", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://nitter.net/", - "demo": "https://nitter.net/", - "admindoc": "https://github.com/zedeus/nitter/wiki", - "code": "https://github.com/zedeus/nitter" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "Jules Bertholet", - "email": "jules.bertholet@gmail.com" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx", - "redis" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true, - "help": { - "en": "If public, anyone will be able to use this Nitter instance to browse Twitter. Note that heavy usage may cause Twitter API rate limits to be hit.", - "fr": "Si public, tout le monde pourra utiliser cette instance Nitter pour parcourir Twitter. Notez qu'un usage trop intensif peut être bridé par l'API Twitter au dela d'un certain seuil." - } - }, - { - "name": "title", - "type": "string", - "default": "Nitter", - "ask": { - "en": "Name of the instance", - "fr": "Nom de l'instance" - } - }, - { - "name": "theme", - "type": "string", - "default": "Auto", - "choices": [ - "Auto", - "Black", - "Mastodon", - "Nitter", - "Pleroma", - "Twitter", - "Twitter dark" - ], - "ask": { - "en": "Choose a default theme for this instance", - "fr": "Choisissez un thème par défaut pour cette instance" - }, - "help": { - "en": "Users can override this setting", - "fr": "Les utilisateurs peuvent modifier ce paramétre" - } - }, - { - "name": "replace_youtube", - "type": "string", - "optional": true, - "default": "", - "ask": { - "en": "Replace YouTube links with an Invidious instance", - "fr": "Remplacer les liens YouTube avec une instance Invidious" - }, - "help": { - "en": "You can choose to rewrite YouTube links in tweets to point to an Invidious instance. Use one from https://instances.invidious.io/ or install Invidious on your server! Users can override this setting.", - "fr": "Vous pouvez choisir de réécrire les liens YouTube dans les tweets pour pointer vers une instance Invidious. Choisissez-en une de https://instances.invidious.io/ ou installez Invidious sur votre serveur! Les utilisateus peuvent modifier ce paramétre." - } - }, - { - "name": "replace_instagram", - "type": "string", - "optional": true, - "default": "", - "ask": { - "en": "Replace Instagram links with a Bibliogram instance", - "fr": "Remplacer les liens Instagram avec une instance Bibliogram" - }, - "help": { - "en": "You can choose to rewrite Instagram links in tweets to point to a Bibliogram instance. Use one from https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md or install Bibliogram on your server! Users can override this setting.", - "fr": "Vous pouvez choisir de réécrire les liens Instagram dans les tweets pour pointer vers une instance Bibliogram. Choisissez-en une de https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md ou installez Bibliogram sur votre serveur! Les utilisateurs peuvent modifier ce paramétre." - } - }, - { - "name": "replace_reddit", - "type": "string", - "optional": true, - "default": "", - "ask": { - "en": "Replace Reddit links with a Libreddit instance", - "fr": "Remplacer les liens Reddit avec une instance Libreddit" - }, - "help": { - "en": "You can choose to rewrite Reddit links in tweets to point to a Libreddit instance. Use https://libredd.it/ or install Libreddit on your server! Users can override this setting.", - "fr": "Vous pouvez choisir de réécrire les liens Reddit dans les tweets pour pointer vers une instance Libreddit. Choisissez https://libredd.it/ ou installez Libreddit sur votre serveur! Les utilisateurs peuvent modifier ce paramétre." - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..0b31ac8 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,89 @@ +packaging_format = 2 + +id = "nitter" +name = "Nitter" +description.en = "Alternative front-end for Twitter that respects your privacy" +description.fr = "Interface alternative pour Twitter qui respecte votre vie privée" + +version = "2023.05.30~ynh2" + +maintainers = ["Jules Bertholet"] + +[upstream] +license = "AGPL-3.0-only" +website = "https://nitter.net/" +demo = "https://nitter.net/" +admindoc = "https://github.com/zedeus/nitter/wiki" +code = "https://github.com/zedeus/nitter" + +[integration] +yunohost = ">= 11.1.19" +architectures = "all" +multi_instance = true +ldap = false +sso = true +disk = "50M" +ram.build = "2000M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + full_domain = true + + [install.init_main_permission] + help.en = "If public, anyone will be able to use this Nitter instance to browse Twitter. Note that heavy usage may cause Twitter API rate limits to be hit." + help.fr = "Si public, tout le monde pourra utiliser cette instance Nitter pour parcourir Twitter. Notez qu'un usage trop intensif peut être bridé par l'API Twitter au dela d'un certain seuil." + type = "group" + default = "visitors" + + [install.title] + ask.en = "Name of the instance" + ask.fr = "Nom de l'instance" + type = "string" + default = "Nitter" + + [install.replace_youtube] + ask.en = "Replace YouTube links with a Piped or Invidious instance" + ask.fr = "Remplacer les liens YouTube avec une instance Piped ou Invidious" + help.en = "You can choose to rewrite YouTube links in tweets to point to a Piped or Invidious instance. Use one from https://github.com/TeamPiped/Piped/wiki/Instances or https://instances.invidious.io/, or install Invidious on your server! Users can override this setting." + help.fr = "Vous pouvez choisir de réécrire les liens YouTube dans les tweets pour pointer vers une instance Piped ou Invidious. Choisissez-en une de https://github.com/TeamPiped/Piped/wiki/Instances ou https://instances.invidious.io/, ou installez Invidious sur votre serveur! Les utilisateus peuvent modifier ce paramétre." + type = "string" + optional = true + default = "" + + [install.replace_reddit] + ask.en = "Replace Reddit links with a Libreddit or Teddit instance" + ask.fr = "Remplacer les liens Reddit avec une instance Libreddit ou Teddit" + help.en = "You can choose to rewrite Reddit links in tweets to point to a Libreddit or Teddit instance. Use https://libredd.it/ or install Libreddit on your server! Users can override this setting." + help.fr = "Vous pouvez choisir de réécrire les liens Reddit dans les tweets pour pointer vers une instance Libreddit ou Teddit. Choisissez https://libredd.it/ ou installez Libreddit sur votre serveur! Les utilisateurs peuvent modifier ce paramétre." + type = "string" + optional = true + default = "" + +[resources] + [resources.sources.main] + url = "https://github.com/zedeus/nitter/tarball/38985af6ed30f050201b15425cdac0dc2e286b6d" + sha256 = "e3d4c27d6287ad382502ae2e577182d67d99fb305bea498200c7c34215236f55" + + [resources.sources.nim] + amd64.url = "https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz" + amd64.sha256 = "6b22894d0db974e10bd271217ce7f01a5fcd0b37cb3ea9d539734cb46f2cac75" + arm64.url = "https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_arm64.tar.xz" + arm64.sha256 = "730f4d6d98e65a5587ff4b198161725b7f787aed729d69045fbe38e0035ae8fb" + armhf.url = "https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_armv7l.tar.xz" + armhf.sha256 = "c34bc29d20c70c513382df8ef6d834d0588e4e99692a012c9b399020f49a4c1a" + i386.url = "https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz" + i386.sha256 = "23b8069b54c22a0512e2e90c22abf7f976badd9277b03b25edd992e49ac4ea9e" + + [resources.ports] + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = "acl nim libsass-dev" diff --git a/scripts/_common.sh b/scripts/_common.sh index e0d0ad9..12025ee 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,30 +4,27 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="acl nim libsass-dev" - #================================================= # PERSONAL HELPERS #================================================= function build_nitter { - pushd "$final_path" - chown -R $app:$app $final_path - sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble build -d:release -y -d:danger --passC:"-flto" --passL:"-flto" 2>&1 - sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" strip -s nitter 2>&1 - sudo -u $app env "PATH=$final_path/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble scss -y 2>&1 - mkdir -p $final_path/tmp - chown -R root:root $final_path + pushd "$install_dir" + chown -R $app:$app $install_dir + sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble build -d:release -y -d:danger --passC:"-flto" --passL:"-flto" 2>&1 + sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" strip -s nitter 2>&1 + sudo -u $app env "PATH=$install_dir/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" nimble scss -y 2>&1 + mkdir -p $install_dir/tmp + chown -R root:root $install_dir popd } function set_permissions { - chown -R root:$app $final_path - chown -R $app:$app $final_path/tmp - chmod -R g=u,g-w,o-rwx $final_path - setfacl -n -m u:www-data:--x $final_path - setfacl -nR -m u:www-data:r-x -m d:u:www-data:r-x $final_path/public + chown -R root:$app $install_dir + chown -R $app:$app $install_dir/tmp + chmod -R g=u,g-w,o-rwx $install_dir + setfacl -n -m u:www-data:--x $install_dir + setfacl -nR -m u:www-data:r-x -m d:u:www-data:r-x $install_dir/public } #================================================= diff --git a/scripts/backup b/scripts/backup index 3497042..737146f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup() { - true -} -# 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 #================================================= @@ -39,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 86380f2..4852a01 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ 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="/" - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# 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 - -#================================================= -# 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 #================================================= @@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -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 +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS @@ -110,9 +34,9 @@ ynh_script_progression --message="Updating a configuration file..." if [ $change_domain -eq 1 ] then - ynh_delete_file_checksum --file="$final_path/nitter.conf" - ynh_replace_string --match_string="hostname = \"$old_domain\"" --replace_string="hostname = \"$new_domain\"" --target_file="$final_path/nitter.conf" - ynh_store_file_checksum --file="$final_path/nitter.conf" + ynh_delete_file_checksum --file="$install_dir/nitter.conf" + ynh_replace_string --match_string="hostname = \"$old_domain\"" --replace_string="hostname = \"$new_domain\"" --target_file="$install_dir/nitter.conf" + ynh_store_file_checksum --file="$install_dir/nitter.conf" fi #================================================= @@ -125,13 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index e8e3a7b..0f71e92 100755 --- a/scripts/install +++ b/scripts/install @@ -9,105 +9,26 @@ 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="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -title=$YNH_APP_ARG_TITLE -theme=$YNH_APP_ARG_THEME -replace_youtube=$YNH_APP_ARG_REPLACE_YOUTUBE -replace_instagram=$YNH_APP_ARG_REPLACE_INSTAGRAM -replace_reddit=$YNH_APP_ARG_REPLACE_REDDIT - -app=$YNH_APP_INSTANCE_NAME - hmac_key=$(ynh_string_random --length=64) - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -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=1 - -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=title --value=$title -ynh_app_setting_set --app=$app --key=theme --value=$theme -ynh_app_setting_set --app=$app --key=replace_youtube --value=$replace_youtube -ynh_app_setting_set --app=$app --key=replace_instagram --value=$replace_instagram -ynh_app_setting_set --app=$app --key=replace_reddit --value=$replace_reddit +theme="Auto" ynh_app_setting_set --app=$app --key=hmac_key --value=$hmac_key - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=8080) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 - -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_app_setting_set --app=$app --key=theme --value=$theme #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -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" --source_id="app" -ynh_setup_source --dest_dir="$final_path/nim-installation" --source_id=$YNH_ARCH +ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/nim-installation" --source_id="nim" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC SETUP @@ -119,46 +40,34 @@ ynh_script_progression --message="Compiling Nitter..." --weight=30 build_nitter #================================================= -# ADD A CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf" - -chmod 400 "$final_path/nitter.conf" -chown $app:$app "$final_path/nitter.conf" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +# Create a dedicated NGINX config +ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= # Set permissions to app files set_permissions -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Alternative front-end for Twitter that respects your privacy" --log="/var/log/$app/$app.log" +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + +ynh_add_config --template="nitter.conf" --destination="$install_dir/nitter.conf" + +chmod 400 "$install_dir/nitter.conf" +chown $app:$app "$install_dir/nitter.conf" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -167,25 +76,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ]; then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index f41ce8c..4e538f0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,21 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null; then @@ -32,56 +22,15 @@ if ynh_exec_warn_less yunohost service status $app >/dev/null; then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index b8b96d6..5b52d05 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,97 +10,33 @@ 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=1 - -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..." --weight=1 - -test ! -d $final_path || - ynh_die --message="There is already a directory: $final_path " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# 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..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" + +chown -R $app:www-data "$install_dir" #================================================= -# SPECIFIC RESTORATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -# REINSTALL DEPENDENCIES +# RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE USER RIGHTS -#================================================= - # Restore permissions on app files set_permissions -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_use_logrotate --non-append ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Alternative front-end for Twitter that respects your privacy" --log="/var/log/$app/$app.log" #================================================= @@ -110,13 +46,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 63eba01..8998c74 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,45 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -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) -port=$(ynh_app_setting_get --app=$app --key=port) -title=$(ynh_app_setting_get --app=$app --key=title) -theme=$(ynh_app_setting_get --app=$app --key=theme) -replace_youtube=$(ynh_app_setting_get --app=$app --key=replace_youtube) -replace_instagram=$(ynh_app_setting_get --app=$app --key=replace_instagram) -replace_reddit=$(ynh_app_setting_get --app=$app --key=replace_reddit) -hmac_key=$(ynh_app_setting_get --app=$app --key=hmac_key) - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# 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 +# If theme doesn't exist, create it +if [ -z "${theme:-}" ]; then + theme="Auto" + ynh_app_setting_set --app=$app --key=theme --value=$theme +fi #================================================= # STANDARD UPGRADE STEPS @@ -58,14 +35,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -74,20 +43,12 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="app" - ynh_setup_source --dest_dir="$final_path/nim-installation" --source_id=$YNH_ARCH --keep="nitter.conf" + ynh_setup_source --dest_dir="$install_dir" + ynh_setup_source --dest_dir="$install_dir/nim-installation" --source_id="nim" --keep="nitter.conf" 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=1 - -ynh_install_app_dependencies $pkg_dependencies +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -111,7 +72,7 @@ build_nitter #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_add_config --template="nitter.conf" --destination="$final_path/nitter.conf" +ynh_add_config --template="nitter.conf" --destination="$install_dir/nitter.conf" #================================================= # SETUP SYSTEMD @@ -152,13 +113,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..5990508 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.5b6368a92174768c22bd2fa97e327d822a8d42f3.name = "Upgrade from 2023.02.02" From 3c8999ee1a12b210838290fc9f1c8ed83ac10ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:04:52 +0200 Subject: [PATCH 3/6] Update manifest.toml --- manifest.toml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index 0b31ac8..ea464e5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -63,18 +63,18 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/zedeus/nitter/tarball/38985af6ed30f050201b15425cdac0dc2e286b6d" - sha256 = "e3d4c27d6287ad382502ae2e577182d67d99fb305bea498200c7c34215236f55" + url = "https://github.com/zedeus/nitter/tarball/0bc3c153d9b38a3c02f321fb64a375fef6b97e8e" + sha256 = "0ec00b67ed8b2b33f5dd5008705985ea4853c666938ffe560c79f498c4a3baf3" [resources.sources.nim] - amd64.url = "https://nim-lang.org/download/nim-1.6.12-linux_x64.tar.xz" - amd64.sha256 = "6b22894d0db974e10bd271217ce7f01a5fcd0b37cb3ea9d539734cb46f2cac75" - arm64.url = "https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_arm64.tar.xz" - arm64.sha256 = "730f4d6d98e65a5587ff4b198161725b7f787aed729d69045fbe38e0035ae8fb" - armhf.url = "https://github.com/nim-lang/nightlies/releases/download/2023-06-01-version-1-6-b855404c711730c41114e86631fa19414080f999/nim-1.6.13-linux_armv7l.tar.xz" - armhf.sha256 = "c34bc29d20c70c513382df8ef6d834d0588e4e99692a012c9b399020f49a4c1a" - i386.url = "https://nim-lang.org/download/nim-1.6.12-linux_x32.tar.xz" - i386.sha256 = "23b8069b54c22a0512e2e90c22abf7f976badd9277b03b25edd992e49ac4ea9e" + amd64.url = "https://nim-lang.org/download/nim-1.6.14-linux_x64.tar.xz" + amd64.sha256 = "1e7073c05600f2be5f2d9018e73f4584f0369442455ab27521ca499b47eef904" + arm64.url = "https://github.com/nim-lang/nightlies/releases/download/2023-07-04-version-1-6-1cd48e4b2abd867adf1ab52a70a1d8f1c6ac77c4/nim-1.6.15-linux_arm64.tar.xz" + arm64.sha256 = "4ff08b1785e60bdac17fe4a40ce119b6f9d40fad0421e9576097f95122ce4125" + armhf.url = "https://github.com/nim-lang/nightlies/releases/download/2023-07-04-version-1-6-1cd48e4b2abd867adf1ab52a70a1d8f1c6ac77c4/nim-1.6.15-linux_armv7l.tar.xz" + armhf.sha256 = "7441e7feb3e3293c8662011e174d913ae276c853255f5792b31c3c2ec4d0ed30" + i386.url = "https://nim-lang.org/download/nim-1.6.14-linux_x32.tar.xz" + i386.sha256 = "18d285f62392b3cd725af91df4a7b3b99bbcd5446881725e18e372e3a2c3a89b" [resources.ports] From cf9f4520134125976f1bf233324b8b220b416414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:05:19 +0200 Subject: [PATCH 4/6] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ea464e5..c2db4a4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Nitter" description.en = "Alternative front-end for Twitter that respects your privacy" description.fr = "Interface alternative pour Twitter qui respecte votre vie privée" -version = "2023.05.30~ynh2" +version = "2023.07.10~ynh1" maintainers = ["Jules Bertholet"] From 3fabf0021848bafbacf5340a7e03b9007547e6b3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 10 Jul 2023 17:05:24 +0000 Subject: [PATCH 5/6] 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 eb585a1..bb6cdf9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Inspired by the Invidious project. - Mobile support (responsive design) -**Shipped version:** 2023.05.30~ynh2 +**Shipped version:** 2023.07.10~ynh1 **Demo:** https://nitter.net/ diff --git a/README_fr.md b/README_fr.md index ece097d..b7e520b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,7 @@ Nitter est une interface alternative pour Twitter qui est plus rapide que le sit - Support mobile (conception réactive) -**Version incluse :** 2023.05.30~ynh2 +**Version incluse :** 2023.07.10~ynh1 **Démo :** https://nitter.net/ From a7139074da6f562e08947302a717525fd8a06108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 10 Jul 2023 19:06:47 +0200 Subject: [PATCH 6/6] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index c2db4a4..891eb43 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://github.com/zedeus/nitter/wiki" code = "https://github.com/zedeus/nitter" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.1.21" architectures = "all" multi_instance = true ldap = false