Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Toastify timeout trying to start/recognize Spotify using a Proxy w/ auth. #46

Closed
Hoax87 opened this issue Mar 13, 2018 · 23 comments
Closed
Labels
Type: Bug Status: Completed

Comments

@Hoax87
Copy link

Hoax87 commented Mar 13, 2018

If this is a crash, bug or unexpected behaviour report, please use the following template.

EXPECTED BEHAVIOUR

Toastify should be able to control Spotify

ACTUAL BEHAVIOUR

It is not working, because Toastify won't recognize Spotify. It's showing "Wating for Spotify" (even if this is already started by Toastify) and after a couple of minutes it returns an exception with "timeout"

STEPS TO REPRODUCE THE BEHAVIOUR

Using a proxy with authentication

LOG FILE

16:36:33,402+01:00 WARN  [Toastify.Core.Spotify.ConnectWithSpotify, 314] (4) – WebException while connecting to Spotify.
System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadString(Uri address)
   at SpotifyAPI.Local.RemoteHandler.GetOAuthKey()
   at SpotifyAPI.Local.RemoteHandler.Init()
   at Toastify.Core.Spotify.ConnectWithSpotify(DoWorkEventArgs e) in E:\Users\Alessandro\Documents\Visual Studio 2017\Projects\toastify\Toastify\src\Core\Spotify.cs:line 314
16:36:33,906+01:00 ERROR [Toastify.Core.Spotify.StartSpotify_WorkerTaskCompleted, 233] (1) – Toastify was not able to find Spotify within the timeout interval.

image

@aleab
Copy link
Owner

aleab commented Mar 13, 2018

Thank you very much for the bug report @Hoax87! 👍
This is definitely a problem with SpotifyAPI-NET, the library I'm using to communicate with Spotify. As far as I know it currently doesn't yet support proxy configurations, unfortunately.
I'll ask the owner of that project and I'll update you as soon as I have a fix ready.

@aleab
Copy link
Owner

aleab commented Mar 21, 2018

@Hoax87 @trevtrevtrev

Hi! Unfortunately, the maintainer of the SpotifyAPI-NET project has yet to approve my pull request which adds proxy support to his library, so I don't have an official fix ready yet.
However, what I do have is a version of Toastify which uses an unofficial custom build of that library with my fixes. Can you try it out and see if it resolves your problem?

The download is here. [ LINK REMOVED: see 4 comments below ]

@trevtrevtrev
Copy link

Launched new version, does the "waiting...", eventually get the timeout but that exits the program so cant get into change settings. Can I put the proxy details directly into the .cfg file? If so, whats the syntax?

@aleab
Copy link
Owner

aleab commented Mar 22, 2018

@trevtrevtrev I haven't added proxy settings into the file yet, since I wasn't even sure this was going to work properly.
Anyway, can you upload your log file? It's in "C:\Users\{UserName}\AppData\Local\Toastify"

@trevtrevtrev
Copy link

Toastify.cleaned.log

@aleab
Copy link
Owner

aleab commented Mar 22, 2018

@trevtrevtrev Hi! Let's try again. 😄

[ LINK REMOVED ]

This should work and ask you to input your proxy settings. If it doesn't you can put the proxy details directly into the cfg file using the following syntax:

"UseProxy": true,
"ProxyConfig": {
    "Host": "your proxy IP address",
    "Port": your proxy port
}

If needed by the proxy, you can add a "Username" and "Password" to "ProxyConfig" as well.

EDIT: forgot to mention that the Host's value in the cfg file must be inside double quotes. The values of "Username" and "Password" must be as well.

@trevtrevtrev
Copy link

OK I tried that version, got the popup for my proxy info, entered it but it keeps popping up asking me for details again. I need to pass it credentials and when the popup reappears, the password fails is blank. When I've edited the config file manually to put ion the details, on launch it still pops up with the proxy box, same behavior - keeps reappearing then times out with no connectivity.

Same behavior if I put in a junk username and password, how ever if I put in a junk host for the proxy it stops popping up then comes back with the "Toastify is having difficulties in connecting to Spotify. Are you behind a proxy?" and the cycle continues. If I break out and exit from the tray I get the technical timeout and then a "Unhandled exception. Object reference not set to an instance of an object."

Attached some logs.
Toastify.cleaned2.log

@aleab
Copy link
Owner

aleab commented Mar 22, 2018

I might have done a very bad beginner mistake there! 😅 I'll fix it ASAP.

Sorry for the hassle and for using you as a test subject. 😓

@trevtrevtrev
Copy link

Heh, no problem, happy to help. Just looking forward to getting me global keys back, its one of those things that once you're used to having them its a real pain when you loose them.

@aleab
Copy link
Owner

aleab commented Mar 23, 2018

"Third time's the charm", they say!
Here's the new version: [ LINK REMOVED ]

Let me know how it goes. 🤞
I tested it with a very basic in-house proxy server I set up yesterday, but I might not have covered all scenarios.

@trevtrevtrev
Copy link

Success! it works, it crashed on me a few times at the beginning, attached logs and errors, but now seems OK. When I launch it stays on 'waiting' with the grey tray icon for about 70 seconds, then it goes green and my shortcut keys start performing as they should. Now that could be my proxy setup as Spotify itself takes a muted to connect too after launch.

So far so good anyway, will report back after a few days usage.

errors.txt
Toastify.cleaned3.log

@aleab
Copy link
Owner

aleab commented Mar 23, 2018

🎉 🎉 🎉

I guess the album arts are not displayed or something, right? I forgot to forward the proxy information to the album art downloader.

@trevtrevtrev
Copy link

So album art inst displaying and the song name toast is hit and miss. On launch it will display the name of the current/first sing ok but it wont pickup the next track. It will eventually get the right track if I trigger the toast, but it's information each time is about a minute old.

@aleab
Copy link
Owner

aleab commented Mar 26, 2018

Thanks for reporting back, @trevtrevtrev! 👍
I already fixed the first issue (album arts) and the second one will be fixed shortly.
The next official release will hopefully be available in a few days.

@aleab
Copy link
Owner

aleab commented Mar 27, 2018

@trevtrevtrev I'd like to have you test one last time this unofficial version before I make the changes official, just to be sure it stands the test of a real proxy server (instead of my in-house one).

Both the recent issues should be resolved, assuming the reason the toast text didn't change in time was because it was waiting for the album art.

ToastifyInstaller.zip

Note: although I think it's not strictly necessary, you should delete the "proxy.sec" file from "C:\Users\{UserName}\AppData\Local" before installing the new version, just in case.

@trevtrevtrev
Copy link

Ok, I can see the album art now but the settings is a bit buggy, when I hit save I get the unhanded exception and if I hammer it a few times, it will crash and throw that error attached.

If I end process and re-launch it, and leave the UI untouched, (editing the cfg for my keys) it's working away fine, shortcuts work and art displays, still seems to to be that delay in new song play toast and progress bar is about 30 seconds behind but I'm not convinced that inst something do with my proxy setup here.

Unhandled exception.
Value cannot be null.

Parameter name: s
OK

@aleab
Copy link
Owner

aleab commented Mar 28, 2018

@trevtrevtrev Can I see the log file, please? That exception was totally unexpected.

@trevtrevtrev
Copy link

Ahh yes, it would be handy!
Toastify.cleaned4.log

@aleab
Copy link
Owner

aleab commented Mar 28, 2018

@trevtrevtrev About that 30 seconds delay – I'm not really sure on what might be causing it. It's unlikely that it's your proxy setup, since everything, except the download of the album art, happens client-side by querying Spotify client's local server at localhost:4381 and the proxy information is not even used in that part of code.

If disabling the proxy is a possibility, you could try testing Toastify without it and see if it makes a difference.

aleab added a commit that referenced this issue Mar 29, 2018
aleab added a commit that referenced this issue Mar 29, 2018
@aleab
Copy link
Owner

aleab commented Mar 31, 2018

Fixed in new version v1.10.7!

@aleab aleab closed this as completed Mar 31, 2018
@aleab aleab added the Status: Completed label Mar 31, 2018
@oskarmar
Copy link

I don't know if this thread is the correct, but searching my error I see it's simmilar so I attach my log hoping you can help me.
The problem is that when I start Toastify first it shows a window error (attached).
If I start first Spotify and then Toastify, it works fine.

BTW thank you very much for your work. I like it very much... 👍 😃
captura de pantalla 2018-08-22 10 01 29

Toastify.log

@aleab
Copy link
Owner

aleab commented Aug 22, 2018

@oskarmar Can you confirm that you have the Windows Store version of Spotify? If that's the case, I already have a fix ready to be released soon™ (see #89).

@oskarmar
Copy link

oskarmar commented Aug 22, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Status: Completed
Projects
None yet
Development

No branches or pull requests

4 participants