diff --git a/check_process b/check_process index 1bcf34f..1786d8e 100644 --- a/check_process +++ b/check_process @@ -22,7 +22,7 @@ multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # incorrect_path=1 - port_already_use=1 + port_already_use=0 change_url=0 ;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. diff --git a/conf/app.src b/conf/app.src index e553737..1a8d36b 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.4.1/peertube-v1.4.1.tar.xz -SOURCE_SUM=49da83b9143ac4a6a486eff7b726830923022a97c6a692722bda20044fe6cd70 +SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v2.0.0/peertube-v2.0.0.tar.xz +SOURCE_SUM=5a9e7b5f7ca8ee191060427e193a2182a56e86d5946094ebbc905a07b9b6b703 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx_regen_conf.hook b/conf/nginx_regen_conf.hook new file mode 100644 index 0000000..0d9bce9 --- /dev/null +++ b/conf/nginx_regen_conf.hook @@ -0,0 +1,7 @@ +#!/bin/bash + +pending_conf=$4 +if [[ "$1" == "pre" ]] +then + sed --in-place "s/X-Frame-Options : SAMEORIGIN/X-Frame-Options : ALLOWALL/g" "${pending_conf}/../nginx/etc/nginx/conf.d/__DOMAIN__.conf" +fi diff --git a/conf/production.yaml b/conf/production.yaml index 52e9c12..c2d7a0f 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -223,8 +223,7 @@ transcoding: 720p: false 1080p: false 2160p: false - # /!\ EXPERIMENTAL /!\ - # /!\ Requires ffmpeg >= 4 + # /!\ Requires ffmpeg >= 4.1 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: # * Resolution change is smoother # * Faster playback in particular with long videos diff --git a/manifest.json b/manifest.json index 2e7004e..ff8fafc 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" }, - "version": "1.4.1~ynh1", + "version": "2.0.0~ynh1", "url": "https://github.com/Chocobozzz/PeerTube", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/backup b/scripts/backup index 48d6c9c..40f3993 100644 --- a/scripts/backup +++ b/scripts/backup @@ -63,6 +63,13 @@ ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP HOOK +#================================================= +ynh_print_info --message="Backing up hook configuration..." + +ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" + #================================================= # BACKUP LOGROTATE #================================================= diff --git a/scripts/install b/scripts/install index 135fd28..41bac91 100644 --- a/scripts/install +++ b/scripts/install @@ -125,7 +125,7 @@ ynh_add_nginx_config ynh_print_info --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC SETUP @@ -156,13 +156,15 @@ ynh_replace_string --match_string="__EMAIL__" --replace_string="$admin_email" -- ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/production.yaml" #Create the admin settings file -touch "$final_path/config/local-production.json" +cp ../conf/local-production.json "$final_path/config/local-production.json" #================================================= # FIX NGINX DOMAIN CONFIGURATION #================================================= -ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf" +cp -R ../conf/nginx_regen_conf.hook /usr/share/yunohost/hooks/conf_regen/15-nginx_$app +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" +yunohost tools regen-conf nginx #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE @@ -179,7 +181,8 @@ ynh_store_file_checksum --file="$final_path/config/local-production.json" chown -R "$app":"$app" $final_path pushd "$final_path" - #sudo -u $app env PATH=$PATH yarn install --production --pure-lockfile + ynh_use_nodejs + sudo -u $app env PATH=$PATH yarn install --production --pure-lockfile popd #================================================= @@ -219,7 +222,7 @@ yunohost service add $app --description "$app daemon for Peertube" --log "/home/ #================================================= ynh_print_info --message="Starting a systemd service..." -#ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server listening on localhost" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server listening on localhost" #================================================= # SETUP SSOWAT @@ -246,7 +249,7 @@ ynh_systemd_action --service_name=nginx --action=reload # we need to wait for the service to init peertube's database pushd "$final_path" - #echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run reset-password -- -u root + echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run reset-password -- -u root popd #================================================= diff --git a/scripts/remove b/scripts/remove index 5b44809..df5dca4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -102,7 +102,8 @@ fi # RESTORE ORIGINAL NGINX DOMAIN CONFIGURATION #================================================= -ynh_replace_string --match_string="X-Frame-Options : ALLOWALL" --replace_string="X-Frame-Options : SAMEORIGIN" --target_file="/etc/nginx/conf.d/$domain.conf" +ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" +yunohost tools regen-conf nginx #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index e381ca5..927db52 100644 --- a/scripts/restore +++ b/scripts/restore @@ -66,7 +66,7 @@ ynh_restore_file --origin_path="$final_path" ynh_print_info --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS @@ -105,7 +105,8 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st # FIX NGINX DOMAIN CONFIGURATION #================================================= -ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf" +ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" +yunohost tools regen-conf nginx #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 05b05c4..dd4a4ea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -111,8 +111,15 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" - #Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/production.yaml" "$final_path/config/production.yaml" + #Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/production.yaml" "$final_path/config/production.yaml" + + if [ -s "$tmpdir/local-production.json" ] + then + cp -a "$tmpdir/local-production.json" "$final_path/config/local-production.json" + else + cp ../conf/local-production.json "$final_path/config/local-production.json" + fi if [ -s "$tmpdir/local-production.json" ] then @@ -187,7 +194,9 @@ ynh_store_file_checksum --file="$final_path/config/production.yaml" # FIX NGINX DOMAIN CONFIGURATION #================================================= -ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf" +cp -R ../conf/nginx_regen_conf.hook /usr/share/yunohost/hooks/conf_regen/15-nginx_$app +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" +yunohost tools regen-conf nginx #================================================= # BUILD YARN DEPENDENCIES @@ -196,7 +205,8 @@ ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_strin chown -R "$app":"$app" $final_path pushd "$final_path" - #sudo -u $app env PATH=$PATH yarn install --production --pure-lockfile + ynh_use_nodejs + sudo -u $app env PATH=$PATH yarn install --production --pure-lockfile popd #=================================================