mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Bugfixes (#2112)
* The module will need to be registered first thing in order to support commands such as --Help. * Ignore mac directory attribute files * Fix command line parameters not being correctly passed to the console
This commit is contained in:

committed by
flightlevel

parent
d055cf789f
commit
29e61feede
1
.gitignore
vendored
1
.gitignore
vendored
@@ -197,3 +197,4 @@ FakesAssemblies/
|
|||||||
/Build.mono
|
/Build.mono
|
||||||
/Build.windows
|
/Build.windows
|
||||||
/Output
|
/Output
|
||||||
|
*.DS_Store
|
||||||
|
@@ -21,6 +21,7 @@ namespace JackettConsole
|
|||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -32,7 +33,7 @@ namespace JackettConsole
|
|||||||
{
|
{
|
||||||
var help = new HelpText();
|
var help = new HelpText();
|
||||||
var errors = help.RenderParsingErrorsText(options, 2); // indent with two spaces
|
var errors = help.RenderParsingErrorsText(options, 2); // indent with two spaces
|
||||||
Console.WriteLine("Jackett v" + Engine.ConfigService.GetVersion());
|
Console.WriteLine("Jackett v" + JackettStartup.JackettVersion);
|
||||||
Console.WriteLine("Switch error: " + errors);
|
Console.WriteLine("Switch error: " + errors);
|
||||||
Console.WriteLine("See --help for further details on switches.");
|
Console.WriteLine("See --help for further details on switches.");
|
||||||
Environment.ExitCode = 1;
|
Environment.ExitCode = 1;
|
||||||
@@ -51,68 +52,38 @@ namespace JackettConsole
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SetJacketOptions(options);
|
||||||
|
// Initialize autofac, logger, etc. We cannot use any calls to Engine before the container is set up.
|
||||||
// Logging
|
|
||||||
if (options.Logging)
|
|
||||||
JackettStartup.LogRequests = true;
|
|
||||||
|
|
||||||
// Tracing
|
|
||||||
if (options.Tracing)
|
|
||||||
JackettStartup.TracingEnabled = true;
|
|
||||||
|
|
||||||
// Initialize autofac, logger, etc.
|
|
||||||
Engine.BuildContainer(new WebApi2Module());
|
Engine.BuildContainer(new WebApi2Module());
|
||||||
|
|
||||||
// Log after the fact as using the logger will cause the options above to be used
|
|
||||||
|
|
||||||
if (options.Logging)
|
if (options.Logging)
|
||||||
Engine.Logger.Info("Logging enabled.");
|
Engine.Logger.Info("Logging enabled.");
|
||||||
|
|
||||||
if (options.Tracing)
|
if (options.Tracing)
|
||||||
Engine.Logger.Info("Tracing enabled.");
|
Engine.Logger.Info("Tracing enabled.");
|
||||||
|
|
||||||
if (options.ListenPublic && options.ListenPrivate)
|
if (options.IgnoreSslErrors == true)
|
||||||
{
|
{
|
||||||
Console.WriteLine("You can only use listen private OR listen publicly.");
|
Engine.Logger.Info("Jackett will ignore SSL certificate errors.");
|
||||||
Environment.ExitCode = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* ====== Options ===== */
|
|
||||||
|
|
||||||
// SSL Fix
|
|
||||||
JackettStartup.DoSSLFix = options.SSLFix;
|
|
||||||
|
|
||||||
// Use curl
|
|
||||||
if (options.Client != null)
|
|
||||||
JackettStartup.ClientOverride = options.Client.ToLowerInvariant();
|
|
||||||
|
|
||||||
// Use Proxy
|
|
||||||
if (options.ProxyConnection != null)
|
|
||||||
{
|
|
||||||
JackettStartup.ProxyConnection = options.ProxyConnection.ToLowerInvariant();
|
|
||||||
Engine.Logger.Info("Proxy enabled. " + JackettStartup.ProxyConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.SSLFix == true)
|
if (options.SSLFix == true)
|
||||||
Engine.Logger.Info("SSL ECC workaround enabled.");
|
Engine.Logger.Info("SSL ECC workaround enabled.");
|
||||||
else if (options.SSLFix == false)
|
else if (options.SSLFix == false)
|
||||||
Engine.Logger.Info("SSL ECC workaround has been disabled.");
|
Engine.Logger.Info("SSL ECC workaround has been disabled.");
|
||||||
|
|
||||||
// Ignore SSL errors on Curl
|
|
||||||
JackettStartup.IgnoreSslErrors = options.IgnoreSslErrors;
|
|
||||||
if (options.IgnoreSslErrors == true)
|
|
||||||
{
|
|
||||||
Engine.Logger.Info("Jackett will ignore SSL certificate errors.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Choose Data Folder
|
// Choose Data Folder
|
||||||
if (!string.IsNullOrWhiteSpace(options.DataFolder))
|
if (!string.IsNullOrWhiteSpace(options.DataFolder))
|
||||||
{
|
{
|
||||||
JackettStartup.CustomDataFolder = options.DataFolder.Replace("\"", string.Empty).Replace("'", string.Empty).Replace(@"\\", @"\");
|
|
||||||
Engine.Logger.Info("Jackett Data will be stored in: " + JackettStartup.CustomDataFolder);
|
Engine.Logger.Info("Jackett Data will be stored in: " + JackettStartup.CustomDataFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Use Proxy
|
||||||
|
if (options.ProxyConnection != null)
|
||||||
|
{
|
||||||
|
Engine.Logger.Info("Proxy enabled. " + JackettStartup.ProxyConnection);
|
||||||
|
}
|
||||||
|
|
||||||
/* ====== Actions ===== */
|
/* ====== Actions ===== */
|
||||||
|
|
||||||
// Install service
|
// Install service
|
||||||
@@ -223,8 +194,6 @@ namespace JackettConsole
|
|||||||
Engine.SaveServerConfig();
|
Engine.SaveServerConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JackettStartup.NoRestart = options.NoRestart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine.Server.Initalize();
|
Engine.Server.Initalize();
|
||||||
@@ -237,6 +206,48 @@ namespace JackettConsole
|
|||||||
Engine.Logger.Error(e, "Top level exception");
|
Engine.Logger.Error(e, "Top level exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetJacketOptions(ConsoleOptions options)
|
||||||
|
{
|
||||||
|
// Logging
|
||||||
|
if (options.Logging)
|
||||||
|
JackettStartup.LogRequests = true;
|
||||||
|
|
||||||
|
// Tracing
|
||||||
|
if (options.Tracing)
|
||||||
|
JackettStartup.TracingEnabled = true;
|
||||||
|
|
||||||
|
if (options.ListenPublic && options.ListenPrivate)
|
||||||
|
{
|
||||||
|
Console.WriteLine("You can only use listen private OR listen publicly.");
|
||||||
|
Environment.ExitCode = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSL Fix
|
||||||
|
JackettStartup.DoSSLFix = options.SSLFix;
|
||||||
|
|
||||||
|
// Use curl
|
||||||
|
if (options.Client != null)
|
||||||
|
JackettStartup.ClientOverride = options.Client.ToLowerInvariant();
|
||||||
|
|
||||||
|
// Use Proxy
|
||||||
|
if (options.ProxyConnection != null)
|
||||||
|
{
|
||||||
|
JackettStartup.ProxyConnection = options.ProxyConnection.ToLowerInvariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Ignore SSL errors on Curl
|
||||||
|
JackettStartup.IgnoreSslErrors = options.IgnoreSslErrors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JackettStartup.NoRestart = options.NoRestart;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user