Changed Host to 127.0.0.1 and added SSL workaround

This commit is contained in:
Jonas Dellinger 2016-09-30 12:16:36 +02:00
parent 5e12df71a4
commit 281b684f5f
3 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,6 @@ using SpotifyAPI.Local.Models;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace SpotifyAPI.Example namespace SpotifyAPI.Example
@ -96,7 +95,7 @@ namespace SpotifyAPI.Example
SpotifyUri uri = track.TrackResource.ParseUri(); SpotifyUri uri = track.TrackResource.ParseUri();
trackInfoBox.Text = $"Track Info - {uri.Id}"; trackInfoBox.Text = $@"Track Info - {uri.Id}";
bigAlbumPicture.Image = await track.GetAlbumArtAsync(AlbumArtSize.Size640); bigAlbumPicture.Image = await track.GetAlbumArtAsync(AlbumArtSize.Size640);
smallAlbumPicture.Image = await track.GetAlbumArtAsync(AlbumArtSize.Size160); smallAlbumPicture.Image = await track.GetAlbumArtAsync(AlbumArtSize.Size160);
@ -125,7 +124,8 @@ namespace SpotifyAPI.Example
return; return;
} }
timeLabel.Text = $@"{FormatTime(e.TrackTime)}/{FormatTime(_currentTrack.Length)}"; timeLabel.Text = $@"{FormatTime(e.TrackTime)}/{FormatTime(_currentTrack.Length)}";
timeProgressBar.Value = (int)e.TrackTime; if(e.TrackTime < _currentTrack.Length)
timeProgressBar.Value = (int)e.TrackTime;
} }
private void _spotify_OnTrackChange(object sender, TrackChangeEventArgs e) private void _spotify_OnTrackChange(object sender, TrackChangeEventArgs e)

View File

@ -9,6 +9,9 @@ namespace SpotifyAPI.Local
public ExtendedWebClient() public ExtendedWebClient()
{ {
// TODO Remove once SSL Issues are resolved #115
ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true;
Timeout = 2000; Timeout = 2000;
Headers.Add("Origin", "https://embed.spotify.com"); Headers.Add("Origin", "https://embed.spotify.com");
Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt"); Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");

View File

@ -13,7 +13,7 @@ namespace SpotifyAPI.Local
public string OauthKey { get; private set; } public string OauthKey { get; private set; }
public string CfidKey { get; private set; } public string CfidKey { get; private set; }
public const string Host = "SpotifyAPI.spotilocal.com"; public const string Host = "127.0.0.1"; //Localhost since domain fails to resolve on some hosts
internal Boolean Init() internal Boolean Init()
{ {