Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Video not playing if Freetube configured for use socks5 or http proxy. Base network is blocking jnn-pa.googleapis.com and proxy is not blocking it. Error: Error invoking remote method 'generate-po-token': Error: Failed to fetch. #6722

Open
6 tasks done
Lucky00Snake opened this issue Feb 1, 2025 · 8 comments

Comments

@Lucky00Snake
Copy link

Guidelines

  • I have encountered this bug in the latest release of FreeTube.
  • I have encountered this bug in the official downloads of FreeTube.
  • I have searched the issue tracker for open and closed issues that are similar to the bug report I want to file, without success.
  • I have searched the documentation for information that matches the description of the bug I want to file, without success.
  • This issue contains only one bug.

Describe the bug

  1. Youtube is blocked on network and jnn-pa.googleapis.com is blocked too, as far as I can tell.
  2. There is a socks5 proxy with no blocks for Youtube domains.
  3. Settings -> Proxy -> Enable Tor/Proxy is on and proxy adress is properly configured. "Test proxy" button gets correct proxy output info.
  4. Attempt to play any YouTube video (for example https://youtu.be/lNzQPJ7_DUk ) results in error: "Error: Error invoking remote method 'generate-po-token': Error: Failed to fetch".

I checked that both on Linux and Windows 10. Checked socks5 and http proxies. And it seems to me that after Commit 248581d connection to jnn-pa.googleapis.com is needed but it connects directly, not using proxy. If I run VPN and all traffic except local network addresses goes thru tunnel - FreeTube is working fine even if proxy in local net still configured in FreeTube.

Basically that bug renders FreeTube unusable if base network is blocking YouTube or host jnn-pa.googleapis.com or internet connection is possible only thru proxy.

It's connected with issue #6713: #6713 but topic was locked before I can test and post results.

Expected Behavior

Play videos with proxy configured without problems.

Issue Labels

content not loading

FreeTube Version

v.0.23.1

Operating System Version

Debian Linux 12.9

Installation Method

Portable

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

v.0.22.1 nightly build 5363

Additional Information

No response

Nightly Build

@ACR-Jeff
Copy link

ACR-Jeff commented Feb 2, 2025

I created an issue two days ago and it was closed before I could get back to testing and replying, I do have pihole yet I have never blocked jnn-pa.googleapis.com, I have it actually white listed, During more testing I disabled pihole and connect directly to my modem without any sponsor blocks and a different network/IP entirely, Then tried Freetube again, I have found Freetube to work on my end with a vpn without issues. Yet the moment I disable my vpn things start to break again. This is with LocalAPI and with Invidious both tested, Invidious didn't seem to work at all in my case, It doesn't appear to be a pihole issue as stated, Maybe I am misunderstanding? #6678

@FreeTubeApp FreeTubeApp deleted a comment from syphyr Feb 4, 2025
@absidue
Copy link
Member

absidue commented Feb 4, 2025

@Lucky00Snake Please provide a working proxy that can be used to test this.

@Lucky00Snake
Copy link
Author

Lucky00Snake commented Feb 4, 2025

Please provide a working proxy that can be used to test this.

Not really sure what I must do...
Аny proxy redirecting traffic into some channel that is not blocking jnn-pa.googleapis.com will do.

Local http or socks5 proxy can be easy configured with sing-box оr some GUI for sing-box like nekobox/nekoray, karing, hiddify etc.

Sing-box with free wireguard (e.g. ProtonVPN or Cloudflare Warp) must do the job. Nekobox for Android can even generate proper CF Warp wireguard configuration and be configured to work as a proxy server on local network.

Not sure about Tor, though, because Youtube now seems to not really love connections from the tor network. But maybe it will work too.


On Linux I can see connections to hosts *.1e100.net (for example lh-in-f95.1e100.net, lj-in-x5f.1e100.net -- that names corresponds with IP addresses resolved from jnn-pa.googleapis.com) in iftop with proxy enabled in FreeTube 0.23.1. Аnd it should not be possible if all traffic from FreeTube goes into the proxy (of course any other processes that can generate such network traffic was stopped or filtered).

I cannot see such connections with FreeTube 0.22.1 -- and that is proper behaviour for this version, as I can understand.

@Lucky00Snake
Copy link
Author

proxy that can be used to test this

Tor on local network or local PC will work fine.
To reproduce the bug you need to configure Freetube to use proxy (Tor or any other service) and set firewall rule to block outbound connections to subnets:
64.233.0.0/16
74.125.0.0/16
108.177.0.0/16
142.250.0.0/16
142.251.0.0/16
172.217.0.0/16
173.194.0.0/16
209.85.0.0/16
216.58.0.0/16
2a00:1450:4001:1::1/40
2607:f8b0:4001:1::1/40

This list is not full and precise, but will do as a temporary measure for test purposes.

@absidue
Copy link
Member

absidue commented Feb 6, 2025

As those steps are a lot more complicated than the simple proxy IP + port combination that I was asking for, it will likely be a lot easier if we provide a test build with the changes that are supposed to fix it and you tell us if it works or not. I was hoping for a simple IP + port combination, as all the ones on the free public lists don't work at all, not instructions for every dev that needs to test the changes having to spend hours reconfiguring their network setup.

@Lucky00Snake
Copy link
Author

be a lot easier if we provide a test build with the changes that are supposed to fix it and you tell us if it works or not

Yes, It will work too. I can do test like that.

As those steps are a lot more complicated than the simple proxy IP + port combination

That the whole point: if you just set up some proxy in FreeTube it will work as nothing happens.
And it's easy enough to download and run Tor browser - that will give you
socks5://127.0.0.1:9150 wich more stable than public proxy. The problem is: when is nothing blocking connection to jnn-pa.googleapis.com - freetube will run just fine, it just connects directly to jnn-pa, not using proxy, and it's all just works.

So to recreate the problem you need to alter your network config some way because in most cases is nothing blocks jnn-pa. (It's really rare this days to have a network connection only thru proxy).

Or you need to monitor connections of Freetube some way or another - on Linux it's possible with auditd service, for example (the part of auditd log that shows a bunch of connections to google servers made directly, not thru Tor proxy on 192.168.1.2:9050 is attached). Not shure about how to did it on windows.

I'm really sorry if I some way offended you. I just thinking that make a firewall rule that you can turn on - turn off instantly is the simpliest way to make a testing in that case.

I'm really sorry but I currently can't provide a hosting with proxy.
But I can do testing if you need it.

audit_freetube.txt

@rovjuvano
Copy link

Here are three ways to reproduce this issue (plus #6713 and its dups) and demonstrate the poToken code is ignoring the proxy settings.

A) System proxy settings + Tor/SSH proxy:

  1. Set your system proxy to something that blocks jnn-pa.googleapis.com such as a non-existent proxy (e.g socks5://0.0.0.0:3128 with nothing listening on that port). †
  2. Start a socks5 proxy by launching the Tor Browser or using SSH (-D option). †
  3. Set the FreeTube settings to use this proxy.
  4. Attempt to load any video to get the error.
  5. Add jnn-pa.googleapis.com to the system proxy bypass list then reload without the error.
    † There are many ways to do this and depends on your system and familiarity with these tools.

B) Snoop on the network traffic.

With the proxy set, all traffic (ignoring dev-runner) should go to the proxy, but it's not. Again, there are many ways to do this and depends on your system and familiarity with the tools (e.g. Resource Monitor on Windows, Activity Monitor on MacOS, tcpdump/lsof/netstat/etc. on unix). I can see it in my DNS logs.

C) Use the Source.

You can simulate a proxy which blocks everything except what's whitelisted with a simple code change. Set an invalid proxy in src\main\poTokenGenerator.js#generatePoToken.
e.g. with nothing listening on port 3128:

  webContentsView.webContents.session.setProxy({
    proxyRules: `socks5://0.0.0.0:3128`,
    // proxyBypassRules: 'jnn-pa.googleapis.com'
  })

This will block/unblock the domain independent of the FreeTube proxy settings producing the error when it's blocked (proxyBypassRules commented out).

This looks like where the code should be setting the proper proxy. I would have submitted a PR but I haven't figured out the best way to get the proxy settings to this part of the code or clone it from session.

@bluonek
Copy link

bluonek commented Feb 18, 2025

Layman's explanation of the problem, minus all the networking minutiae:

FreeTube, when configured to use a Proxy, does not route all traffic through the proxy. One such example, as was in my case, when connecting to "jnn-pa.googleapis.com" via port 443 on tcp and tcp6.

Thank you, hope this helps resolve the issue on the next go around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To assign
Development

No branches or pull requests

5 participants