From 7ca0bc098f95b6675465524fc7a46e73ad359d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 19 Jun 2022 13:32:12 +0200 Subject: [PATCH] Add config panel --- check_process | 9 ++---- conf/amd64.src | 6 ++-- conf/app.src | 4 +-- conf/nitter.conf | 1 + conf/systemd.service | 2 +- config_panel.toml.example | 65 +++++++++++++++++++++++++++++++++++++++ manifest.json | 14 +++++++++ scripts/_common.sh | 4 +-- scripts/install | 6 ++-- scripts/upgrade | 1 + 10 files changed, 95 insertions(+), 17 deletions(-) create mode 100644 config_panel.toml.example diff --git a/check_process b/check_process index fa08401..5e17cfe 100644 --- a/check_process +++ b/check_process @@ -1,12 +1,7 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/conf/amd64.src b/conf/amd64.src index c4865b9..601d5c8 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://nim-lang.org/download/nim-1.6.2-linux_x64.tar.xz -SOURCE_SUM=9e0c616fe504402e29e43d44708a49416dcbfa295cee1883ce6e5bfb25c364f1 +SOURCE_URL=https://nim-lang.org/download/nim-1.6.6-linux_x64.tar.xz +SOURCE_SUM=3e88df45dbbec2f083d31e00e6f2c07e0c70c392c91b2a934f7f283dd0fdf5f9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=nim-1.4.4-linux_x64.tar.xz +SOURCE_FILENAME=nim-1.6.6-linux_x64.tar.xz SOURCE_EXTRACT=true diff --git a/conf/app.src b/conf/app.src index d74f1a6..870efce 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/zedeus/nitter/tarball/6695784050605c77a301c0a66764fa9a9580a2f5 -SOURCE_SUM=00cb84f1a26c426cf9c77cb9e5f5069a81c9f547bc893cc089f6c996220ca8fc +SOURCE_URL=https://github.com/zedeus/nitter/tarball/5e827c91aa1b5f41cc03c5bb07b6fe629002430b +SOURCE_SUM=e4395aecfa59c464987fcd61cc60442b5024fea80815ae86d48cd0b35a13f15d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nitter.conf b/conf/nitter.conf index e710761..aa29c72 100644 --- a/conf/nitter.conf +++ b/conf/nitter.conf @@ -33,6 +33,7 @@ tokenCount = 10 theme = "__THEME__" replaceTwitter = "__DOMAIN__" replaceYouTube = "__REPLACE_YOUTUBE__" +replaceReddit = "__REPLACE_REDDIT__" replaceInstagram = "__REPLACE_INSTAGRAM__" proxyVideos = __PROXY_VIDEOS__ hlsPlayback = __HLS_PLAYBACK__ diff --git a/conf/systemd.service b/conf/systemd.service index 491b04b..68b6a16 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Small description of the service +Description=Nitter: Alternative Twitter front-end After=network.target redis.service [Service] diff --git a/config_panel.toml.example b/config_panel.toml.example new file mode 100644 index 0000000..cb49721 --- /dev/null +++ b/config_panel.toml.example @@ -0,0 +1,65 @@ +version = "1.0" + +[main] +name = "Nitter configuration" +services = ["__APP__"] + + [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.theme] + ask = "Default theme" + type = "select" + choices = ["Auto", "Black", "Mastodon", "Nitter", "Pleroma", "Twitter", "Twitter dark"] + default = "Auto" + help = "Choose a default theme for this instance" + bind = "theme:__FINALPATH__/nitter.conf" + + [main.config.hls_playback] + ask = "Enable HLS" + type = "boolean" + yes = "true" + no = "false" + help = "Enable HLS video playback by default" + bind = "hlsPlayback:__FINALPATH__/nitter.conf" + + [main.config.infinite_scroll] + ask = "Enable infinite scrolling" + type = "boolean" + yes = "true" + no = "false" + help = "Enable infinite scrolling by default" + bind = "infiniteScroll:__FINALPATH__/nitter.conf" + + [main.config.proxy_videos] + ask = "Proxy Twitter videos" + type = "boolean" + yes = "true" + no = "false" + help = "Proxy Twitter videos through Nitter by default" + bind = "Scanner.Extractor:__FINALPATH__/nitter.conf" + + [main.config.$replace_reddit] + ask = "Libreddit instance" + type = "string" + help = "Replace Instagram links with a Libreddit instance" + bind = "replaceInstagram:__FINALPATH__/nitter.conf" + + [main.config.$replace_instagram] + ask = "Bibliogram instance" + type = "string" + help = "Replace Instagram links with a Bibliogram instance" + bind = "replaceInstagram:__FINALPATH__/nitter.conf" + + [main.config.replace_youtube] + ask = "Invidious instance" + type = "string" + help = "Replace YouTube links with an Invidious instance" + bind = "replaceYouTube:__FINALPATH__/nitter.conf" diff --git a/manifest.json b/manifest.json index 53cfe67..1a98f38 100644 --- a/manifest.json +++ b/manifest.json @@ -95,6 +95,20 @@ "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 Instagram dans les tweets pour pointer vers une instance Bibliogram. Choisissez https://libredd.it/ ou installez Libreddit sur votre serveur! Les utilisateurs peuvent modifier ce paramétre." + } + }, { "name": "proxy_videos", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index 5d74bd4..4b30a3c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,14 +12,14 @@ pkg_dependencies="acl nim libsass-dev" #================================================= function build_nitter { - pushd "$final_path" || ynh_die + pushd "$final_path" chown -R $app:$app $final_path sudo -u $app env "PATH=/opt/yunohost/$app/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=/opt/yunohost/$app/nim-installation/bin:$(sudo -u $app sh -c 'echo $PATH')" strip -s nitter 2>&1 sudo -u $app env "PATH=/opt/yunohost/$app/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 - popd || ynh_die + popd } function set_permissions { diff --git a/scripts/install b/scripts/install index 592923b..28213da 100755 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,8 @@ title=$YNH_APP_ARG_TITLE theme=$YNH_APP_ARG_THEME replace_youtube=$YNH_APP_ARG_REPLACE_YOUTUBE replace_instagram=$YNH_APP_ARG_REPLACE_INSTAGRAM -architecture=$YNH_ARCH +replace_reddit=$YNH_APP_ARG_REPLACE_REDDIT + if [ $YNH_APP_ARG_PROXY_VIDEOS -eq 1 ]; then proxy_videos="true" else @@ -69,6 +70,7 @@ 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 ynh_app_setting_set --app=$app --key=proxy_videos --value=$proxy_videos ynh_app_setting_set --app=$app --key=hls_playback --value=$hls_playback ynh_app_setting_set --app=$app --key=infinite_scroll --value=$infinite_scroll @@ -100,7 +102,7 @@ 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="$architecture" +ynh_setup_source --dest_dir="$final_path/nim-installation" --source_id=$YNH_ARCH #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index f754157..06a7aea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ 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) proxy_videos=$(ynh_app_setting_get --app=$app --key=proxy_videos) hls_playback=$(ynh_app_setting_get --app=$app --key=hls_playback) infinite_scroll=$(ynh_app_setting_get --app=$app --key=infinite_scroll)