From 84818c2bac1c3e1ba3f50f8d6fcf429a5a4067fc Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 11 Dec 2024 02:27:49 +0100 Subject: [PATCH] Refactor jellyfin nginx config --- .../docker/services/jellyfin/main.fish | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/Common/Software/docker/services/jellyfin/main.fish b/scripts/Common/Software/docker/services/jellyfin/main.fish index 0a82a54a..32bc8b31 100755 --- a/scripts/Common/Software/docker/services/jellyfin/main.fish +++ b/scripts/Common/Software/docker/services/jellyfin/main.fish @@ -83,6 +83,7 @@ begin "$_flag_name" / "" ( for app in $servarr printf "%s\n" "$app" "/$app" "" + printf "%s\n" "$app" "/$app/signalr" "" end) \ flood "/flood/" end @@ -107,22 +108,29 @@ begin 'return 302 $scheme://$host$uri/$is_args$args;' \ "}" else - getServiceDefaultProxy $argv --path "$location" + getServiceDefaultProxy $argv end end - function getExtraLocationSettings -a domain s location -V service + function getExtraLocationSettings -a domain s location -V service -V servarr + set -l wsConfig ( + printf "%s\n" \ + '# Websocket' \ + "proxy_http_version 1.1;" \ + 'proxy_set_header Upgrade $http_upgrade;' \ + 'proxy_set_header Connection "upgrade";') + if [ "$s" = "$service" ] if [ "$location" = / ] printf "%s\n" \ "# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \ "proxy_buffering off;" else if [ "$location" = /socket ] - printf "%s\n" \ - '# Websocket' \ - "proxy_http_version 1.1;" \ - 'proxy_set_header Upgrade $http_upgrade;' \ - 'proxy_set_header Connection "upgrade";' + echo "$wsConfig" + end + else if contains "$s" $servarr + if string match --regex ".*/signalr^" "$location" >/dev/null + echo "$wsConfig" end end end