From 13686b70ad588e5f003ef0e8efab29ee05b6deca Mon Sep 17 00:00:00 2001 From: SylvainCecchetto Date: Thu, 19 Oct 2017 13:08:22 +0200 Subject: [PATCH] Fix nginx conf for control web interface in yunohost pannel --- README.md | 17 ++++++++++++----- conf/nginx.conf | 12 +++++------- scripts/install | 22 +++++++++++++++++++--- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0b3e27c..fca5314 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,27 @@ Kodi for YunoHost [![Install Kodi with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kodi) ## Current package status -* The scprit use jessie backports to install Kodi 16 (We have to wait for Debian Strech officialy install Kodi 17) +* The scprit use jessie backports to install Kodi 16 on x86 machines (We have to wait for YunoHost Debian Strech support or use testing source) * A dedicated kodi user is create * Use of systemd * You can launch Kodi with the ```sudo systemctl start kodi``` command or stop Kodi with ```sudo systemctl stop kodi``` * You can choose if you want that Kodi start at YunoHost server statup -* You can access to the control web interface only if you choose a "/" path (Reverse proxy issue) +* You can access to the control web interface from the YunoHost pannel * Kodi directly start after package installation +* Start and stop Kodi from Admin YunoHost services tab ## To do -* Add the control web interface to YunoHost user interface -* Maybe we can launch Kodi from YunoHost web interface instead of SSH +* Test control web interface on Raspberry +* Include SSOWat pannel in nginx.conf +* Switch from skipped_uri to protected_uri and try if it still works +* Add missing elements in remove script +* Add option in manifest to open 8080 port to be able to use Kodi remote smartphone app +* Check if a "/" path still works +* Write the upgrade script ## Links - * Report a bug: Use GitHub issues + * Report a bug: Use GitHub issues or dedicated forum + * YunoHost forum thread: [Kodi package](https://forum.yunohost.org/t/kodi-package-yunohost-as-a-media-center/3561/17) * Kodi website: https://kodi.tv * YunoHost website: https://yunohost.org/ \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 221ad33..1d17164 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,9 @@ -location __PATH__ { - proxy_pass http://127.0.0.1:8080$uri; - rewrite ^ $request_uri; - rewrite ^([^.]*[^/])$ $1/ permanent; - rewrite ^__PATH__(.*) /$1 break; - proxy_redirect http://127.0.0.1:8080 __PATH__; +location __PATH__/ { + rewrite ^__PATH__/jsonrpc(.*) /jsonrpc$uri; + rewrite ^__PATH__/image/(.*) /image/$uri; + proxy_pass http://127.0.0.1:8080/; + proxy_set_header Host $http_host; - proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_set_header Upgrade $http_upgrade; diff --git a/scripts/install b/scripts/install index 42a3abe..d5ee601 100644 --- a/scripts/install +++ b/scripts/install @@ -65,9 +65,10 @@ if [[ $arch != arm* ]]; then fi ynh_package_update if [[ $arch == arm* ]]; then - ynh_package_install xserver-xorg-legacy + ynh_package_install xserver-xorg-legacy xorg dbus-x11 kodi +else + ynh_package_install xorg xinit dbus-x11 kodi fi -ynh_package_install xorg dbus-x11 kodi #================================================= # X11 SETTINGS @@ -84,12 +85,27 @@ yunohost service add $app --log "/home/$app/.kodi/temp/kodi.log" #================================================= # CONTROL WEB INTERFACE #================================================= +if [[ $arch != arm* ]]; then + sudo wget "https://github.com/xbmc/chorus2/releases/download/2.4.4/webinterface.default.2.4.4.zip" -P /tmp + sudo unzip "/tmp/webinterface.default.2.4.4.zip" -d /tmp/ + sudo mkdir -p /home/kodi/.kodi/addons/ + sudo mv /tmp/webinterface.default/ /home/kodi/.kodi/addons/webinterface.chorus2/ +fi sudo mkdir -p /home/$app/.kodi/userdata/ sudo cp ../conf/advancedsettings.xml /home/$app/.kodi/userdata/advancedsettings.xml sudo chown -R $app:$app /home/$app + + +#================================================= +# NGINX +#================================================= ynh_add_nginx_config -ynh_app_setting_set $app protected_uris "/" +ynh_app_setting_set $app skipped_uris "/" +domainregex=$(echo "$domain" | sed 's/-/\%&/g') + +ynh_app_setting_set $app skipped_regex "$domainregex/jsonrpc.*$,$domainregex/image.*$" + # Reload SSOwat config yunohost app ssowatconf