mirror of
https://github.com/Jackett/Jackett
synced 2025-01-04 06:22:45 +00:00
Fix loopback & localhost entry points for mono
This commit is contained in:
parent
69ef08f019
commit
59d3e792b3
2 changed files with 20 additions and 9 deletions
|
@ -18,14 +18,23 @@ namespace Jackett.Models.Config
|
|||
public bool AllowExternal { get; set; }
|
||||
public string APIKey { get; set; }
|
||||
|
||||
public string GetListenAddress(bool? external = null)
|
||||
public string[] GetListenAddresses(bool? external = null)
|
||||
{
|
||||
|
||||
if (external == null)
|
||||
{
|
||||
external = AllowExternal;
|
||||
}
|
||||
return "http://" + (external.Value ? "*" : "127.0.0.1") + ":" + Port + "/";
|
||||
if (external.Value)
|
||||
{
|
||||
return new string[] { "http://*:" + Port + "/" };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new string[] {
|
||||
"http://127.0.0.1:" + Port + "/",
|
||||
"http://localhost:" + Port + "/",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateApi()
|
||||
|
|
|
@ -103,22 +103,24 @@ namespace Jackett.Services
|
|||
|
||||
// Load indexers
|
||||
indexerService.InitIndexers();
|
||||
|
||||
|
||||
// Start the server
|
||||
logger.Debug("Starting web server at " + config.GetListenAddress());
|
||||
_server = WebApp.Start<Startup>(url: config.GetListenAddress());
|
||||
logger.Debug("Starting web server at " + config.GetListenAddresses()[0]);
|
||||
var startOptions = new StartOptions();
|
||||
config.GetListenAddresses().ToList().ForEach(u => startOptions.Urls.Add(u));
|
||||
_server = WebApp.Start<Startup>(startOptions);
|
||||
logger.Debug("Web server started");
|
||||
}
|
||||
|
||||
public void ReserveUrls(bool doInstall = true)
|
||||
{
|
||||
logger.Debug("Unreserving Urls");
|
||||
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(false)));
|
||||
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(true)));
|
||||
config.GetListenAddresses(false).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
|
||||
config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
|
||||
if (doInstall)
|
||||
{
|
||||
logger.Debug("Reserving Urls");
|
||||
RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", config.GetListenAddress()));
|
||||
config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", u)));
|
||||
logger.Debug("Urls reserved");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue