You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Host/WebHost/AccessControl/RemoteAccessAdapter.cs

33 lines
972 B

using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Host.AccessControl
{
public class RemoteAccessAdapter : IRemoteAccessAdapter
{
private readonly IRuntimeInfo _runtimeInfo;
private readonly IFirewallAdapter _firewallAdapter;
public RemoteAccessAdapter(IRuntimeInfo runtimeInfo,
IFirewallAdapter firewallAdapter)
{
_runtimeInfo = runtimeInfo;
_firewallAdapter = firewallAdapter;
}
public void MakeAccessible(bool passive)
{
if (OsInfo.IsWindows)
{
if (_runtimeInfo.IsAdmin)
{
_firewallAdapter.MakeAccessible();
}
else if (!passive)
{
throw new RemoteAccessException("Failed to register URLs for Lidarr. Lidarr will not be accessible remotely");
}
}
}
}
}