mirror of https://github.com/jellyfin/jellyfin.git
removed dead code
This commit is contained in:
parent
eea19c3adc
commit
bc6e47c30a
|
@ -1,10 +1,8 @@
|
||||||
using System;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Extensions;
|
|
||||||
using MediaBrowser.Controller.Connect;
|
using MediaBrowser.Controller.Connect;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Connect;
|
using MediaBrowser.Model.Connect;
|
||||||
using MediaBrowser.Model.Dto;
|
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -75,28 +73,6 @@ namespace MediaBrowser.Api
|
||||||
public string ConnectUserId { get; set; }
|
public string ConnectUserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Connect/Supporters", "GET")]
|
|
||||||
[Authenticated(Roles = "Admin")]
|
|
||||||
public class GetConnectSupporterSummary : IReturn<ConnectSupporterSummary>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Route("/Connect/Supporters", "DELETE")]
|
|
||||||
[Authenticated(Roles = "Admin")]
|
|
||||||
public class RemoveConnectSupporter : IReturnVoid
|
|
||||||
{
|
|
||||||
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")]
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Route("/Connect/Supporters", "POST")]
|
|
||||||
[Authenticated(Roles = "Admin")]
|
|
||||||
public class AddConnectSupporter : IReturnVoid
|
|
||||||
{
|
|
||||||
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
|
|
||||||
public string Id { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConnectService : BaseApiService
|
public class ConnectService : BaseApiService
|
||||||
{
|
{
|
||||||
private readonly IConnectManager _connectManager;
|
private readonly IConnectManager _connectManager;
|
||||||
|
@ -108,35 +84,6 @@ namespace MediaBrowser.Api
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<object> Get(GetConnectSupporterSummary request)
|
|
||||||
{
|
|
||||||
var result = await _connectManager.GetConnectSupporterSummary().ConfigureAwait(false);
|
|
||||||
var existingConnectUserIds = result.Users.Select(i => i.Id).ToList();
|
|
||||||
|
|
||||||
result.EligibleUsers = _userManager.Users
|
|
||||||
.Where(i => !string.IsNullOrWhiteSpace(i.ConnectUserId))
|
|
||||||
.Where(i => !existingConnectUserIds.Contains(i.ConnectUserId, StringComparer.OrdinalIgnoreCase))
|
|
||||||
.OrderBy(i => i.Name)
|
|
||||||
.Select(i => _userManager.GetUserDto(i))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return ToOptimizedResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Delete(RemoveConnectSupporter request)
|
|
||||||
{
|
|
||||||
var task = _connectManager.RemoveConnectSupporter(request.Id);
|
|
||||||
|
|
||||||
Task.WaitAll(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Post(AddConnectSupporter request)
|
|
||||||
{
|
|
||||||
var task = _connectManager.AddConnectSupporter(request.Id);
|
|
||||||
|
|
||||||
Task.WaitAll(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Post(CreateConnectLink request)
|
public object Post(CreateConnectLink request)
|
||||||
{
|
{
|
||||||
return _connectManager.LinkUser(request.Id, request.ConnectUsername);
|
return _connectManager.LinkUser(request.Id, request.ConnectUsername);
|
||||||
|
|
|
@ -76,25 +76,5 @@ namespace MediaBrowser.Controller.Connect
|
||||||
/// <param name="token">The token.</param>
|
/// <param name="token">The token.</param>
|
||||||
/// <returns><c>true</c> if [is authorization token valid] [the specified token]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is authorization token valid] [the specified token]; otherwise, <c>false</c>.</returns>
|
||||||
bool IsAuthorizationTokenValid(string token);
|
bool IsAuthorizationTokenValid(string token);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the connect supporter summary.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task<ConnectSupporterSummary>.</returns>
|
|
||||||
Task<ConnectSupporterSummary> GetConnectSupporterSummary();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes the connect supporter.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">The identifier.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task RemoveConnectSupporter(string id);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds the connect supporter.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">The identifier.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task AddConnectSupporter(string id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1071,90 +1071,6 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ConnectSupporterSummary> GetConnectSupporterSummary()
|
|
||||||
{
|
|
||||||
var url = GetConnectUrl("keyAssociation");
|
|
||||||
|
|
||||||
var options = new HttpRequestOptions
|
|
||||||
{
|
|
||||||
Url = url,
|
|
||||||
CancellationToken = CancellationToken.None
|
|
||||||
};
|
|
||||||
|
|
||||||
var postData = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"serverId", ConnectServerId},
|
|
||||||
{"supporterKey", _securityManager.SupporterKey}
|
|
||||||
};
|
|
||||||
|
|
||||||
options.SetPostData(postData);
|
|
||||||
|
|
||||||
SetServerAccessToken(options);
|
|
||||||
SetApplicationHeader(options);
|
|
||||||
|
|
||||||
// No need to examine the response
|
|
||||||
using (var stream = (await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)).Content)
|
|
||||||
{
|
|
||||||
return _json.DeserializeFromStream<ConnectSupporterSummary>(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddConnectSupporter(string id)
|
|
||||||
{
|
|
||||||
var url = GetConnectUrl("keyAssociation");
|
|
||||||
|
|
||||||
var options = new HttpRequestOptions
|
|
||||||
{
|
|
||||||
Url = url,
|
|
||||||
CancellationToken = CancellationToken.None
|
|
||||||
};
|
|
||||||
|
|
||||||
var postData = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"serverId", ConnectServerId},
|
|
||||||
{"supporterKey", _securityManager.SupporterKey},
|
|
||||||
{"userId", id}
|
|
||||||
};
|
|
||||||
|
|
||||||
options.SetPostData(postData);
|
|
||||||
|
|
||||||
SetServerAccessToken(options);
|
|
||||||
SetApplicationHeader(options);
|
|
||||||
|
|
||||||
// No need to examine the response
|
|
||||||
using (var stream = (await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)).Content)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task RemoveConnectSupporter(string id)
|
|
||||||
{
|
|
||||||
var url = GetConnectUrl("keyAssociation");
|
|
||||||
|
|
||||||
var options = new HttpRequestOptions
|
|
||||||
{
|
|
||||||
Url = url,
|
|
||||||
CancellationToken = CancellationToken.None
|
|
||||||
};
|
|
||||||
|
|
||||||
var postData = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"serverId", ConnectServerId},
|
|
||||||
{"supporterKey", _securityManager.SupporterKey},
|
|
||||||
{"userId", id}
|
|
||||||
};
|
|
||||||
|
|
||||||
options.SetPostData(postData);
|
|
||||||
|
|
||||||
SetServerAccessToken(options);
|
|
||||||
SetApplicationHeader(options);
|
|
||||||
|
|
||||||
// No need to examine the response
|
|
||||||
using (var stream = (await _httpClient.SendAsync(options, "DELETE").ConfigureAwait(false)).Content)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Authenticate(string username, string passwordMd5)
|
public async Task Authenticate(string username, string passwordMd5)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(username))
|
if (string.IsNullOrWhiteSpace(username))
|
||||||
|
@ -1188,9 +1104,9 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
|
|
||||||
async void _userManager_UserConfigurationUpdated(object sender, GenericEventArgs<User> e)
|
async void _userManager_UserConfigurationUpdated(object sender, GenericEventArgs<User> e)
|
||||||
{
|
{
|
||||||
var user = e.Argument;
|
//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)
|
private async Task TryUploadUserPreferences(User user, CancellationToken cancellationToken)
|
||||||
|
|
Loading…
Reference in New Issue