mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Fix loopback & localhost entry points for mono
This commit is contained in:
@@ -18,14 +18,23 @@ namespace Jackett.Models.Config
|
|||||||
public bool AllowExternal { get; set; }
|
public bool AllowExternal { get; set; }
|
||||||
public string APIKey { get; set; }
|
public string APIKey { get; set; }
|
||||||
|
|
||||||
public string GetListenAddress(bool? external = null)
|
public string[] GetListenAddresses(bool? external = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (external == null)
|
if (external == null)
|
||||||
{
|
{
|
||||||
external = AllowExternal;
|
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()
|
public string GenerateApi()
|
||||||
|
@@ -103,22 +103,24 @@ namespace Jackett.Services
|
|||||||
|
|
||||||
// Load indexers
|
// Load indexers
|
||||||
indexerService.InitIndexers();
|
indexerService.InitIndexers();
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
logger.Debug("Starting web server at " + config.GetListenAddress());
|
logger.Debug("Starting web server at " + config.GetListenAddresses()[0]);
|
||||||
_server = WebApp.Start<Startup>(url: config.GetListenAddress());
|
var startOptions = new StartOptions();
|
||||||
|
config.GetListenAddresses().ToList().ForEach(u => startOptions.Urls.Add(u));
|
||||||
|
_server = WebApp.Start<Startup>(startOptions);
|
||||||
logger.Debug("Web server started");
|
logger.Debug("Web server started");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReserveUrls(bool doInstall = true)
|
public void ReserveUrls(bool doInstall = true)
|
||||||
{
|
{
|
||||||
logger.Debug("Unreserving Urls");
|
logger.Debug("Unreserving Urls");
|
||||||
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(false)));
|
config.GetListenAddresses(false).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
|
||||||
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(true)));
|
config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
|
||||||
if (doInstall)
|
if (doInstall)
|
||||||
{
|
{
|
||||||
logger.Debug("Reserving Urls");
|
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");
|
logger.Debug("Urls reserved");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user