Browse Source

Add conifg questions + install works from anywhere

master
Miraty 9 months ago
parent
commit
b1a34c11dd
3 changed files with 78 additions and 42 deletions
  1. +54
    -1
      manifest.json
  2. +22
    -39
      scripts/install
  3. +2
    -2
      scripts/remove

+ 54
- 1
manifest.json View File

@@ -37,7 +37,7 @@
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Invidious (works only with /)",
"en": "Choose a path for Invidious (only works with /)",
"fr": "Choisissez un chemin pour Invidious (fonctionne seulement avec /)"
},
"example": "/",
@@ -51,6 +51,59 @@
"fr": "Est-ce une application publique ?"
},
"default": true
},
{
"name": "registration_enabled",
"type": "string",
"ask": {
"en": "Allow registration?",
"fr": "Autoriser les inscriptions ?"
},
"choices": [
"true",
"false"
],
"default": "true"
},
{
"name": "dark_mode",
"type": "string",
"ask": {
"en": "Must Invidious be in dark mode by default?",
"fr": "Invidious doit-elle être en thème sombre par défaut ?"
},
"choices": [
"true",
"false"
],
"default": "true"
},
{
"name": "lang",
"type": "string",
"ask": {
"en": "Choose the default language",
"fr": "Choisissez la langue par défaut"
},
"choices": [
"ar",
"de",
"el",
"en-US",
"eo",
"es",
"eu",
"fr",
"is",
"it",
"nb_NO",
"nl",
"pl",
"ru",
"uk",
"zh-CN"
],
"example": "eo"
}
]
}


+ 22
- 39
scripts/install View File

@@ -27,6 +27,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
registration_enabled=$YNH_APP_ARG_REGISTRATION_ENABLED
dark_mode=$YNH_APP_ARG_DARK_MODE
lang=$YNH_APP_ARG_LANG

### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
@@ -64,6 +67,9 @@ ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app lang $lang
ynh_app_setting_set $app dark_mode $dark_mode
ynh_app_setting_set $app registration_enabled $registration_enabled

#=================================================
# STANDARD MODIFICATIONS
@@ -116,12 +122,11 @@ ynh_install_app_dependencies $pkg_dependencies
# Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source "$final_path"

cd /var/www/
pushd /var/www/
git clone https://github.com/omarroth/invidious
cd /var/www/invidious/
git checkout tags/0.19.1
cd /home/invidious_ynh/scripts/

popd

#=================================================
# CREATE A MYSQL DATABASE
@@ -186,13 +191,22 @@ ynh_system_user_create $app
# SPECIFIC SETUP
#=================================================

pushd /var/www/invidious/

#sudo -i -u invidious
cd /var/www/invidious/
shards update && shards install
crystal build src/invidious.cr --release
cd /home/invidious_ynh/scripts/
#exit
#rm /var/www/invidious/config/config.yml
#cp /home/invidious_ynh/conf/config.yml /var/www/invidious/config/

# Configure Invidious
ynh_replace_string --match_string="domain:" --replace_string="domain: $domain" --target_file=$final_path/config/config.yml
#ynh_replace_string --match_string="domain:" --replace_string="" --target_file=$final_path/config/config.yml
echo "default_user_preferences:" >> $final_path/config/config.yml
echo " dark_mode: $dark_mode" >> $final_path/config/config.yml
echo " locale: \"$lang\"" >> $final_path/config/config.yml
echo "registration_enabled: $registration_enabled" >> $final_path/config/config.yml

popd

#=================================================

@@ -219,37 +233,6 @@ ynh_add_systemd_config
ynh_systemd_action

#=================================================
# SETUP APPLICATION WITH CURL
#=================================================

### Use these lines only if the app installation needs to be finalized through
### web forms. We generally don't want to ask the final user,
### so we're going to use curl to automatically fill the fields and submit the
### forms.

# Set right permissions for curl install
#chown -R $app: $final_path

# Set the app as temporarily public for curl call
#ynh_print_info "Configuring SSOwat..."
#ynh_app_setting_set $app skipped_uris "/"
# Reload SSOwat config
#yunohost app ssowatconf

# Reload Nginx
#systemctl reload nginx

# Installation with curl
#ynh_print_info "Finalizing installation..."
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"

# Remove the public access
#if [ $is_public -eq 0 ]
#then
# ynh_app_setting_delete $app skipped_uris
#fi

#=================================================
# MODIFY A CONFIG FILE
#=================================================

@@ -267,7 +250,7 @@ ynh_systemd_action
### you can make a backup of this file before modifying it again if the admin had modified it.

# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/CONFIG_FILE"
ynh_store_file_checksum "$final_path/config/config.yml"

#=================================================
# GENERIC FINALIZATION


+ 2
- 2
scripts/remove View File

@@ -56,7 +56,7 @@ ynh_remove_systemd_config
#=================================================
ynh_print_info "Removing the PostgreSQL database"

ynh_psql_remove_db --db_user=kemal --db_name=invidious
ynh_psql_remove_db --db_user=kemal --db_name=$app

#=================================================
# REMOVE DEPENDENCIES
@@ -75,7 +75,7 @@ ynh_secure_remove --file=/etc/apt/sources.list.d/crystal.list
ynh_print_info "Removing app main directory"

# Remove the app directory securely
ynh_secure_remove --file=/var/www/invidious
ynh_secure_remove --file=/var/www/$app

#=================================================
# REMOVE NGINX CONFIGURATION


Loading…
Cancel
Save