reisxd / TizenTube

A NodeJS script to remove ads and add support for Sponsorblock for your Tizen TV (2017 and forward).
https://tizentube.live
GNU General Public License v3.0
411 stars 35 forks source link

Videos, Thumbnails, Icons Not Loading #7

Closed ameenalasady closed 1 year ago

ameenalasady commented 1 year ago

Hi all,

I’m having trouble getting TizenTube to work on my Samsung TV. Here’s what I’ve done so far:

  1. Enabled developer mode on my TV and set the host IP to my computer’s IP.
  2. Installed Tizen Studio and the appropriate SDK version.
  3. Connected my TV to Tizen Studio, which shows up in the Device Manager.
  4. Created a certificate that works fine.
  5. Loaded the TizenTube code onto Tizen Studio and changed the IP in index.html to my phone’s IP.
  6. Ran both Launcher and TizenTube as Tizen Web Applications and installed them on my TV.
  7. Changed the host IP on my TV to my phone’s IP and restarted the TV.
  8. Downloaded the Android app, set the appid to the one shown in the Device Manager, and changed the IP to my TV’s IP.

At this point, everything seems to be working fine. I can run the server on the Android app and launch TizenTube on my TV. However, when TizenTube opens, nothing loads except for the video titles. There’s also a pop-up that says to press GREEN to open settings, but pressing GREEN on my remote control doesn’t do anything.

I’ve tried restarting everything and using the Node server instead, but I’m still having the same issue. Can anyone help me figure out what I’m doing wrong?

Thanks in advance!

EDIT: Trying the node server with debugging on gives the following logs:

image

I am not too sure why its giving the "config read failed" error.

Here is my config file:

image

reisxd commented 1 year ago

However, when TizenTube opens, nothing loads except for the video titles.

What's your TVs Tizen version/release year?

ameenalasady commented 1 year ago

The model number on the back of the TV says its the UN70TU6985F. It was released in 2021. It is running on Tizen 6.0.

reisxd commented 1 year ago

The model number on the back of the TV says its the UN70TU6985F. It was released in 2021. It is running on Tizen 6.0.

Maybe it was something wrong with YT itself? Could you try again? If not, I'll play around with the configuration of the app.

ameenalasady commented 1 year ago

I just tried again and I'm getting the same issue. The regular YouTube app works just fine on the same TV. Here's what I get: PXL_20230722_061007164.jpg

reisxd commented 1 year ago

Could you run the app in debug mode (from your PC) and share the console logs? Note that you'll either need to use some workaround or an older version of Chrome/Chromium for the debugger.

ameenalasady commented 1 year ago

How can I debug the TizenTube app from Tizen Studio while also running the node server? The node server refuses to connect if sdb is running in the background. I tried debugging the app without having the node server running and here are the console logs (if they are of any use):

www.youtube.com-1690012593136.log

reisxd commented 1 year ago

I don't really know if this is a Tizen issue or the underlying browser issue. But the browser tries to request from about:blank (which is weird due to the app redirecting to https://youtube.com/tv), which makes CORS unhappy.

reisxd commented 1 year ago

So, could you add <tizen:content-security-policy>default-src * data: blob: filesystem: about: ws: wss: 'unsafe-inline' 'unsafe-eval' 'unsafe-dynamic'; script-src * data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src * data: blob: 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src * data: blob: ; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline'; frame-ancestors * data: blob: 'unsafe-inline';</tizen:content-security-policy> after this line? This should allow for anything. Sure, it's vulnerable but it's for testing. If it still doesn't work, please give logs again.

ameenalasady commented 1 year ago

Hi @reisxd. Sorry for the late reply, I was in bed. Adding that line of code to config.xml does allow videos/thumbnails to load. However, opening the TizenTube app on my TV instantly crashes the node server with the following errors:

FetchError: request to http://192.168.2.103:34618/json failed, reason: connect ECONNREFUSED 192.168.2.103:34618
    at ClientRequest.<anonymous> (file:///D:/Downloads/Compressed/TizenTube-main/TizenTube-main/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:527:28)
    at Socket.socketErrorListener (node:_http_client:454:9)
    at Socket.emit (node:events:527:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  erroredSysCall: 'connect'

Once the node server crashes, the navigation on the app turns into a cursor (can not move left or right of the page). Any videos that are opened serve ads too (since the node server crashed).

Trying to debug the app with the config.xml change is giving me problems. The dev tools very quickly disconnect, not giving me a chance to grab the logs. Here's the error that I get. This pops up ~0.5 seconds after running the debugging tool.

image

reisxd commented 1 year ago

Well, that's weird. Could you increase the number here to 10000 and try again?

ameenalasady commented 1 year ago

I still get cursor navigation on TizenTube and get the same error on the node server. Debugging also still does not work for some reason. Commenting out the line you mentioned in config.xml makes debugging work again.

reisxd commented 1 year ago

Could you try changing the config line I've told you to add to <tizen:content-security-policy>font-src *;</tizen:content-security-policy>? This should fix the icons not loading only. Also maybe the issue you're currently having.

ameenalasady commented 1 year ago

Same issue with that line. Cursor navigation on TizenTube with ads. Debugging also does not work. Node disconnects with the same error as previously.

reisxd commented 1 year ago

That is weird. I currently have no idea and I can't really test due to my TV being a Tizen 3 TV.

I do have a theory though. Because we're setting CSP, Tizen automatically loads the app in a browser (which is probably why you see a cursor) and the debugger disconnects right after the browser is loaded. I have to somehow fix this without changing CSP then, I guess.

ameenalasady commented 1 year ago

I am pretty sure the app IS being loaded on the browser with the added config line. I can see the address bar of the browser very briefly when opening the app.

JeoLeaf commented 1 year ago

Hello, I am having the same issue with missing thumbnails and icons too. Running on Tizen 6.5 P.S. Thanks for this project, amazing work so far.

reisxd commented 1 year ago

@ameenalasady I don't really know what'll work if this doesn't.

Could you change the origin parameter to * in this line? Also, remove the CSP line if you haven't.

ameenalasady commented 1 year ago

@reisxd That fixed it! Everything works perfectly now. Is this considered a permanent fix or is it vulnerable? Thank you so much for your support. Very great work you have done.

reisxd commented 1 year ago

@reisxd That fixed it! Everything works perfectly now. Is this considered a permanent fix or is it vulnerable? Thank you so much for your support. Very great work you have done.

I'll make a commit to fix it for others and close the issue then. I just made the app able to access any domain, which worked.

Older Tizens only needed the YT domain but now the newer ones require every domain I guess.

reisxd commented 1 year ago

Fixed in c9dda8cd5fd76d57baa0ad1753f073a122338fd3.