diff --git a/Build.bat b/Build.bat index 8ee0b9dc0..c524d6c2a 100644 --- a/Build.bat +++ b/Build.bat @@ -1,5 +1,6 @@ rmdir /s /q build +rmdir /s /q Output cd src Msbuild Jackett.sln /t:Clean,Build /p:Configuration=Release cd .. @@ -9,6 +10,8 @@ copy /Y src\Jackett.Service\bin\Release\JackettService.exe build\JackettService. copy /Y src\Jackett.Service\bin\Release\JackettService.exe.config build\JackettService.exe.config copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe build\JackettTray.exe copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe.config build\JackettTray.exe.config +copy /Y LICENSE build\LICENSE +copy /Y README.md build\README.md cd build del *.pdb del *.xml diff --git a/Installer.iss b/Installer.iss index 852a8de14..6733eda52 100644 --- a/Installer.iss +++ b/Installer.iss @@ -51,6 +51,7 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang [Run] Filename: "{app}\JackettConsole.exe"; Parameters: "--Uninstall"; Flags: waituntilterminated; Filename: "{app}\JackettConsole.exe"; Parameters: "--ReserveUrls"; Flags: waituntilterminated; +Filename: "{app}\JackettConsole.exe"; Parameters: "--MigrateSettings"; Flags: waituntilterminated; Filename: "{app}\JackettConsole.exe"; Parameters: "--Install"; Flags: waituntilterminated; Tasks: windowsService Filename: "{app}\JackettConsole.exe"; Parameters: "--Start"; Flags: waituntilterminated; Tasks: windowsService diff --git a/src/Jackett.Console/ConsoleOptions.cs b/src/Jackett.Console/ConsoleOptions.cs index 5614b888f..34030a6b2 100644 --- a/src/Jackett.Console/ConsoleOptions.cs +++ b/src/Jackett.Console/ConsoleOptions.cs @@ -9,8 +9,6 @@ namespace Jackett.Console { public class ConsoleOptions { - private bool listenPublic = false; - [Option('i', "Install", HelpText = "Install Jackett windows service (Must be admin)")] public bool Install { get; set; } @@ -20,13 +18,13 @@ namespace Jackett.Console [Option('u', "Uninstall", HelpText = "Uninstall Jackett windows service (Must be admin).")] public bool Uninstall { get; set; } - [Option('l', "Logging", DefaultValue = false, HelpText = "Log all requests/responses to Jackett")] + [Option('l', "Logging", HelpText = "Log all requests/responses to Jackett")] public bool Logging { get; set; } - [Option('t', "Tracing", DefaultValue = false, HelpText = "Enable tracing")] + [Option('t', "Tracing", HelpText = "Enable tracing")] public bool Tracing { get; set; } - [Option('c', "UseCurlExec", DefaultValue = false, HelpText = "Execute curl rather than libcurl for all outgoing requests.")] + [Option('c', "UseCurlExec", HelpText = "Execute curl rather than libcurl for all outgoing requests.")] public bool UseCurlExec { get; set; } [Option('s', "Start", HelpText = "Start the Jacket Windows service (Must be admin)")] @@ -47,5 +45,7 @@ namespace Jackett.Console [Option('p', "Port", HelpText = "Web server port")] public int Port { get; set; } + [Option('m', "MigrateSettings", HelpText = "Migrate settings manually (Must be admin on Windows)")] + public bool MigrateSettings { get; set; } } } diff --git a/src/Jackett.Console/Jackett.Console.csproj b/src/Jackett.Console/Jackett.Console.csproj index 63fbb1843..f5063bb4f 100644 --- a/src/Jackett.Console/Jackett.Console.csproj +++ b/src/Jackett.Console/Jackett.Console.csproj @@ -16,7 +16,7 @@ - AnyCPU + x64 true full false diff --git a/src/Jackett.Console/Program.cs b/src/Jackett.Console/Program.cs index 9d794a088..afbbd5ce1 100644 --- a/src/Jackett.Console/Program.cs +++ b/src/Jackett.Console/Program.cs @@ -34,6 +34,31 @@ namespace JackettConsole } else { + /* ====== Options ===== */ + + // Use curl + if (options.UseCurlExec) + Startup.CurlSafe = true; + + // Logging + if (options.Logging) + Startup.LogRequests = true; + + // Tracing + if (options.Tracing) + Startup.TracingEnabled = true; + + // Log after the fact as using the logger will cause the options above to be used + + if (options.UseCurlExec) + Engine.Logger.Info("Safe curl enabled."); + + if (options.Logging) + Engine.Logger.Info("Logging enabled."); + + if (options.Tracing) + Engine.Logger.Info("Tracing enabled."); + /* ====== Actions ===== */ // Install service @@ -78,6 +103,13 @@ namespace JackettConsole return; } + // Migrate settings + if (options.MigrateSettings) + { + Engine.ConfigService.PerformMigration(); + return; + } + // Show Version if (options.ShowVersion) @@ -86,31 +118,14 @@ namespace JackettConsole return; } - /* ====== Options ===== */ - - // Logging - if (options.Logging) - { - Startup.LogRequests = true; - } - - // Tracing - if (options.Tracing) - { - Startup.TracingEnabled = true; - } - - // Use curl - if (options.UseCurlExec) - { - Startup.CurlSafe = true; - } + /* ====== Overrides ===== */ // Override listen public if(options.ListenPublic.HasValue) { - if(Engine.Server.Config.AllowExternal != options.ListenPublic) + if (Engine.Server.Config.AllowExternal != options.ListenPublic) { + Engine.Logger.Info("Overriding external access to " + options.ListenPublic); Engine.Server.Config.AllowExternal = options.ListenPublic.Value; if (System.Environment.OSVersion.Platform != PlatformID.Unix) { @@ -125,6 +140,8 @@ namespace JackettConsole return; } } + + Engine.Server.SaveConfig(); } } @@ -133,6 +150,7 @@ namespace JackettConsole { if (Engine.Server.Config.Port != options.Port) { + Engine.Logger.Info("Overriding port to " + options.Port); Engine.Server.Config.Port = options.Port; if (System.Environment.OSVersion.Platform != PlatformID.Unix) { @@ -147,6 +165,8 @@ namespace JackettConsole return; } } + + Engine.Server.SaveConfig(); } } } diff --git a/src/Jackett/Content/custom.css b/src/Jackett/Content/custom.css index 14280a204..9628b9cef 100644 --- a/src/Jackett/Content/custom.css +++ b/src/Jackett/Content/custom.css @@ -203,3 +203,7 @@ hr { margin-top: 10px; text-align: center; } + +#jackett-allowext { + width: 25px; +} diff --git a/src/Jackett/Content/custom.js b/src/Jackett/Content/custom.js index 8c4017828..7837ade39 100644 --- a/src/Jackett/Content/custom.js +++ b/src/Jackett/Content/custom.js @@ -7,6 +7,7 @@ function loadJackettSettings() { $("#api-key-input").val(data.config.api_key); $("#app-version").html(data.app_version); $("#jackett-port").val(data.config.port); + $("#jackett-allowext").attr('checked', data.config.external); var password = data.config.password; $("#jackett-adminpwd").val(password); if (password != null && password != '') { @@ -17,20 +18,21 @@ function loadJackettSettings() { $("#change-jackett-port").click(function () { var jackett_port = $("#jackett-port").val(); - var jsonObject = { port: jackett_port}; + var jackett_external = $("#jackett-allowext").is(':checked'); + var jsonObject = { port: jackett_port, external: jackett_external}; var jqxhr = $.post("/admin/set_port", JSON.stringify(jsonObject), function (data) { - if (data.result == "error") { doNotify("Error: " + data.error, "danger", "glyphicon glyphicon-alert"); return; } else { doNotify("The port has been changed. Redirecting you to the new port.", "success", "glyphicon glyphicon-ok"); - var jqxhr0 = $.post("admin/jackett_restart", null, function (data_restart) { }); - window.setTimeout(function () { url = window.location.href; - window.location.href = url.substr(0, url.lastIndexOf(":") + 1) + data.port; - + if (data.external) { + window.location.href = url.substr(0, url.lastIndexOf(":") + 1) + data.port; + } else { + window.location.href = 'http://127.0.0.1:' + data.port; + } }, 3000); } diff --git a/src/Jackett/Content/index.html b/src/Jackett/Content/index.html index ef01513c4..97c146c40 100644 --- a/src/Jackett/Content/index.html +++ b/src/Jackett/Content/index.html @@ -35,26 +35,33 @@ API Key: + +
+

Configured Indexers

+
+
+

Jackett Configuration

Admin Password: - +
Server port:
-
-

Configured Indexers

-
+
+ External access: + +