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

Add proxy support #88

Open
awohsen opened this issue May 23, 2022 · 60 comments
Open

Add proxy support #88

awohsen opened this issue May 23, 2022 · 60 comments
Labels
enhancement New feature or request

Comments

@awohsen
Copy link

awohsen commented May 23, 2022

Is your feature request related to a problem? Please describe.
Since I can't connect to many platforms because of censorship, I always use the proxy settings; but IDK where to implement them here!

@awohsen awohsen added the enhancement New feature or request label May 23, 2022
@Jack-Chou-HZ
Copy link

same here, from China mainland.

@KRTirtho
Copy link
Owner

KRTirtho commented Jun 3, 2022

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

@momobobe
Copy link

momobobe commented Jun 5, 2022

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

https://github.com/Sangwan5688/BlackHole/search?q=proxy&type=commits, but this is http proxy only, while many users would prefer a socks one

@0x07C0
Copy link

0x07C0 commented Jul 12, 2022

Disclamer: I have no idea what I'm doing, I'm not familiar with flutter
I've made a spotube-socks5 demo, it has hardcoded local socks5 proxy. I have no idea how to add a settings menu for proxy, so I'll just leave it here in hopes that this would help. I works globally within the app.

Package used: flutter_socks_proxy [MIT license]

@awohsen
Copy link
Author

awohsen commented Aug 27, 2022

For Linux users, there is an option to run spotube using proxychains tool and it will tunnel the application through a custom proxy

@KRTirtho KRTirtho added this to To do in New Features via automation Aug 27, 2022
@KRTirtho
Copy link
Owner

Sorry bro.. Forgot to add this feature request to Todo

@Be1zebub
Copy link

Be1zebub commented May 21, 2023

spotify has left my country, so im w8 so much for proxy support in spotube

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

its easy to implement proxy via http CONNECT https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling
idk dart lang, but there is a pseudocode example:

function http.proxyRequest(proxy, request)
	connection = http.connect(proxy.host, proxy.port, proxy.tls)

	connection.write("CONNECT", {
		["Host"] = request.host,
		["Proxy-Authorization"] = proxy.credentials
	})

	response = connection.read()

	if response and response.code == 200 then
		connection.host = request.host
		connection.port = request.port
		connection.tls = request.tls

		connection.write(request.method, request.headers, request.body)

		return connection.read()
	else
		retry with another proxy...
	end
end

@mohammadRezaeian
Copy link

hi
thanks for write this application
please if it possible set upper priority for this option
in many country spotify is block
thanks

@KRTirtho
Copy link
Owner

I'd love to add this feature but I'm just not sure how to approach it. Looking for an expert on this topic for months :)

@KRTirtho
Copy link
Owner

I think this is no longer required/valid as Spotube now uses piped API which is accessible globally

If the default server API (kavin.rocks) is not available in your region you can change it from "Settings" > "Piped Server Instance" selector
You can find which server is closer to your region in Piped Wiki

@KRTirtho KRTirtho added invalid This doesn't seem right wontfix / Alternatively patched This will not be worked on or it's already patched using an alternative method and removed invalid This doesn't seem right labels Jun 25, 2023
@Be1zebub
Copy link

Be1zebub commented Jun 25, 2023

i have no "Piped Server Instance" in settings, is this feature released?

screenshots

@KRTirtho
Copy link
Owner

It's available in nightly release

@Be1zebub
Copy link

Be1zebub commented Jun 25, 2023

login is not proxied
ok, then I tried to login with my http proxy server - i got 403 (login in browser spotify app works ok)
seems like when i try with my own proxy spotube login button still opens https://www.spotify.com/int/why-not-available/
because in browser when proxy enabled on this page i got 403 too, like in spotube login
i think its cached?

@mohammadrafigh
Copy link

Please allow using a custom Piped instance like how Libretube handles that.

@KRTirtho KRTirtho mentioned this issue Aug 25, 2023
1 task
@spl3g
Copy link

spl3g commented Aug 30, 2023

I have the 403 issue too, maybe you can make that the login instance opens in the default browser. Idk if it's possible but i think that it would solve the problem

@Be1zebub
Copy link

"login instance opens in the default browser" - yep this would allow to proxy browser http requests and pass the login stage, rn the application is just useless in countries where spotify left :(

@spl3g
Copy link

spl3g commented Aug 31, 2023

Or it will be great to give a choice between the in app browser and the cookie method (like in the pc version).

@xmha97
Copy link

xmha97 commented Oct 6, 2023

same here, from China mainland.

same here, from Iran.

@Cp0204
Copy link

Cp0204 commented Nov 21, 2023

Piped Server Instance

Screenshot_2023-11-21-12-00-12-108_oss krtirtho spotube

I can't access github in my region, reading the online Piped Server Instance fails.😂

As well as I can build my own piped server, hopefully I can customize the input server address.

@KRTirtho
Copy link
Owner

I can't access github in my region, reading the online Piped Server Instance fails.😂

Dang it. I should've thought of it earlier. I'll provide some default server list and also a field to manually add a Piped instance url

@mohammadrafigh
Copy link

@KRTirtho I noticed that even if we use a custom Piped instance Spotube fetches playlists and track info from Spotify which is also blocked in many countries and the Spotube is not able to fetch those data so the app won't work at all. Maybe there should be some sort of local caching at least for user playlists, So without any proxy we can play our own playlists using a custom piped instance.

I'm thinking of better solutions to handle that, maybe something like piped API but just to fetch info and playlists from Spotify.

@dave9123
Copy link

You can use VPN probably

@dave9123
Copy link

dave9123 commented Dec 19, 2023

I'd love to add this feature but I'm just not sure how to approach it. Looking for an expert on this topic for months :)

Probably check if the proxy is selected and check if the proxy is accessible, then another check if proxy is enabled and is accessible use it for query and download

@rockxsj
Copy link

rockxsj commented Jan 2, 2024

It seems the http client limit on dart, maybe we can try some solution from flutter/flutter#26359

@wuyuansheng1982
Copy link

tried netsh winhttp set proxy localhost:1080 and starting the app, time out as well

@rockxsj
Copy link

rockxsj commented Jan 26, 2024

tried netsh winhttp set proxy localhost:1080 and starting the app, time out as well

Please try to follow the steps below.

$env:HTTP_PROXY="127.0.0.1:11807"
$env:HTTPS_PROXY="127.0.0.1:11807"
/path/to/your/spotube.exe

@wuyuansheng1982
Copy link

wuyuansheng1982 commented Jan 26, 2024

thanks, but don't think it works

@dave9123
Copy link

dave9123 commented Jan 26, 2024 via email

@rockxsj
Copy link

rockxsj commented Jan 27, 2024

thanks, but don't think it works

it works as expect on my windows 11.

@wuyuansheng1982
Copy link

image

I have a SSH tunnel, so socks5 proxy. @rockxsj What type of proxy do you have?

@wuyuansheng1982
Copy link

getting this error message now
image

@knoxwh
Copy link

knoxwh commented Feb 1, 2024

Snipaste_2024-02-01_14-48-26 C:\Windows\System32\cmd.exe /c "set HTTP_PROXY=http://127.0.0.1:xxxx && set HTTPS_PROXY=http://127.0.0.1:xxxx && start "Spotube" "C:\Program Files\Spotube\spotube.exe"

Can solve the problem of Windows clients not using proxies

@olivier2
Copy link
Contributor

Because of multiple duplicates regarding SOCKS5 support, I thought I'd looked into it. The flutter_socks_proxy package makes this look as easy as adding a text field in the settings page.

I tested using Charles Proxy, but it's hard to tell if every thing is working as it should. If someone could test from my changes and report back, that would be awesome!

Here's a video of how the field works:

Spotube.2024-02-20.18-55-50.mp4

@wuyuansheng1982
Copy link

@olivier2 any instructions on how to build on Windows?

@olivier2
Copy link
Contributor

@olivier2 any instructions on how to build on Windows?

These build instructions for Spotube might be the only steps you really need (Install SDK and call the flutter commands to build/run)

If you're planning on developing for flutter, check out setting up an editor for flutter.

@wuyuansheng1982
Copy link

Screenshot 2024-02-22 122217

@olivier2 getting build errors, maybe I will wait for the nightly release.

@F-TD5X
Copy link

F-TD5X commented Feb 22, 2024

You can use the terminal proxy

export https_proxy=http://127.0.0.1:$port;export http_proxy=http://127.0.0.1:$port;export all_proxy=socks5://127.0.0.1:$port

, then open spotube application in terminal

/Applications/spotube.app/Contents/MacOS/spotube

don't close termainal.

If using MacOS. You should be fine to close terminal if you use open /Application/spotube.app to launch spotube. open will inheritance the envs.

@olivier2
Copy link
Contributor

Screenshot 2024-02-22 122217

@olivier2 getting build errors, maybe I will wait for the nightly release.

Did you run:
flutter pub get

The nightly only contains changes from the dev branch, but my changes are in a completely different fork.

@KRTirtho KRTirtho pinned this issue Feb 24, 2024
@KRTirtho KRTirtho removed the wontfix / Alternatively patched This will not be worked on or it's already patched using an alternative method label Feb 24, 2024
@wuyuansheng1982
Copy link

https://pastebin.com/EvaCWx2e

Attached is the terminal output from building on Windows, getting a different error message now.

How do I check out your changes? Sorry, kinda newbie here.

@sappho192
Copy link
Contributor

Hi. I've cloned proxy-setting branch and built the Windows app.

image
I set the proxy settings like above and re-run the app, but the error floods like below:

flutter: [2024-02-27 11:09:13.856050 | Catcher 2 | INFO] ClientException with SocketException: Failed host lookup: 'accounts.spotify.com' (OS Error: Cannot find the host
...
flutter: [2024-02-27 11:09:19.907781 | Catcher 2 | INFO] Failed to open https://youtube.com/unplayable.m4a?id=4mHcEo7lhHsPxUbplsXxdk&title=I%20Don't%20Care%20About%20Nothing%20-%20from%20GRAN%20TURISMO%207.
...
flutter: [2024-02-27 11:09:19.916781 | Catcher 2 | INFO] [MediaKitError] 
Failed to open https://youtube.com/unplayable.m4a?id=5Zfn8MjK6gABVJxzCgrUin&title=Life's%20Coming%20in%20Slow%20-%20from%20GRAN%20TURISMO%207.
...

The full log is log_2402271108.txt

It seems that the proxy is not applied to every internet-related functions maybe.

@orangelckc
Copy link

分享一下在macos上使用spotube+clashX 连接的解决方案:
Share my solution on Macos with spotube+clashX:

  1. clashX复制代理命令
    Copy this proxy command in clashX
    image

  2. 打开终端,粘贴命令并执行
    Open terminal and execute this command

  3. 使用命令 open /Applications/spotube.app 打开软件
    With open /Applications/spotube.app to launch spotube
    image

这样可以让spotube使用到clashX的代理
Done, and enjoy the music with proxy.

@magicdawn
Copy link

if set proxy related environment variables works, on macOS you can install https://github.com/hschmidt/EnvPane to set environment variables for all GUI apps

@KRTirtho
Copy link
Owner

Does setting these env vars actually works? If it works, I can add a Proxy section in the settings page that can be used to override these variables

@I-like-Portal-2
Copy link

Same here, getting the 403 thing on android. An option to put the token manually would be nice.

@Lippiece
Copy link

Does setting these env vars actually works? If it works, I can add a Proxy section in the settings page that can be used to override these variables

Indeed, it does.

Here's my slightly edited desktop entry to launch with proxy.

  [Desktop Entry]
  Type=Application
  Name=Spotube
  Exec=env HTTP_PROXY=127.0.0.1:2334 HTTPS_PROXY=127.0.0.1:2334 /usr/bin/spotube
  Icon=/usr/share/icons/spotube/spotube-logo.png
  Comment=A music streaming app combining the power of Spotify & YouTube
  Terminal=false
  Categories=Audio;Music;Player;AudioVideo;
  MimeType=x-scheme-handler/spotify;
  DBusActivatable=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Won't be possible
Development

No branches or pull requests