diff --git a/README.md b/README.md
index 599b5ba..236647a 100644
--- a/README.md
+++ b/README.md
@@ -42,22 +42,25 @@ Servers are run independently by different people and organizations. They can ap
By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users.
-* Any known limitations, constrains or stuff not working, such as (but not limited to):
- * Require **dedicated domain** like **peertube.domain.tld**.
- * Admin username is: **root**.
- * **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation.
- * URL can not be changed once selected. Choose the domain wisely.
- * You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**.
+### IMPORTANT POINT TO READ BEFORE INSTALLING
+* Require **dedicated domain** like **peertube.domain.tld**.
+* Admin username is: **root**.
+* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation.
+* URL can not be changed once selected. Choose the domain wisely.
+* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**.
$ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile
$ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
- * This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server)
- * **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
- * LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation.
- * HTTP auth is not supported
+* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server)
+* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
+* HTTP auth is not supported
+
+### PLUGINS
+* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation.
+* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page
## Documentation and resources
diff --git a/README_fr.md b/README_fr.md
index ebc54c4..d998376 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -24,11 +24,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren
## Avertissements / informations importantes
-## Vue d'ensemble
-
-### Qu'est-ce que PeerTube ?
-PeerTube est une plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent .
-
### Pourquoi PeerTube?
Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur.
@@ -41,29 +36,25 @@ Les serveurs sont gérés indépendamment par différentes personnes et organisa
En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous-même un diffuseur de la vidéo. Chaque instance n'a pas besoin de beaucoup d'argent pour diffuser les vidéos de ses utilisateurs.
-## Points importants à lire avant l'installation
-
-1. Nécessite un **domaine dédié** comme **peertube.domain.tld**.
-1. Le nom d'utilisateur de l'administrateur est: **root**.
-1. **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation.
-1. L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine.
-1. Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**.
-
+### Points importants à lire avant l'installation
+* Nécessite un **domaine dédié** comme **peertube.domain.tld**.
+* Le nom d'utilisateur de l'administrateur est: **root**.
+* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation.
+* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine.
+* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**.
$ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile
$ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
-1. Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost)
-1. **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
+* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost)
+* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
-## Caractéristiques spécifiques YunoHost
-
-#### Support multi-utilisateur
+#### PLUGINS
* L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation
-* L'authentification HTTP n'est pas prise en charge
+* le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube.
## Documentations et ressources
diff --git a/check_process b/check_process
index 08c4b32..68a1f9d 100644
--- a/check_process
+++ b/check_process
@@ -13,13 +13,13 @@
setup_public=1
upgrade=1
# 3.2.1~ynh1
- upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
+ # upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
# 3.2.1~ynh4
- upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44
+ # upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44
# 3.3.0~ynh2
- upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651
+ # upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651
# 3.3.0~ynh3
- upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0
+ # upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0
# 3.4.0~ynh1
upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79
# 4.0.0~ynh1
diff --git a/conf/production.yaml b/conf/production.yaml
index 275c91f..3910e55 100644
--- a/conf/production.yaml
+++ b/conf/production.yaml
@@ -88,7 +88,7 @@ storage:
videos: '__DATADIR__/videos/'
streaming_playlists: '__DATADIR__/streaming-playlists/'
redundancy: '__DATADIR__/redundancy/'
- logs: '__DATADIR__/logs/'
+ logs: '/var/log/__APP__/'
previews: '__DATADIR__/previews/'
thumbnails: '__DATADIR__/thumbnails/'
torrents: '__DATADIR__/torrents/'
diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md
index f7d823e..a1c7156 100644
--- a/doc/DISCLAIMER.md
+++ b/doc/DISCLAIMER.md
@@ -12,19 +12,22 @@ Servers are run independently by different people and organizations. They can ap
By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users.
-* Any known limitations, constrains or stuff not working, such as (but not limited to):
- * Require **dedicated domain** like **peertube.domain.tld**.
- * Admin username is: **root**.
- * **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation.
- * URL can not be changed once selected. Choose the domain wisely.
- * You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**.
+### IMPORTANT POINT TO READ BEFORE INSTALLING
+* Require **dedicated domain** like **peertube.domain.tld**.
+* Admin username is: **root**.
+* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation.
+* URL can not be changed once selected. Choose the domain wisely.
+* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**.
$ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile
$ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
- * This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server)
- * **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
- * LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation.
- * HTTP auth is not supported
+* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server)
+* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
+* HTTP auth is not supported
+
+### PLUGINS
+* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation.
+* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page
diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md
index acc6ba9..9d0fe38 100644
--- a/doc/DISCLAIMER_fr.md
+++ b/doc/DISCLAIMER_fr.md
@@ -1,8 +1,3 @@
-## Vue d'ensemble
-
-### Qu'est-ce que PeerTube ?
-PeerTube est une plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent .
-
### Pourquoi PeerTube?
Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur.
@@ -15,26 +10,22 @@ Les serveurs sont gérés indépendamment par différentes personnes et organisa
En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous-même un diffuseur de la vidéo. Chaque instance n'a pas besoin de beaucoup d'argent pour diffuser les vidéos de ses utilisateurs.
-## Points importants à lire avant l'installation
-
-1. Nécessite un **domaine dédié** comme **peertube.domain.tld**.
-1. Le nom d'utilisateur de l'administrateur est: **root**.
-1. **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation.
-1. L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine.
-1. Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**.
-
+### Points importants à lire avant l'installation
+* Nécessite un **domaine dédié** comme **peertube.domain.tld**.
+* Le nom d'utilisateur de l'administrateur est: **root**.
+* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation.
+* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine.
+* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**.
$ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile
$ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
-1. Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost)
-1. **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
+* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost)
+* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
-## Caractéristiques spécifiques YunoHost
-
-#### Support multi-utilisateur
+#### PLUGINS
* L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation
-* L'authentification HTTP n'est pas prise en charge
+* le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube.
diff --git a/scripts/install b/scripts/install
index 0bd23d1..c0e23e8 100644
--- a/scripts/install
+++ b/scripts/install
@@ -55,7 +55,6 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=admin --value=$admin
-ynh_app_setting_set --app=$app --key=datadir --value=$datadir
#=================================================
# STANDARD MODIFICATIONS
@@ -91,6 +90,17 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
+if ! yunohost app list | grep -q "prosody"
+then
+ yunohost tools update
+ yunohost app install prosody
+else
+ yunohost tools update
+ yunohost app upgrade prosody
+fi
+
+ynh_app_setting_set --app=$app --key=require_prosody --value="1"
+
#=================================================
# CREATE DEDICATED USER
#=================================================
@@ -152,11 +162,13 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Creating a data directory..."
+ynh_app_setting_set --app=$app --key=datadir --value=$datadir
+
mkdir -p $datadir
-chmod 750 "$datadir/.."
-chmod -R o-rwx "$datadir/.."
-chown -R $app:www-data "$datadir/.."
+chmod 750 "$datadir"
+chmod -R o-rwx "$datadir"
+chown -R $app:www-data "$datadir"
#=================================================
# BUILD YARN DEPENDENCIES
@@ -165,7 +177,8 @@ ynh_script_progression --message="Building Yarn dependencies..."
pushd "$final_path"
ynh_use_nodejs
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
popd
#=================================================
@@ -196,6 +209,8 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Starting a systemd service..."
+mkdir -p "/var/log/$app"
+chown -R $app:$app "/var/log/$app"
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost"
@@ -205,7 +220,16 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
ynh_script_progression --message="Installing LDAP plugin..."
pushd "$final_path"
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
+popd
+
+#=================================================
+# INSTALL PEERTUBE LIVECHAT PLUGIN
+#=================================================
+ynh_script_progression --message="Installing PeerTube livechat plugin..."
+
+pushd "$final_path"
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
popd
#=================================================
@@ -214,7 +238,7 @@ popd
ynh_script_progression --message="Changing PeerTube admin password..."
pushd "$final_path"
- echo $admin_pass | ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root
+ echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root
popd
#=================================================
@@ -233,14 +257,14 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s)
-ynh_use_logrotate --logfile="$datadir/logs/peertube.log"
+ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
-yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
+yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port
#=================================================
# START SYSTEMD SERVICE
diff --git a/scripts/remove b/scripts/remove
index fc5a63d..e61e3c0 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -110,6 +110,31 @@ ynh_script_progression --message="Removing dependencies..."
ynh_remove_nodejs
ynh_remove_app_dependencies
+# Remove Prosody
+ynh_app_setting_delete --app=$app --key=require_prosody
+
+# List apps requiring Prosody
+installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
+required_by=""
+installed_app_required_by=""
+for installed_app in $installed_apps
+do
+ installed_app_required_by=$(ynh_app_setting_get --app=$installed_app --key="require_prosody")
+ if [[ $installed_app_required_by ]]
+ then
+ required_by="${installed_app_required_by}"
+ fi
+ installed_app_required_by=""
+done
+
+# If Prosody is no more required
+if [[ ! $required_by ]]
+then
+ # Remove Prosody
+ ynh_print_info --message="Removing of Prosody"
+ yunohost app remove prosody --purge
+fi
+
#=================================================
# CLOSE A PORT
#=================================================
@@ -126,6 +151,16 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port
fi
+#=================================================
+# SPECIFIC REMOVE
+#=================================================
+# REMOVE VARIOUS FILES
+#=================================================
+ynh_script_progression --message="Removing various files..."
+
+# Remove the log files
+ynh_secure_remove --file="/var/log/$app"
+
#=================================================
# GENERIC FINALIZATION
#=================================================
diff --git a/scripts/restore b/scripts/restore
index a5050e3..d12ada6 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -60,7 +60,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir=$final_path
+ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
@@ -99,8 +99,16 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
# Install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-# Install Yarn
-ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
+if ! yunohost app list | grep -q "prosody"
+then
+ yunohost tools update
+ yunohost app install prosody
+else
+ yunohost tools update
+ yunohost app upgrade prosody
+fi
+
+ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
@@ -132,6 +140,8 @@ systemctl enable $app.service --quiet
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
+mkdir -p "/var/log/$app"
+chown -R $app:$app "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
@@ -139,7 +149,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
-yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
+yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port
#=================================================
# START SYSTEMD SERVICE
diff --git a/scripts/upgrade b/scripts/upgrade
index 6c956f8..83b35b5 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -139,13 +139,22 @@ if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi
+# Remove hook
+ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
+yunohost tools regen-conf nginx
+
+# Remove old log file
+ynh_secure_remove --file="$datadir/logs"
+mkdir -p "/var/log/$app"
+chown -R $app:$app "/var/log/$app"
+
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir=$final_path
+ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@@ -212,9 +221,16 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
-# Remove hook
-ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
-yunohost tools regen-conf nginx
+if ! yunohost app list | grep -q "prosody"
+then
+ yunohost tools update
+ yunohost app install prosody
+else
+ yunohost tools update
+ yunohost app upgrade prosody
+fi
+
+ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#=================================================
# SPECIFIC UPGRADE
@@ -225,9 +241,9 @@ ynh_script_progression --message="Creating a data directory..."
mkdir -p $datadir
-chmod 750 "$datadir/.."
-chmod -R o-rwx "$datadir/.."
-chown -R $app:www-data "$datadir/.."
+chmod 750 "$datadir"
+chmod -R o-rwx "$datadir"
+chown -R $app:www-data "$datadir"
#=================================================
# UPDATE A CONFIG FILE
@@ -249,7 +265,8 @@ ynh_script_progression --message="Building Yarn dependencies..."
pushd "$final_path"
ynh_use_nodejs
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
popd
#=================================================
@@ -274,7 +291,16 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
ynh_script_progression --message="Installing LDAP plugin..."
pushd "$final_path"
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
+popd
+
+#=================================================
+# INSTALL PEERTUBE LIVECHAT PLUGIN
+#=================================================
+ynh_script_progression --message="Installing PeerTube livechat plugin..."
+
+pushd "$final_path"
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat
popd
#=================================================
@@ -284,7 +310,7 @@ popd
if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then
ynh_script_progression --message="Running Peertube 4.0.0 migration script..."
pushd "$final_path"
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js
popd
fi
@@ -311,7 +337,7 @@ ynh_use_logrotate --non-append
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
-yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port
+yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port
#=================================================
# START SYSTEMD SERVICE