mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
update session listener
This commit is contained in:
@@ -1687,16 +1687,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
AccessToken = token
|
||||
});
|
||||
|
||||
if (result.Items.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var info = result.Items[0];
|
||||
var info = result.Items.FirstOrDefault();
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
return null;
|
||||
return Task.FromResult<SessionInfo>(null);
|
||||
}
|
||||
|
||||
return GetSessionByAuthenticationToken(info, deviceId, remoteEndpoint, null);
|
||||
|
||||
@@ -85,7 +85,8 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
|
||||
async void _httpServer_WebSocketConnecting(object sender, WebSocketConnectingEventArgs e)
|
||||
{
|
||||
if (e.QueryString.AllKeys.Contains("api_key", StringComparer.OrdinalIgnoreCase))
|
||||
var token = e.QueryString["api_key"];
|
||||
if (!string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
var session = await GetSession(e.QueryString, e.Endpoint).ConfigureAwait(false);
|
||||
|
||||
@@ -98,6 +99,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
|
||||
private Task<SessionInfo> GetSession(NameValueCollection queryString, string remoteEndpoint)
|
||||
{
|
||||
if (queryString == null)
|
||||
{
|
||||
throw new ArgumentNullException("queryString");
|
||||
}
|
||||
|
||||
var token = queryString["api_key"];
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user