mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Merge branch 'master' of https://github.com/Jackett/Jackett
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
#define MyAppName "Jackett"
|
#define MyAppName "Jackett"
|
||||||
#define MyAppVersion GetFileVersion("BuildOutput\FullFramework\Windows\Jackett\Jackett.Common.dll")
|
#define MyAppVersion GetFileVersion(MyFileForVersion)
|
||||||
#define MyAppPublisher "Jackett Inc."
|
#define MyAppPublisher "Jackett"
|
||||||
#define MyAppURL "https://github.com/Jackett/Jackett"
|
#define MyAppURL "https://github.com/Jackett/Jackett"
|
||||||
#define MyAppExeName "JackettTray.exe"
|
#define MyAppExeName "JackettTray.exe"
|
||||||
|
|
||||||
@@ -22,9 +22,10 @@ AppUpdatesURL={#MyAppURL}
|
|||||||
DefaultDirName={pf}\{#MyAppName}
|
DefaultDirName={pf}\{#MyAppName}
|
||||||
DefaultGroupName={#MyAppName}
|
DefaultGroupName={#MyAppName}
|
||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
OutputBaseFilename=Jackett.Installer.Windows
|
OutputBaseFilename={#MyOutputFilename}
|
||||||
SetupIconFile=src\Jackett.Console\jackett.ico
|
SetupIconFile=src\Jackett.Console\jackett.ico
|
||||||
UninstallDisplayIcon={commonappdata}\Jackett\JackettConsole.exe
|
UninstallDisplayIcon={commonappdata}\Jackett\JackettConsole.exe
|
||||||
|
VersionInfoVersion={#MyAppVersion}
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
DisableDirPage=yes
|
DisableDirPage=yes
|
||||||
@@ -37,9 +38,7 @@ Name: "windowsService"; Description: "Install as a Windows Service"
|
|||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "BuildOutput\FullFramework\Windows\Jackett\JackettTray.exe"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion
|
Source: "{#MySourceFolder}\Jackett\*"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||||
Source: "BuildOutput\FullFramework\Windows\Jackett\JackettUpdater.exe"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion
|
|
||||||
Source: "BuildOutput\FullFramework\Windows\Jackett\*"; DestDir: "{commonappdata}\Jackett"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
15
build.cake
15
build.cake
@@ -119,9 +119,18 @@ Task("Package-Windows-Installer-Full-Framework")
|
|||||||
.IsDependentOn("Check-Packaging-Platform")
|
.IsDependentOn("Check-Packaging-Platform")
|
||||||
.Does(() =>
|
.Does(() =>
|
||||||
{
|
{
|
||||||
InnoSetup("./Installer.iss", new InnoSetupSettings {
|
string sourceFolder = MakeAbsolute(Directory(windowsBuildFullFramework)).ToString();
|
||||||
OutputDirectory = workingDir + "/" + artifactsDirName
|
|
||||||
});
|
InnoSetupSettings settings = new InnoSetupSettings();
|
||||||
|
settings.OutputDirectory = workingDir + "/" + artifactsDirName;
|
||||||
|
settings.Defines = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{ "MyFileForVersion", sourceFolder + "/Jackett/Jackett.Common.dll" },
|
||||||
|
{ "MySourceFolder", sourceFolder },
|
||||||
|
{ "MyOutputFilename", "Jackett.Installer.Windows" },
|
||||||
|
};
|
||||||
|
|
||||||
|
InnoSetup("./Installer.iss", settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Package-Files-Full-Framework-Windows")
|
Task("Package-Files-Full-Framework-Windows")
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<startup>
|
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
|
||||||
</startup>
|
|
||||||
<system.net>
|
|
||||||
<settings>
|
|
||||||
<!-- needed to make the broken incapsula DDoS protection work on windows(e.g. for KickAssTorrent), see https://social.technet.microsoft.com/Forums/de-DE/b10b16d1-8eea-4b52-8aeb-f96ea87135fa/sectionresponseheader-detailcr-must-be-followed-by-lf?forum=powerquery -->
|
|
||||||
<httpWebRequest useUnsafeHeaderParsing="true" />
|
|
||||||
</settings>
|
|
||||||
</system.net>
|
|
||||||
</configuration>
|
|
@@ -14,6 +14,7 @@
|
|||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
<RuntimeIdentifier>win</RuntimeIdentifier>
|
<RuntimeIdentifier>win</RuntimeIdentifier>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -65,25 +66,14 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="jackett.ico" />
|
<Content Include="jackett.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CurlSharp\CurlSharp.csproj">
|
|
||||||
<Project>{74420a79-cc16-442c-8b1e-7c1b913844f0}</Project>
|
|
||||||
<Name>CurlSharp</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Jackett.Common\Jackett.Common.csproj">
|
<ProjectReference Include="..\Jackett.Common\Jackett.Common.csproj">
|
||||||
<Project>{6B854A1B-9A90-49C0-BC37-9A35C75BCA73}</Project>
|
<Project>{6B854A1B-9A90-49C0-BC37-9A35C75BCA73}</Project>
|
||||||
<Name>Jackett.Common</Name>
|
<Name>Jackett.Common</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
|
||||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
|
||||||
<Name>Jackett</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
@@ -1,29 +1,100 @@
|
|||||||
using Jackett.Common.Models.Config;
|
using Jackett.Common.Models.Config;
|
||||||
|
using Jackett.Common.Services;
|
||||||
|
using Jackett.Common.Services.Interfaces;
|
||||||
|
using Jackett.Common.Utils;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using Jackett.Common;
|
|
||||||
|
|
||||||
namespace Jackett.Service
|
namespace Jackett.Service
|
||||||
{
|
{
|
||||||
public partial class Service : ServiceBase
|
public partial class Service : ServiceBase
|
||||||
{
|
{
|
||||||
|
private IProcessService processService;
|
||||||
|
private Process consoleProcess;
|
||||||
|
private Logger logger;
|
||||||
|
private bool serviceStopInitiated;
|
||||||
|
|
||||||
public Service()
|
public Service()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
RuntimeSettings runtimeSettings = new RuntimeSettings()
|
||||||
|
{
|
||||||
|
CustomLogFileName = "ServiceLog.txt"
|
||||||
|
};
|
||||||
|
|
||||||
|
LogManager.Configuration = LoggingSetup.GetLoggingConfiguration(runtimeSettings);
|
||||||
|
logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
logger.Info("Initiating Jackett Service v" + EnvironmentUtil.JackettVersion);
|
||||||
|
|
||||||
|
processService = new ProcessService(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStart(string[] args)
|
protected override void OnStart(string[] args)
|
||||||
{
|
{
|
||||||
Engine.BuildContainer(new RuntimeSettings(), new WebApi2Module());
|
logger.Info("Service starting");
|
||||||
Engine.Logger.Info("Service starting");
|
serviceStopInitiated = false;
|
||||||
Engine.Server.Initalize();
|
StartConsoleApplication();
|
||||||
Engine.Server.Start();
|
|
||||||
Engine.Logger.Info("Service started");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStop()
|
protected override void OnStop()
|
||||||
{
|
{
|
||||||
Engine.Logger.Info("Service stopping");
|
logger.Info("Service stopping");
|
||||||
Engine.Server.Stop();
|
serviceStopInitiated = true;
|
||||||
|
StopConsoleApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartConsoleApplication()
|
||||||
|
{
|
||||||
|
string applicationFolder = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
|
||||||
|
|
||||||
|
var exePath = Path.Combine(applicationFolder, "JackettConsole.exe");
|
||||||
|
|
||||||
|
var startInfo = new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = false,
|
||||||
|
FileName = exePath,
|
||||||
|
RedirectStandardInput = true,
|
||||||
|
RedirectStandardError = true
|
||||||
|
};
|
||||||
|
|
||||||
|
consoleProcess = Process.Start(startInfo);
|
||||||
|
consoleProcess.EnableRaisingEvents = true;
|
||||||
|
consoleProcess.Exited += ProcessExited;
|
||||||
|
consoleProcess.ErrorDataReceived += ProcessErrorDataReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessErrorDataReceived(object sender, DataReceivedEventArgs e)
|
||||||
|
{
|
||||||
|
logger.Error(e.Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!serviceStopInitiated)
|
||||||
|
{
|
||||||
|
logger.Info("Service stop not responsible for process exit");
|
||||||
|
OnStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopConsoleApplication()
|
||||||
|
{
|
||||||
|
if (consoleProcess != null && !consoleProcess.HasExited)
|
||||||
|
{
|
||||||
|
consoleProcess.StandardInput.Close();
|
||||||
|
System.Threading.Thread.Sleep(1000);
|
||||||
|
if (consoleProcess != null && !consoleProcess.HasExited)
|
||||||
|
{
|
||||||
|
consoleProcess.Kill();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -69,10 +69,6 @@
|
|||||||
<Project>{6B854A1B-9A90-49C0-BC37-9A35C75BCA73}</Project>
|
<Project>{6B854A1B-9A90-49C0-BC37-9A35C75BCA73}</Project>
|
||||||
<Name>Jackett.Common</Name>
|
<Name>Jackett.Common</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Jackett.Service\Jackett.Service.csproj">
|
|
||||||
<Project>{bf611f7b-4658-4cb8-aa9e-0736fadaa3ba}</Project>
|
|
||||||
<Name>Jackett.Service</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||||
<Name>Jackett</Name>
|
<Name>Jackett</Name>
|
||||||
|
Reference in New Issue
Block a user