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
This commit is contained in:
dependabot-preview[bot] 2019-06-03 15:18:10 +02:00 committed by Jonas Dellinger
parent f4b3e9fe40
commit 94d84e1f9d
4 changed files with 8 additions and 15 deletions

View File

@ -108,13 +108,13 @@ namespace SpotifyAPI.Web.Auth
Error = error Error = error
})); }));
return this.StringResponseAsync("OK - This window can be closed now"); return HttpContext.HtmlResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>");
} }
[WebApiHandler(HttpVerbs.Post, "/")] [WebApiHandler(HttpVerbs.Post, "/")]
public async Task<bool> PostValues() public async Task<bool> PostValues()
{ {
Dictionary<string, object> formParams = await this.RequestFormDataDictionaryAsync(); Dictionary<string, object> formParams = await HttpContext.RequestFormDataDictionaryAsync();
string state = (string) formParams["state"]; string state = (string) formParams["state"];
AuthorizationCodeAuth.Instances.TryGetValue(state, out SpotifyAuthServer<AuthorizationCode> authServer); AuthorizationCodeAuth.Instances.TryGetValue(state, out SpotifyAuthServer<AuthorizationCode> authServer);
@ -124,7 +124,7 @@ namespace SpotifyAPI.Web.Auth
auth.SecretId = (string) formParams["secretId"]; auth.SecretId = (string) formParams["secretId"];
string uri = auth.GetUri(); string uri = auth.GetUri();
return this.Redirect(uri, false); return HttpContext.Redirect(uri, false);
} }
public AuthorizationCodeAuthController(IHttpContext context) : base(context) public AuthorizationCodeAuthController(IHttpContext context) : base(context)

View File

@ -29,7 +29,7 @@ namespace SpotifyAPI.Web.Auth
string state = Request.QueryString["state"]; string state = Request.QueryString["state"];
SpotifyAuthServer<Token> auth = ImplicitGrantAuth.GetByState(state); SpotifyAuthServer<Token> auth = ImplicitGrantAuth.GetByState(state);
if (auth == null) if (auth == null)
return this.StringResponseAsync( return HttpContext.StringResponseAsync(
$"Failed - Unable to find auth request with state \"{state}\" - Please retry"); $"Failed - Unable to find auth request with state \"{state}\" - Please retry");
Token token; Token token;
@ -55,7 +55,7 @@ namespace SpotifyAPI.Web.Auth
} }
Task.Factory.StartNew(() => auth.TriggerAuth(token)); Task.Factory.StartNew(() => auth.TriggerAuth(token));
return this.StringResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>"); return HttpContext.HtmlResponseAsync("<html><script type=\"text/javascript\">window.close();</script>OK - This window can be closed now</html>");
} }
public ImplicitGrantAuthController(IHttpContext context) : base(context) public ImplicitGrantAuthController(IHttpContext context) : base(context)

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net46;netstandard2.0</TargetFrameworks> <TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -15,7 +15,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="EmbedIO" Version="2.2.7" /> <PackageReference Include="EmbedIO" Version="2.8.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Enums;
@ -9,13 +8,7 @@ using Unosquare.Labs.EmbedIO.Constants;
using Unosquare.Labs.EmbedIO.Modules; using Unosquare.Labs.EmbedIO.Modules;
using SpotifyAPI.Web.Models; using SpotifyAPI.Web.Models;
using Newtonsoft.Json; using Newtonsoft.Json;
#if NETSTANDARD2_0
using System.Net.Http; using System.Net.Http;
#endif
#if NET46
using System.Net.Http;
using HttpListenerContext = Unosquare.Net.HttpListenerContext;
#endif
namespace SpotifyAPI.Web.Auth namespace SpotifyAPI.Web.Auth
{ {
@ -211,7 +204,7 @@ namespace SpotifyAPI.Web.Auth
Code = code, Code = code,
Error = error Error = error
})); }));
return this.HtmlResponseAsync(((TokenSwapAuth)auth).HtmlResponse); return HttpContext.HtmlResponseAsync(((TokenSwapAuth)auth).HtmlResponse);
} }
} }
} }