1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/invidious_ynh.git synced 2024-09-03 19:15:55 +02:00
This commit is contained in:
ericgaspar 2021-02-15 15:53:02 +01:00
parent e879a763f6
commit 28cbd202d3
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 22 additions and 69 deletions

View file

@ -3,7 +3,7 @@ feed_threads: 1
db:
user: __DB_NAME__
password: __DB_PASS__
password: __DB_PWD__
host: localhost
port: 5432
dbname: __DB_NAME__

View file

@ -1,5 +1,4 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
location / {
# Force usage of https
if ($scheme = http) {
@ -20,7 +19,3 @@ location __PATH__/ {
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
location __PATH__/embed/ {
more_set_headers "X-Frame-Options : ALLOWALL";
}

View file

@ -1,4 +1,3 @@
[Unit]
Description=Invidious (An alternative YouTube front-end)
After=syslog.target

View file

@ -30,16 +30,6 @@
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Invidious",
"fr": "Choisissez un chemin pour Invidious"
},
"example": "/",
"default": "/"
},
{
"name": "is_public",
"type": "boolean",

View file

@ -13,6 +13,4 @@
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/invidious_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/invidious_ynh%20PR-NUM-%20(USERNAME)/)
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -78,14 +78,9 @@ ynh_install_extra_app_dependencies --repo="deb https://dist.crystal-lang.org/apt
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
@ -125,9 +120,9 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Building Invidious.. (this will take some time and resources!)" --weight=10
pushd "$final_path" || ynh_die
pushd $final_path || ynh_die
shards update && shards install
crystal build $final_path/src/invidious.cr --release
crystal build src/invidious.cr --release
popd || ynh_die
#=================================================
@ -135,15 +130,7 @@ popd || ynh_die
#=================================================
ynh_script_progression --message="Modifying a config file..."
cp ../conf/config.yml "$final_path/config/config.yml"
# Main config File
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.yml"
#ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.yml"
ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
ynh_store_file_checksum --file="$final_path/config/config.yml"
#=================================================
@ -151,9 +138,6 @@ ynh_store_file_checksum --file="$final_path/config/config.yml"
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
ynh_add_systemd_config
#=================================================
@ -161,8 +145,7 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Setuping a cron..." --weight=1
cp ../conf/cron_invidious /etc/cron.d/$app
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
#=================================================
# SETUP LOGROTATE
@ -180,7 +163,7 @@ ynh_use_logrotate
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files
chown -R $app: "$final_path"
chown -R $app: $final_path
chmod 0644 /etc/logrotate.d/$app
#=================================================
@ -196,17 +179,17 @@ yunohost service add $app --description="Invidious is an alternative front-end t
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name=$app --action=start --log_path="systemd"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -65,7 +65,7 @@ ynh_remove_app_dependencies
ynh_script_progression --message="Removing Invidious main directory..." --weight=6
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file=$final_path
#=================================================
# REMOVE NGINX CONFIGURATION

View file

@ -31,7 +31,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -57,7 +57,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Restoring Invidious main directory..." --weight=4
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path=$final_path
#=================================================
# RECREATE THE DEDICATED USER
@ -73,7 +73,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: "$final_path"
chown -R $app: $final_path
#=================================================
# SPECIFIC RESTORATION
@ -114,7 +114,7 @@ yunohost service add $app --description="Invidious is an alternative front-end t
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name=$app --action=start --log_path="systemd"
#=================================================
# RESTORE VARIOUS FILES

View file

@ -24,12 +24,11 @@ port=$(ynh_app_setting_get --app=$app --key=port)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -54,7 +53,7 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
#=================================================
# UPGRADE DEPENDENCIES
@ -79,7 +78,7 @@ then
git clone https://github.com/iv-org/invidious "$final_path" --quiet
pushd "$final_path" || ynh_die
shards update && shards install
crystal build $final_path/src/invidious.cr --release
crystal build src/invidious.cr --release
popd || ynh_die
fi
@ -104,15 +103,7 @@ ynh_system_user_create --username=$app
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=3
cp ../conf/config.yml "$final_path/config/config.yml"
# Main config File
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.yml"
#ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/config.yml"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.yml"
ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
ynh_store_file_checksum --file="$final_path/config/config.yml"
#=================================================
@ -120,9 +111,6 @@ ynh_store_file_checksum --file="$final_path/config/config.yml"
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
@ -157,7 +145,7 @@ yunohost service add $app --description="Invidious is an alternative front-end t
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
ynh_systemd_action --service_name=$app --action=restart --log_path="systemd"
#=================================================
# RELOAD NGINX