diff --git a/conf/nginx.conf b/conf/nginx.conf index 8547557..640b52f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,3 +19,23 @@ location / { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location __PATH__/embed/ { + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + proxy_pass http://127.0.0.1:3000/embed/; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + more_set_headers "X-Frame-Options : ALLOWALL"; +} diff --git a/manifest.json b/manifest.json index 7991f2d..9c6cf12 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Alternative front-end to YouTube", "fr": "Front-end alternatif à YouTube" }, - "version": "0.20.1~ynh3", + "version": "0.20.1~ynh5", "url": "https://invidio.us/", "license": "GPL-3.0-only", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index eddc170..8f6e28d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin libsqlite3-dev zlib1g-dev" +pkg_dependencies="crystal apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin libsqlite3-dev zlib1g-dev" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index b185512..a7a276c 100644 --- a/scripts/install +++ b/scripts/install @@ -46,10 +46,9 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= 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=is_public --value=$is_public -ynh_app_setting_set --app=$app --key=language --value=$language +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 #================================================= # STANDARD MODIFICATIONS @@ -67,10 +66,10 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=9 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61 +ynh_install_extra_repo --repo="deb https://dl.bintray.com/crystal/deb all stable" --append -# Install Crystal -ynh_install_extra_app_dependencies --repo="deb https://dist.crystal-lang.org/apt crystal main" --package="crystal" --key="https://keybase.io/crystal/pgp_keys.asc" +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE @@ -180,7 +179,7 @@ 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 diff --git a/scripts/restore b/scripts/restore index 8106b47..ff949a9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,6 +82,9 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +ynh_exec_warn_less apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61 +ynh_install_extra_repo --repo="deb https://dl.bintray.com/crystal/deb all stable" --append + # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies @@ -114,7 +117,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 9d8c320..011fd15 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) language=$(ynh_app_setting_get --app=$app --key=language) @@ -53,17 +52,17 @@ 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 #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=8 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61 +ynh_install_extra_repo --repo="deb https://dl.bintray.com/crystal/deb all stable" --append -# Install Crystal -ynh_install_extra_app_dependencies --repo="deb https://dist.crystal-lang.org/apt crystal main" --package="crystal" --key="https://keybase.io/crystal/pgp_keys.asc" +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -114,7 +113,10 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Modifying a config file..." --weight=3 +ynh_backup_if_checksum_is_different --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" #================================================= @@ -156,7 +158,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