mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Now works on Linux (headless), detailed logging, season searching
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Jackett
|
||||
{
|
||||
public class Server
|
||||
{
|
||||
int Port = 9117;
|
||||
public const int Port = 9117;
|
||||
|
||||
HttpListener listener;
|
||||
IndexerManager indexerManager;
|
||||
@@ -46,17 +46,17 @@ namespace Jackett
|
||||
}
|
||||
}
|
||||
|
||||
public async void Start()
|
||||
public async Task Start()
|
||||
{
|
||||
Program.LoggerInstance.Info("Starting HTTP server...");
|
||||
|
||||
try
|
||||
{
|
||||
listener.Start();
|
||||
Process.Start("http://127.0.0.1:" + Port);
|
||||
}
|
||||
catch (HttpListenerException ex)
|
||||
{
|
||||
Console.WriteLine("Server start exception: " + ex.ToString());
|
||||
var dialogResult = MessageBox.Show(
|
||||
"App must be ran as Admin for permission to use port " + Port + Environment.NewLine + "Restart app with admin privileges?",
|
||||
"Failed to open port",
|
||||
@@ -75,10 +75,18 @@ namespace Jackett
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Server start exception: " + ex.ToString());
|
||||
Program.LoggerInstance.ErrorException("Error: " + ex.Message, ex);
|
||||
return;
|
||||
}
|
||||
Program.LoggerInstance.Info("Server started on port " + Port);
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start("http://127.0.0.1:" + Port);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
while (true)
|
||||
{
|
||||
var context = await listener.GetContextAsync();
|
||||
@@ -115,6 +123,7 @@ namespace Jackett
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
Program.LoggerInstance.ErrorException(ex.Message + ex.ToString(), ex);
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
@@ -127,7 +136,11 @@ namespace Jackett
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
context.Response.Close();
|
||||
try
|
||||
{
|
||||
context.Response.Close();
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -157,6 +170,8 @@ namespace Jackett
|
||||
|
||||
var releases = await indexer.PerformQuery(torznabQuery);
|
||||
|
||||
Program.LoggerInstance.Debug(string.Format("Found {0} releases from {1}", releases.Length, indexer.DisplayName));
|
||||
|
||||
var severUrl = string.Format("{0}://{1}:{2}/", context.Request.Url.Scheme, context.Request.Url.Host, context.Request.Url.Port);
|
||||
|
||||
var resultPage = new ResultPage(new ChannelInfo
|
||||
|
Reference in New Issue
Block a user