@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration ;
using MediaBrowser.Common.Configuration ;
using MediaBrowser.Common.Net ;
using MediaBrowser.Common.Net ;
using MediaBrowser.Common.Security ;
using MediaBrowser.Controller ;
using MediaBrowser.Controller ;
using MediaBrowser.Controller.Configuration ;
using MediaBrowser.Controller.Configuration ;
using MediaBrowser.Controller.Connect ;
using MediaBrowser.Controller.Connect ;
@ -38,6 +39,7 @@ namespace MediaBrowser.Server.Implementations.Connect
private readonly IServerConfigurationManager _config ;
private readonly IServerConfigurationManager _config ;
private readonly IUserManager _userManager ;
private readonly IUserManager _userManager ;
private readonly IProviderManager _providerManager ;
private readonly IProviderManager _providerManager ;
private readonly ISecurityManager _securityManager ;
private ConnectData _data = new ConnectData ( ) ;
private ConnectData _data = new ConnectData ( ) ;
@ -102,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Connect
IEncryptionManager encryption ,
IEncryptionManager encryption ,
IHttpClient httpClient ,
IHttpClient httpClient ,
IServerApplicationHost appHost ,
IServerApplicationHost appHost ,
IServerConfigurationManager config , IUserManager userManager , IProviderManager providerManager )
IServerConfigurationManager config , IUserManager userManager , IProviderManager providerManager , ISecurityManager securityManager )
{
{
_logger = logger ;
_logger = logger ;
_appPaths = appPaths ;
_appPaths = appPaths ;
@ -113,6 +115,7 @@ namespace MediaBrowser.Server.Implementations.Connect
_config = config ;
_config = config ;
_userManager = userManager ;
_userManager = userManager ;
_providerManager = providerManager ;
_providerManager = providerManager ;
_securityManager = securityManager ;
_userManager . UserConfigurationUpdated + = _userManager_UserConfigurationUpdated ;
_userManager . UserConfigurationUpdated + = _userManager_UserConfigurationUpdated ;
_config . ConfigurationUpdated + = _config_ConfigurationUpdated ;
_config . ConfigurationUpdated + = _config_ConfigurationUpdated ;
@ -1054,6 +1057,34 @@ namespace MediaBrowser.Server.Implementations.Connect
}
}
}
}
public async Task < ConnectSupporterSummary > GetConnectSupporterSummary ( )
{
if ( ! _securityManager . IsMBSupporter )
{
return new ConnectSupporterSummary ( ) ;
}
var url = GetConnectUrl ( "keyAssociation" ) ;
url + = "?serverId=" + ConnectServerId ;
url + = "&supporterKey=" + _securityManager . SupporterKey ;
var options = new HttpRequestOptions
{
Url = url ,
CancellationToken = CancellationToken . None
} ;
SetServerAccessToken ( options ) ;
SetApplicationHeader ( options ) ;
// No need to examine the response
using ( var stream = ( await _httpClient . SendAsync ( options , "GET" ) . ConfigureAwait ( false ) ) . Content )
{
return _json . DeserializeFromStream < ConnectSupporterSummary > ( stream ) ;
}
}
public async Task Authenticate ( string username , string passwordMd5 )
public async Task Authenticate ( string username , string passwordMd5 )
{
{
if ( string . IsNullOrWhiteSpace ( username ) )
if ( string . IsNullOrWhiteSpace ( username ) )