fix: player connectivity and media download pipeline
- nginx: add /api/ shortcut block (no portal auth, X-Script-Name /digiserver, Host $http_host) so players can reach DigiServer API without /digiserver prefix - nginx: use $http_host in /api/ block so Flask host_url includes port — fixes media download URLs missing :8080 (was http://ip/digiserver/... not http://ip:8080/...) - player main.py: fix double-port bug when server_ip already contains a port (e.g. 192.168.0.230:8080 was producing http://192.168.0.230:8080:80) - get_playlists_v2.py: force re-sync when server version differs OR local media files are missing on disk — fixes stale playlist after server reset - digiserver api.py: playlist endpoint builds full media URLs using script_root from X-Script-Name header set by nginx - weblink support, player build/deploy improvements, manage-playlist AJAX prefix fix
This commit is contained in:
+33
-1
@@ -112,7 +112,7 @@ fi
|
||||
# ── Generate runtime nginx config ────────────────────────────────────────────
|
||||
NGINX_CONF="$ROOT/nginx/.dev-nginx.conf"
|
||||
NGINX_LOGS="$ROOT/.dev-logs/nginx"
|
||||
mkdir -p "$NGINX_LOGS"
|
||||
mkdir -p "$NGINX_LOGS" "$NGINX_LOGS/body" "$NGINX_LOGS/proxy" "$NGINX_LOGS/fastcgi" "$NGINX_LOGS/scgi" "$NGINX_LOGS/uwsgi"
|
||||
|
||||
info "Writing nginx config → $NGINX_CONF"
|
||||
cat > "$NGINX_CONF" <<NGINXEOF
|
||||
@@ -128,6 +128,17 @@ http {
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# Run as an unprivileged user, so buffer request bodies / proxy temp files
|
||||
# in a user-writable location instead of the root-owned /var/lib/nginx defaults.
|
||||
client_body_temp_path $NGINX_LOGS/body;
|
||||
proxy_temp_path $NGINX_LOGS/proxy;
|
||||
fastcgi_temp_path $NGINX_LOGS/fastcgi;
|
||||
scgi_temp_path $NGINX_LOGS/scgi;
|
||||
uwsgi_temp_path $NGINX_LOGS/uwsgi;
|
||||
|
||||
# Allow large media uploads by default (overridden per-location as needed).
|
||||
client_max_body_size 2048M;
|
||||
|
||||
access_log $NGINX_LOGS/access.log;
|
||||
|
||||
limit_req_zone \$binary_remote_addr zone=login:10m rate=10r/m;
|
||||
@@ -144,6 +155,8 @@ http {
|
||||
|
||||
location = /portal-verify {
|
||||
internal;
|
||||
# Don't reject large upload bodies in the auth subrequest (body isn't forwarded).
|
||||
client_max_body_size 2048M;
|
||||
proxy_pass http://portal_upstream/api/verify-token;
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
@@ -167,6 +180,25 @@ http {
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# DigiServer — player API shortcut (no portal auth, no prefix)
|
||||
# X-Script-Name tells Flask its script_root so media URLs in playlist
|
||||
# responses are built as /digiserver/static/uploads/... (routable by nginx).
|
||||
location /api/ {
|
||||
proxy_pass http://digiserver_upstream/api/;
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_set_header X-Script-Name /digiserver;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
client_max_body_size 256M;
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
|
||||
# DigiServer — player API (no portal auth)
|
||||
location /digiserver/api/ {
|
||||
proxy_pass http://digiserver_upstream/api/;
|
||||
|
||||
Reference in New Issue
Block a user