mirror of
https://github.com/YunoHost-Apps/mopidy_ynh.git
synced 2024-09-03 19:46:21 +02:00
Ajout de la conf nginx et suppression de certaines options dans le manifest
This commit is contained in:
parent
43d6e6eb9c
commit
751b36fbf6
4 changed files with 55 additions and 47 deletions
12
conf/nginx.conf
Normal file
12
conf/nginx.conf
Normal file
|
@ -0,0 +1,12 @@
|
|||
location __PATHTOCHANGE__ {
|
||||
alias __FINALPATH__/;
|
||||
index index.php;
|
||||
|
||||
if (!-e $request_filename)
|
||||
{
|
||||
rewrite ^(.+)$ http://__DOMAINNAME__:6680/musicbox_webclient last;
|
||||
}
|
||||
|
||||
#--PRIVATE--# Include SSOWAT user panel.
|
||||
#--PRIVATE--include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
|
@ -40,15 +40,6 @@
|
|||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "is_spotify",
|
||||
"ask": {
|
||||
"en": "You want to use Spotify ?",
|
||||
"fr": "Voulez vous utiliser Spotify ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "No"
|
||||
},
|
||||
{
|
||||
"name": "spotify_user",
|
||||
"type": "user",
|
||||
|
@ -83,15 +74,6 @@
|
|||
"fr": "ID client secret Spotify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "is_soundcloud",
|
||||
"ask": {
|
||||
"en": "You want to use Soundcloud ?",
|
||||
"fr": "Voulez vous utiliser Soundcloud ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "No"
|
||||
},
|
||||
{
|
||||
"name": "soundcloud_id",
|
||||
"type": "id",
|
||||
|
|
|
@ -49,4 +49,13 @@ CHECK_USER () { # Vérifie la validité de l'user admin
|
|||
|
||||
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
}
|
||||
|
||||
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
final_path=/var/lib/mopidy/www
|
||||
if [ -e "$final_path" ]
|
||||
then
|
||||
echo "This path already contains a folder" >&2
|
||||
false
|
||||
fi
|
||||
}
|
|
@ -8,20 +8,13 @@ source .fonctions # Charge les fonctions génériques habituellement utilisées
|
|||
TRAP_ON # Active trap pour arrêter le script si une erreur est détectée.
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin_mopidy=$YNH_APP_ARG_ADMIN_MOPIDY
|
||||
|
||||
if [ "$is_spotify" = "Yes" ];
|
||||
then
|
||||
spotify_user=$YNH_APP_ARG_SPOTIFY_USER
|
||||
spotify_pass=$YNH_APP_ARG_SPOTIFY_PASS
|
||||
spotify_id=$YNH_APP_ARG_SPOTIFY_ID
|
||||
spotify_id_secret=$YNH_APP_ARG_SPOTIFY_ID_SECRET
|
||||
fi
|
||||
|
||||
if [ "$is_soundcloud" = "Yes" ];
|
||||
then
|
||||
soundcloud_id=$YNH_APP_ARG_SOUNDCLOUD_ID
|
||||
fi
|
||||
spotify_user=$YNH_APP_ARG_SPOTIFY_USER
|
||||
spotify_pass=$YNH_APP_ARG_SPOTIFY_PASS
|
||||
spotify_id=$YNH_APP_ARG_SPOTIFY_ID
|
||||
spotify_id_secret=$YNH_APP_ARG_SPOTIFY_ID_SECRET
|
||||
soundcloud_id=$YNH_APP_ARG_SOUNDCLOUD_ID
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -34,21 +27,16 @@ CHECK_USER "$admin_mopidy"
|
|||
|
||||
# CHECK_DOMAINPATH
|
||||
|
||||
CHECK_FINALPATH
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path
|
||||
ynh_app_setting_set $app admin $admin_mopidy
|
||||
|
||||
if [ "$is_spotify" = "Yes" ];
|
||||
then
|
||||
ynh_app_setting_set $app spotify_user $spotify_user
|
||||
ynh_app_setting_set $app spotify_pass $spotify_pass
|
||||
ynh_app_setting_set $app spotify_id $spotify_id
|
||||
ynh_app_setting_set $app spotify_id_secret $spotify_id_secret
|
||||
fi
|
||||
|
||||
if [ "$is_soundcloud" = "Yes" ];
|
||||
then
|
||||
ynh_app_setting_set $app soundcloud_id $soundcloud_id
|
||||
fi
|
||||
ynh_app_setting_set $app spotify_user $spotify_user
|
||||
ynh_app_setting_set $app spotify_pass $spotify_pass
|
||||
ynh_app_setting_set $app spotify_id $spotify_id
|
||||
ynh_app_setting_set $app spotify_id_secret $spotify_id_secret
|
||||
ynh_app_setting_set $app soundcloud_id $soundcloud_id
|
||||
|
||||
# Add the archive’s GPG key:
|
||||
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
|
||||
|
@ -65,7 +53,7 @@ sudo rm -fr /root/.config/mopidy/
|
|||
ip_local=$(echo hostname -I | awk '{ print $1 }')
|
||||
sudo sed -i "s@__IPLOCAL__@$ip_local@g" ../conf/mopidy.conf
|
||||
|
||||
if [ "$is_spotify" = "Yes" ];
|
||||
if [ -n "$spotify_user" ];
|
||||
then
|
||||
sudo sed -i '/[spotify]/r enabled = true' ../conf/mopidy.conf
|
||||
sudo sed -i "s@__USER_SPOTIFY__@$spotify_user@g" ../conf/mopidy.conf
|
||||
|
@ -79,7 +67,7 @@ else
|
|||
sudo sed -i "s@__SECRET_SPOTIFY__@@g" ../conf/mopidy.conf
|
||||
fi
|
||||
|
||||
if [ "$is_soundcloud" = "Yes" ];
|
||||
if [ -n "$soundcloud_id" ];
|
||||
then
|
||||
sudo sed -i "s@__SOUNDCLOUD__@$soundcloud_id@g" ../conf/mopidy.conf
|
||||
else
|
||||
|
@ -103,4 +91,21 @@ sudo rm -fr mopidy-musicbox-webclient
|
|||
|
||||
# Allow port
|
||||
sudo yunohost firewall allow TCP 6600
|
||||
sudo yunohost firewall allow TCP 6680
|
||||
sudo yunohost firewall allow TCP 6680
|
||||
|
||||
# Copy config nginx
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Change file configuration for nginx
|
||||
sudo sed -i "s@__PATHTOCHANGE__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo sed -i "s@__DOMAINNAME__@$domain@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Access public for curl
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
|
||||
# Reload SSOwat configuration
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
Loading…
Add table
Reference in a new issue