1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/invidious_ynh.git synced 2024-09-03 19:15:55 +02:00

Config panel (#72)

* Add config panel
This commit is contained in:
Éric Gaspar 2022-01-14 19:09:22 +01:00 committed by GitHub
parent 7b5535dad2
commit 80fbb568a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 11 deletions

View file

@ -23,7 +23,7 @@ In addition to constituting an advantage in terms of confidentiality (the data d
- Ability to subscribe to channels without creating a Google account
**Shipped version:** 22.01.12~ynh1
**Shipped version:** 22.01.14~ynh1
**Demo:** https://invidious.site/

View file

@ -18,7 +18,7 @@ En plus de constituer un avantage sur le plan de la confidentialité (les donné
- Possibilité d'afficher les commentaires Reddit plutôt que les commentaires YouTube,
- Possibilité de s'abonner aux chaines sans créer de compte Google
**Version incluse :** 22.01.12~ynh1
**Version incluse :** 22.01.14~ynh1
**Démo :** https://invidious.site/

View file

@ -252,7 +252,7 @@ hsts: true
## Accepted values: true, false
## Default: true
##
#registration_enabled: true
registration_enabled: __REGISTRATION_ENABLED__
##
## Allow/Forbid users to log-in. This setting affects the ability
@ -261,7 +261,7 @@ hsts: true
## Accepted values: true, false
## Default: true
##
#login_enabled: true
login_enabled: __LOGIN_ENABLED__
##
## Enable/Disable the captcha challenge on the login page.
@ -272,7 +272,7 @@ hsts: true
## Accepted values: true, false
## Default: true
##
#captcha_enabled: true
captcha_enabled: __CAPTCHA_ENABLED__
##
## List of usernames that will be granted administrator rights.

View file

@ -17,10 +17,6 @@ location __PATH__/ {
}
location __PATH__/embed/ {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT__/embed/;
proxy_redirect off;

32
config_panel.toml Normal file
View file

@ -0,0 +1,32 @@
version = "1.0"
[main]
name = "Invidious configuration"
services = ["__APP__"]
[main.config]
name = "Configuration Options"
[main.config.registration_enabled]
ask = "Enable registration"
type = "boolean"
yes = "true"
no = "false"
help = "Allow/Forbid Invidious (local) account creation"
bind = "registration_enabled:__FINALPATH__/config/config.yml"
[main.config.login_enabled]
ask = "Enable login"
type = "boolean"
yes = "true"
no = "false"
help = "Allow/Forbid users to log-in"
bind = "login_enabled:__FINALPATH__/config/config.yml"
[main.config.captcha_enabled]
ask = "Enable captcha"
type = "boolean"
yes = "true"
no = "false"
help = "Enable/Disable the captcha challenge on the login page"
bind = "captcha_enabled:__FINALPATH__/config/config.yml"

View file

@ -6,7 +6,7 @@
"en": "Alternative front-end to YouTube",
"fr": "Front-end alternatif à YouTube"
},
"version": "22.01.12~ynh1",
"version": "22.01.14~ynh1",
"url": "https://invidio.us/",
"upstream": {
"license": "GPL-3.0-only",

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES
#=================================================
version_commit=b65dced646acf56f914a8916fd411237a141ecce
version_commit=042ff8da643e9304f4d2c7db8f0c3cdba82d35ee
# dependencies used by the app
pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin imagemagick libsqlite3-dev zlib1g-dev libevent-dev pkg-config libpcre3-dev"

View file

@ -30,6 +30,10 @@ language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
registration_enabled="true"
login_enabled="true"
captcha_enabled="true"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -49,6 +53,9 @@ 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=language --value=$language
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
#=================================================
# STANDARD MODIFICATIONS

View file

@ -25,6 +25,10 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
registration_enabled=$(ynh_app_setting_get --app=$app --key=registration_enabled)
login_enabled=$(ynh_app_setting_get --app=$app --key=login_enabled)
captcha_enabled=$(ynh_app_setting_get --app=$app --key=captcha_enabled)
#=================================================
# CHECK VERSION
#=================================================
@ -59,6 +63,21 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "$registration_enabled" ]; then
registration_enabled="true"
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
fi
if [ -z "$login_enabled" ]; then
login_enabled="true"
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
fi
if [ -z "$captcha_enabled" ]; then
captcha_enabled="true"
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all