2016-12-23 21:45:24 +00:00
|
|
|
|
using NzbDrone.Api.REST;
|
2015-01-26 02:03:21 +00:00
|
|
|
|
using NzbDrone.Core.Authentication;
|
2016-03-25 00:56:29 +00:00
|
|
|
|
using NzbDrone.Core.Configuration;
|
2014-04-28 06:34:29 +00:00
|
|
|
|
using NzbDrone.Core.Update;
|
2016-04-25 19:53:26 +00:00
|
|
|
|
using NzbDrone.Common.Http.Proxy;
|
2014-02-16 09:56:12 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Config
|
|
|
|
|
{
|
|
|
|
|
public class HostConfigResource : RestResource
|
|
|
|
|
{
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string BindAddress { get; set; }
|
|
|
|
|
public int Port { get; set; }
|
|
|
|
|
public int SslPort { get; set; }
|
|
|
|
|
public bool EnableSsl { get; set; }
|
|
|
|
|
public bool LaunchBrowser { get; set; }
|
2015-01-26 02:03:21 +00:00
|
|
|
|
public AuthenticationType AuthenticationMethod { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public bool AnalyticsEnabled { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
public string Password { get; set; }
|
|
|
|
|
public string LogLevel { get; set; }
|
|
|
|
|
public string Branch { get; set; }
|
|
|
|
|
public string ApiKey { get; set; }
|
|
|
|
|
public string SslCertHash { get; set; }
|
|
|
|
|
public string UrlBase { get; set; }
|
|
|
|
|
public bool UpdateAutomatically { get; set; }
|
2014-04-28 06:34:29 +00:00
|
|
|
|
public UpdateMechanism UpdateMechanism { get; set; }
|
2015-10-03 17:45:26 +00:00
|
|
|
|
public string UpdateScriptPath { get; set; }
|
2016-02-02 18:42:22 +00:00
|
|
|
|
public bool ProxyEnabled { get; set; }
|
|
|
|
|
public ProxyType ProxyType { get; set; }
|
|
|
|
|
public string ProxyHostname { get; set; }
|
|
|
|
|
public int ProxyPort { get; set; }
|
|
|
|
|
public string ProxyUsername { get; set; }
|
|
|
|
|
public string ProxyPassword { get; set; }
|
2016-04-25 19:53:26 +00:00
|
|
|
|
public string ProxyBypassFilter { get; set; }
|
2016-02-02 18:42:22 +00:00
|
|
|
|
public bool ProxyBypassLocalAddresses { get; set; }
|
2014-02-16 09:56:12 +00:00
|
|
|
|
}
|
2016-03-25 00:56:29 +00:00
|
|
|
|
|
|
|
|
|
public static class HostConfigResourceMapper
|
|
|
|
|
{
|
|
|
|
|
public static HostConfigResource ToResource(this IConfigFileProvider model, IConfigService configService)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Clean this mess up. don't mix data from multiple classes, use sub-resources instead?
|
|
|
|
|
return new HostConfigResource
|
|
|
|
|
{
|
|
|
|
|
BindAddress = model.BindAddress,
|
|
|
|
|
Port = model.Port,
|
|
|
|
|
SslPort = model.SslPort,
|
|
|
|
|
EnableSsl = model.EnableSsl,
|
|
|
|
|
LaunchBrowser = model.LaunchBrowser,
|
|
|
|
|
AuthenticationMethod = model.AuthenticationMethod,
|
|
|
|
|
AnalyticsEnabled = model.AnalyticsEnabled,
|
|
|
|
|
//Username
|
|
|
|
|
//Password
|
|
|
|
|
LogLevel = model.LogLevel,
|
|
|
|
|
Branch = model.Branch,
|
|
|
|
|
ApiKey = model.ApiKey,
|
|
|
|
|
SslCertHash = model.SslCertHash,
|
|
|
|
|
UrlBase = model.UrlBase,
|
|
|
|
|
UpdateAutomatically = model.UpdateAutomatically,
|
|
|
|
|
UpdateMechanism = model.UpdateMechanism,
|
|
|
|
|
UpdateScriptPath = model.UpdateScriptPath,
|
|
|
|
|
ProxyEnabled = configService.ProxyEnabled,
|
|
|
|
|
ProxyType = configService.ProxyType,
|
|
|
|
|
ProxyHostname = configService.ProxyHostname,
|
|
|
|
|
ProxyPort = configService.ProxyPort,
|
|
|
|
|
ProxyUsername = configService.ProxyUsername,
|
|
|
|
|
ProxyPassword = configService.ProxyPassword,
|
|
|
|
|
ProxyBypassFilter = configService.ProxyBypassFilter,
|
|
|
|
|
ProxyBypassLocalAddresses = configService.ProxyBypassLocalAddresses
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-16 09:56:12 +00:00
|
|
|
|
}
|