1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nitter_ynh.git synced 2024-09-03 19:46:24 +02:00

Add config panel

This commit is contained in:
Éric Gaspar 2022-06-19 13:32:12 +02:00
parent d150072723
commit 7ca0bc098f
No known key found for this signature in database
GPG key ID: 574F281483054D44
10 changed files with 95 additions and 17 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__

View file

@ -1,5 +1,5 @@
[Unit]
Description=Small description of the service
Description=Nitter: Alternative Twitter front-end
After=network.target redis.service
[Service]

65
config_panel.toml.example Normal file
View file

@ -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"

View file

@ -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",

View file

@ -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 {

View file

@ -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

View file

@ -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)