jellyfin / jellyfin-webos

WebOS Client for Jellyfin
https://jellyfin.org
Mozilla Public License 2.0
651 stars 68 forks source link

Jellyfin 1.0.1 @65UJ6309 (rooted) - Blank screen after connect #74

Closed DpunktKpunkt closed 2 years ago

DpunktKpunkt commented 2 years ago

I just rooted a LG 65UJ6309 (FW 6.00.20, WebOS core 3.9.0-62906). Homebrew channel works and ssh connect is possible. CA Certificates renewed with script from https://github.com/tf318/lg

Jellyfin Server 10.7.7 is behind nginx reverse proxy. Access from other devices (Android, Fire TV Stick, other LG TV (65UK6400)) without any problems.

After installing jellyfin 1.0.1 and entering my server URL (https://jellyfin.formyeyesonly.tld, public url with Lets Encrypt Certificate). I also checked the autoconnect box and clicked on connect.

Screen went black and stayed black. Rebooting and restarting jellyfin showed just the logo for a few seconds, then for a fraction of a second the connect screen was visible and then the screen went black.

Nginx log shows three requests:

X.X.Y.Z - - [15/Jan/2022:19:31:08 +0100] "GET /System/Info/Public HTTP/1.1" 200 234 "-" "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 WebAppManager"
X.X.Y.Z - - [15/Jan/2022:19:31:08 +0100] "GET /web/manifest.json HTTP/1.1" 200 304 "-" "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 WebAppManager"
X.X.Y.Z - - [15/Jan/2022:19:31:09 +0100] "GET /web/index.html HTTP/1.1" 200 1506 "-" "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 WebAppManager"

As I checked the autoconnect checkbox it isn't possible for me to intercept the connect attempt any longer.

anthonylavado commented 2 years ago

While I don't have a direct answer for the black screen issue at the moment, the LG Developer docs say that uninstalling and re-installing an app should clear local storage (which is where we save the server info).

Are you able to try removing and reinstalling?

DpunktKpunkt commented 2 years ago

This tv isn't mine - I'll check it next week. If that doesn't work, I will inject a wrong id into /System/Info/Public - auto_connect flag should be set to false that way: https://github.com/jellyfin/jellyfin-webos/blob/master/frontend/js/index.js#L277

DpunktKpunkt commented 2 years ago

Two ideas for that issue of providing a method to reset server connection (https://github.com/jellyfin/jellyfin-webos/issues/69):

DpunktKpunkt commented 2 years ago

Are you able to try removing and reinstalling?

I just tried it on my own tv (65UK6400, WebOS 4, FW 5.40.09) - local storage is deleted when app is uninstalled. That would be the most elegant way for others with an client side issue.

Hint for uninstalling jellyfin: Neither homebrew channel nor LG Content/My Apps (jellyfin isn't listed here) provide a way of uninstalling the app - just press home button, then the edit entry (most right icon), select jellyfin and press key up. Delete the app by the appearing "x".

DpunktKpunkt commented 2 years ago

Seems that jellyfin on LG TVs either has some problem with nginx reverse proxy or ssl. My other LG TV connects to jellyfin docker directly (http, port 8096). When I'm changing server to public url the same error occurs. (Tested with Lets Encrypt cert and ZeroSSL cert, so that's probably not the issue).

Other external devices using public url (Android tablet, iPad, Fire TV Stick, notebooks connecting via browser) connect without any issues.

Here my nginx config (almost the same as in jellyfin documentation) nginx-conf.txt

anthonylavado commented 2 years ago

It's a bit of a mess but there's bound to be information in here: https://github.com/jellyfin/jellyfin-webos/issues/43

The short of it is that there could be a cipher config issue that is not letting your webOS 4 TV to connect.

DpunktKpunkt commented 2 years ago

Even though my TV successfully requested /System/Info/Public, /web/manifest.json and /web/index.html?

I will check my cipher suite later that day.

DpunktKpunkt commented 2 years ago

Increasing allowed ciphers according to #43 didn't help. I then completely disabled https and set up reverse proxy behind http://jellyfin.myserver.tld - same strange effect. 3 successful requests from tv to nginx and screen stays black. Switching directly to jellyfin ip (http://:8096, autodiscovered) helps (at least for my tv in local network).

Next I will set up a fresh test nginx or haproxy as reverse proxy to jellyfin - obviously my existing nginx is somewhat misconfigured.

DpunktKpunkt commented 2 years ago

My test progress until now:

Access from computer to http://10.12.1.2:11180 (my listening port in that container) works Access from 65UK6400 (WebOS 4) to http://10.12.1.2:11180 - just the 3 files from first post are successfully requested (http code 200), screen stays black, no loading indicator is shown

Maybe my jellyfin container is messed up and struggles with proxy (will be the next test scenario)

DpunktKpunkt commented 2 years ago

Fresh nginx container (bitnami/nginx:latest), fresh jellyfin container (jellyfin/jellyfin:latest):

docker create \
  --name=nginx-test \
  -v /somedirectory/nginx-test/my_server_block.conf:/opt/bitnami/nginx/conf/server_blocks/my_server_block.conf:ro \
  --restart unless-stopped \
  --network docker-vlan12 \
  --ip 10.12.1.2 \
  bitnami/nginx:latest

docker create \
  --name=jellyfin-test \
  -v /somedirectory/jellyfin-test/config:/config \
  -v /somedirectory/jellyfin-test/cache:/cache \
  --restart unless-stopped \
  --network docker-vlan12 \
  --ip 10.12.1.3 \
  jellyfin/jellyfin:latest

my_server_block.conf (proxy entries copied from jellyfin documentation):

server {
    listen 11180;
    server_name 10.12.1.2;

    access_log /opt/bitnami/nginx/logs/jellyfin_access.log;
    error_log /opt/bitnami/nginx/logs/jellyfin-error.log;

    set $jellyfin 10.12.1.3;

    location / {
        # Proxy main Jellyfin traffic
        proxy_pass http://$jellyfin:8096;
        proxy_set_header Host $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-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;

        # Disable buffering when the nginx proxy gets very resource heavy upon streaming
        proxy_buffering off;
    }

    # location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/
    location = /web/ {
        # Proxy main Jellyfin traffic
        proxy_pass http://$jellyfin:8096/web/index.html;
        proxy_set_header Host $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-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
    }

    location /socket {
        # Proxy Jellyfin Websockets traffic
        proxy_pass http://$jellyfin:8096/socket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $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-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
    }
}

Jellyfin initial setup done on computer. No plugins, media directories, ... just a plain fresh installed jellyfin.

Accessing jellyfin on computer: http://10.12.1.2:11180 and http://10.12.1.3:8096 is working Accessing jellyfin on tv: http://10.12.1.3:8096 is working, http://10.12.1.2:11180 is not working (tv requesting those 3 files, screen black, no loading indicator, tested with 65UK6400, FW 5.40.09, WebOS 4.4.0-9, rooted, jellyfin.ipk 1.0.1)

DpunktKpunkt commented 2 years ago

Same behavior with webOS TV Emulator 4.00 and jellyfin 1.0.1 ipk. Server ip address http://10.12.1.2:11180 (nginx reverse proxy) with black screen in emulator, server address http://10.12.1.3:8096 shows login screen for user.

DpunktKpunkt commented 2 years ago

I finally got the solution - at least for my test setup

Wireshark with emulator showed that nginx added directive X-Frame-Options: SAMEORIGIN. This won't work for proxied jellyfin.

Either overwrite this directive for server entry with add_header Access-Control-Allow-Origin "*" always; or something more restrictive for the specific network environment.

Update:

Got it working on my TVs, too. X-Frame-Options was also the problem here.