From 28cbd202d304770bbaf21a3eb16e033e6c01379f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Feb 2021 15:53:02 +0100 Subject: [PATCH] fix --- conf/config.yml | 2 +- conf/nginx.conf | 7 +------ conf/systemd.service | 1 - manifest.json | 10 ---------- pull_request_template.md | 4 +--- scripts/install | 35 +++++++++-------------------------- scripts/remove | 2 +- scripts/restore | 8 ++++---- scripts/upgrade | 22 +++++----------------- 9 files changed, 22 insertions(+), 69 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index f24ddda..ba89482 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -3,7 +3,7 @@ feed_threads: 1 db: user: __DB_NAME__ - password: __DB_PASS__ + password: __DB_PWD__ host: localhost port: 5432 dbname: __DB_NAME__ diff --git a/conf/nginx.conf b/conf/nginx.conf index 867b484..8547557 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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"; -} diff --git a/conf/systemd.service b/conf/systemd.service index a54b01c..aeb78f0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,4 +1,3 @@ - [Unit] Description=Invidious (An alternative YouTube front-end) After=syslog.target diff --git a/manifest.json b/manifest.json index a8fdf0b..7991f2d 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/pull_request_template.md b/pull_request_template.md index 8f1777a..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -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!"* diff --git a/scripts/install b/scripts/install index c828128..bd66408 100644 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/remove b/scripts/remove index f04ba85..67bccee 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 65fc421..8106b47 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 775a170..896e70d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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