1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-28 23:07:13 -04:00

Fixed: Automation/Integration/Unit Tests

This commit is contained in:
Qstick
2019-09-02 22:22:25 -04:00
parent 944f420270
commit 7f221c7834
123 changed files with 1384 additions and 1191 deletions
@@ -0,0 +1,46 @@
using NzbDrone.Common.EnvironmentInfo;
namespace Radarr.Host.AccessControl
{
public interface IRemoteAccessAdapter
{
void MakeAccessible(bool passive);
}
public class RemoteAccessAdapter : IRemoteAccessAdapter
{
private readonly IRuntimeInfo _runtimeInfo;
private readonly IUrlAclAdapter _urlAclAdapter;
private readonly IFirewallAdapter _firewallAdapter;
private readonly ISslAdapter _sslAdapter;
public RemoteAccessAdapter(IRuntimeInfo runtimeInfo,
IUrlAclAdapter urlAclAdapter,
IFirewallAdapter firewallAdapter,
ISslAdapter sslAdapter)
{
_runtimeInfo = runtimeInfo;
_urlAclAdapter = urlAclAdapter;
_firewallAdapter = firewallAdapter;
_sslAdapter = sslAdapter;
}
public void MakeAccessible(bool passive)
{
if (OsInfo.IsWindows)
{
if (_runtimeInfo.IsAdmin)
{
_firewallAdapter.MakeAccessible();
_sslAdapter.Register();
}
else if (!passive)
{
throw new RemoteAccessException("Failed to register URLs for Radarr. Radarr will not be accessible remotely");
}
}
_urlAclAdapter.ConfigureUrls();
}
}
}
@@ -0,0 +1,24 @@
using System;
using NzbDrone.Common.Exceptions;
namespace Radarr.Host.AccessControl
{
public class RemoteAccessException : NzbDroneException
{
public RemoteAccessException(string message, params object[] args) : base(message, args)
{
}
public RemoteAccessException(string message) : base(message)
{
}
public RemoteAccessException(string message, Exception innerException, params object[] args) : base(message, innerException, args)
{
}
public RemoteAccessException(string message, Exception innerException) : base(message, innerException)
{
}
}
}