Skip to content

Commit 94d84e1

Browse files
Bump EmbedIO from 2.2.7 to 2.7.4 (#344)
* Bump EmbedIO from 2.2.7 to 2.7.4 Bumps [EmbedIO](https://github.com/unosquare/embedio) from 2.2.7 to 2.7.4. - [Release notes](https://github.com/unosquare/embedio/releases) - [Commits](https://github.com/unosquare/embedio/commits/2.7.4) * Update SpotifyAPI.Web.Auth.csproj * Updated code to be compatible with EmbedIO 2.8
1 parent f4b3e9f commit 94d84e1

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

SpotifyAPI.Web.Auth/AuthorizationCodeAuth.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ public Task<bool> GetEmpty()
108108
Error = error
109109
}));
110110

111-
return this.StringResponseAsync("OK - This window can be closed now");
111+
return HttpContext.HtmlResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>");
112112
}
113113

114114
[WebApiHandler(HttpVerbs.Post, "/")]
115115
public async Task<bool> PostValues()
116116
{
117-
Dictionary<string, object> formParams = await this.RequestFormDataDictionaryAsync();
117+
Dictionary<string, object> formParams = await HttpContext.RequestFormDataDictionaryAsync();
118118

119119
string state = (string) formParams["state"];
120120
AuthorizationCodeAuth.Instances.TryGetValue(state, out SpotifyAuthServer<AuthorizationCode> authServer);
@@ -124,7 +124,7 @@ public async Task<bool> PostValues()
124124
auth.SecretId = (string) formParams["secretId"];
125125

126126
string uri = auth.GetUri();
127-
return this.Redirect(uri, false);
127+
return HttpContext.Redirect(uri, false);
128128
}
129129

130130
public AuthorizationCodeAuthController(IHttpContext context) : base(context)

SpotifyAPI.Web.Auth/ImplicitGrantAuth.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public Task<bool> GetAuth()
2929
string state = Request.QueryString["state"];
3030
SpotifyAuthServer<Token> auth = ImplicitGrantAuth.GetByState(state);
3131
if (auth == null)
32-
return this.StringResponseAsync(
32+
return HttpContext.StringResponseAsync(
3333
$"Failed - Unable to find auth request with state \"{state}\" - Please retry");
3434

3535
Token token;
@@ -55,7 +55,7 @@ public Task<bool> GetAuth()
5555
}
5656

5757
Task.Factory.StartNew(() => auth.TriggerAuth(token));
58-
return this.StringResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>");
58+
return HttpContext.HtmlResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>");
5959
}
6060

6161
public ImplicitGrantAuthController(IHttpContext context) : base(context)

SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="EmbedIO" Version="2.2.7" />
18+
<PackageReference Include="EmbedIO" Version="2.8.0" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

SpotifyAPI.Web.Auth/TokenSwapAuth.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Net;
43
using System.Text;
54
using System.Threading.Tasks;
65
using SpotifyAPI.Web.Enums;
@@ -9,13 +8,7 @@
98
using Unosquare.Labs.EmbedIO.Modules;
109
using SpotifyAPI.Web.Models;
1110
using Newtonsoft.Json;
12-
#if NETSTANDARD2_0
1311
using System.Net.Http;
14-
#endif
15-
#if NET46
16-
using System.Net.Http;
17-
using HttpListenerContext = Unosquare.Net.HttpListenerContext;
18-
#endif
1912

2013
namespace SpotifyAPI.Web.Auth
2114
{
@@ -211,7 +204,7 @@ public Task<bool> GetAuth()
211204
Code = code,
212205
Error = error
213206
}));
214-
return this.HtmlResponseAsync(((TokenSwapAuth)auth).HtmlResponse);
207+
return HttpContext.HtmlResponseAsync(((TokenSwapAuth)auth).HtmlResponse);
215208
}
216209
}
217210
}

0 commit comments

Comments
 (0)