upgrade to jquery mobile 1.4.5

This commit is contained in:
Luke Pulverenti
2014-11-02 22:38:43 -05:00
parent 7a4d5b7951
commit 7ca1cd8795
25 changed files with 735 additions and 83 deletions

View File

@@ -1,5 +1,4 @@
using MediaBrowser.Model.Connect;
using System;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Server.Implementations.Connect
@@ -21,7 +20,7 @@ namespace MediaBrowser.Server.Implementations.Connect
/// Gets or sets the authorizations.
/// </summary>
/// <value>The authorizations.</value>
public List<ConnectAuthorization> PendingAuthorizations { get; set; }
public List<ConnectAuthorizationInternal> PendingAuthorizations { get; set; }
/// <summary>
/// Gets or sets the last authorizations refresh.
@@ -31,7 +30,7 @@ namespace MediaBrowser.Server.Implementations.Connect
public ConnectData()
{
PendingAuthorizations = new List<ConnectAuthorization>();
PendingAuthorizations = new List<ConnectAuthorizationInternal>();
}
}
}

View File

@@ -498,7 +498,7 @@ namespace MediaBrowser.Server.Implementations.Connect
result.IsPending = string.Equals(response.AcceptStatus, "waiting", StringComparison.OrdinalIgnoreCase);
_data.PendingAuthorizations.Add(new ConnectAuthorization
_data.PendingAuthorizations.Add(new ConnectAuthorizationInternal
{
ConnectUserId = response.UserId,
Id = response.Id,
@@ -506,7 +506,8 @@ namespace MediaBrowser.Server.Implementations.Connect
UserName = response.UserName,
ExcludedLibraries = request.ExcludedLibraries,
ExcludedChannels = request.ExcludedChannels,
EnableLiveTv = request.EnableLiveTv
EnableLiveTv = request.EnableLiveTv,
AccessToken = accessToken
});
CacheData();
@@ -704,7 +705,7 @@ namespace MediaBrowser.Server.Implementations.Connect
}
var currentPendingList = _data.PendingAuthorizations.ToList();
var newPendingList = new List<ConnectAuthorization>();
var newPendingList = new List<ConnectAuthorizationInternal>();
foreach (var connectEntry in list)
{
@@ -749,12 +750,13 @@ namespace MediaBrowser.Server.Implementations.Connect
}
else if (string.Equals(connectEntry.AcceptStatus, "waiting", StringComparison.OrdinalIgnoreCase))
{
currentPendingEntry = currentPendingEntry ?? new ConnectAuthorization();
currentPendingEntry = currentPendingEntry ?? new ConnectAuthorizationInternal();
currentPendingEntry.ConnectUserId = connectEntry.UserId;
currentPendingEntry.ImageUrl = connectEntry.UserImageUrl;
currentPendingEntry.UserName = connectEntry.UserName;
currentPendingEntry.Id = connectEntry.Id;
currentPendingEntry.AccessToken = connectEntry.AccessToken;
newPendingList.Add(currentPendingEntry);
}
@@ -860,7 +862,17 @@ namespace MediaBrowser.Server.Implementations.Connect
}
}
return _data.PendingAuthorizations.ToList();
return _data.PendingAuthorizations.Select(i => new ConnectAuthorization
{
ConnectUserId = i.ConnectUserId,
EnableLiveTv = i.EnableLiveTv,
ExcludedChannels = i.ExcludedChannels,
ExcludedLibraries = i.ExcludedLibraries,
Id = i.Id,
ImageUrl = i.ImageUrl,
UserName = i.UserName
}).ToList();
}
public async Task CancelAuthorization(string id)
@@ -951,7 +963,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var user = e.Argument;
//await TryUploadUserPreferences(user, CancellationToken.None).ConfigureAwait(false);
await TryUploadUserPreferences(user, CancellationToken.None).ConfigureAwait(false);
}
private async Task TryUploadUserPreferences(User user, CancellationToken cancellationToken)
@@ -999,5 +1011,30 @@ namespace MediaBrowser.Server.Implementations.Connect
{
}
public async Task<User> GetLocalUser(string connectUserId)
{
var user = _userManager.Users
.FirstOrDefault(i => string.Equals(i.ConnectUserId, connectUserId, StringComparison.OrdinalIgnoreCase));
if (user == null)
{
await RefreshAuthorizations(CancellationToken.None).ConfigureAwait(false);
}
return _userManager.Users
.FirstOrDefault(i => string.Equals(i.ConnectUserId, connectUserId, StringComparison.OrdinalIgnoreCase));
}
public bool IsAuthorizationTokenValid(string token)
{
if (string.IsNullOrWhiteSpace(token))
{
throw new ArgumentNullException("token");
}
return _userManager.Users.Any(u => string.Equals(token, u.ConnectAccessKey, StringComparison.OrdinalIgnoreCase)) ||
_data.PendingAuthorizations.Select(i => i.AccessToken).Contains(token, StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Connect;
namespace MediaBrowser.Server.Implementations.Connect
{
@@ -77,4 +78,9 @@ namespace MediaBrowser.Server.Implementations.Connect
{
public T data { get; set; }
}
public class ConnectAuthorizationInternal : ConnectAuthorization
{
public string AccessToken { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
@@ -15,10 +16,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
{
private readonly IServerConfigurationManager _config;
public AuthService(IUserManager userManager, ISessionManager sessionManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config)
public AuthService(IUserManager userManager, ISessionManager sessionManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager)
{
AuthorizationContext = authorizationContext;
_config = config;
ConnectManager = connectManager;
SessionManager = sessionManager;
UserManager = userManager;
}
@@ -26,6 +28,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
public IUserManager UserManager { get; private set; }
public ISessionManager SessionManager { get; private set; }
public IAuthorizationContext AuthorizationContext { get; private set; }
public IConnectManager ConnectManager { get; private set; }
/// <summary>
/// Restrict authentication to a specific <see cref="IAuthProvider"/>.
@@ -65,7 +68,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
if (!string.IsNullOrWhiteSpace(auth.Token) ||
!_config.Configuration.InsecureApps3.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
if (!IsValidConnectKey(auth.Token))
var valid = IsValidConnectKey(auth.Token);
if (!valid)
{
SessionManager.ValidateSecurityToken(auth.Token);
}
@@ -122,12 +127,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
private bool IsValidConnectKey(string token)
{
if (!string.IsNullOrEmpty(token))
if (string.IsNullOrEmpty(token))
{
return UserManager.Users.Any(u => string.Equals(token, u.ConnectAccessKey, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(u.ConnectAccessKey));
return false;
}
return false;
return ConnectManager.IsAuthorizationTokenValid(token);
}
protected bool DoHtmlRedirectIfConfigured(IRequest req, IResponse res, bool includeRedirectParam = false)

View File

@@ -889,7 +889,7 @@
"LabelProtocolInfoHelp": "The value that will be used when responding to GetProtocolInfo requests from the device.",
"TabKodiMetadata": "Kodi",
"HeaderKodiMetadataHelp": "Media Browser includes native support for Kodi Nfo metadata and images. To enable or disable Kodi metadata, use the Advanced tab to configure options for your media types.",
"LabelKodiMetadataUser": "Add user watch data to nfo's for:",
"LabelKodiMetadataUser": "Sync user watch data to nfo's for:",
"LabelKodiMetadataUserHelp": "Enable this to keep watch data in sync between Media Browser and Kodi.",
"LabelKodiMetadataDateFormat": "Release date format:",
"LabelKodiMetadataDateFormatHelp": "All dates within nfo's will be read and written to using this format.",