mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 16:06:24 +02:00
Run Nancy SelfHost locally only
Will run locally when URL hasn't been registered and not running in administrator context.
This commit is contained in:
@@ -18,6 +18,7 @@ namespace NzbDrone.Common
|
||||
public class HostController : IHostController
|
||||
{
|
||||
private readonly ConfigFileProvider _configFileProvider;
|
||||
private readonly SecurityProvider _securityProvider;
|
||||
private readonly INancyBootstrapper _bootstrapper;
|
||||
private readonly Logger _logger;
|
||||
private NancyHost _host;
|
||||
@@ -25,18 +26,22 @@ namespace NzbDrone.Common
|
||||
|
||||
public bool ServerStarted { get; private set; }
|
||||
|
||||
public HostController(ConfigFileProvider configFileProvider, INancyBootstrapper bootstrapper, Logger logger)
|
||||
public HostController(ConfigFileProvider configFileProvider, SecurityProvider securityProvider, INancyBootstrapper bootstrapper, Logger logger)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
_securityProvider = securityProvider;
|
||||
_bootstrapper = bootstrapper;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void StartServer()
|
||||
{
|
||||
//Todo: We need this to be able run when the user isn't an admin
|
||||
//Todo: And when the URL hasn't been registered in URL ACL: netsh http add urlacl url=http://+:8989/ user=everyone
|
||||
_host = new NancyHost(new Uri(AppUrl), _bootstrapper);
|
||||
if (_securityProvider.IsNzbDroneUrlRegistered())
|
||||
_host = new NancyHost(new Uri(AppUrl), _bootstrapper);
|
||||
|
||||
else
|
||||
_host = new NancyHost(new Uri(AppUrl), _bootstrapper, new HostConfiguration { RewriteLocalhost = false });
|
||||
|
||||
_host.Start();
|
||||
}
|
||||
|
||||
@@ -45,7 +50,6 @@ namespace NzbDrone.Common
|
||||
get { return string.Format("http://localhost:{0}", _configFileProvider.Port); }
|
||||
}
|
||||
|
||||
|
||||
public void RestartServer()
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user