diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml
index fc1679cb..ab5ed716 100644
--- a/.github/workflows/analysis.yml
+++ b/.github/workflows/analysis.yml
@@ -1,5 +1,5 @@
name: Analysis
-on: [push, pull_request]
+on: [push, pull_request, workflow_dispatch]
jobs:
analysis:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bd06596b..3d4429e5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,5 +1,5 @@
name: Build
-on: [push, pull_request]
+on: [push, pull_request, workflow_dispatch]
jobs:
build:
@@ -43,13 +43,16 @@ jobs:
if: matrix.artifact == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Build the app
+ shell: bash
env:
INCLUDE: ${{env.INCLUDE}};C:\Program Files\FFmpeg\include
LIB: ${{env.LIB}};C:\Program Files\FFmpeg\lib
LIBPATH: ${{env.LIBPATH}};C:\Program Files\FFmpeg\lib
CFLAGS: -I/usr/local/include
LDFLAGS: -L/usr/local/lib
- run: dotnet publish -r ${{matrix.runtime}} -c Release -o dist Kyoo
+ run: |
+ project=$([ "${{runner.os}}" == "Windows" ] && echo Kyoo.WindowsHost || echo Kyoo)
+ dotnet publish -r ${{matrix.runtime}} -c Release -o dist $project
- name: Compression output
shell: bash
run: |
@@ -71,7 +74,7 @@ jobs:
*.tar.gz
release:
- name: Create debian, rpm & arch releases
+ name: Create windows, debian, rpm & arch releases
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
@@ -80,12 +83,26 @@ jobs:
version: v0.0.1 #${{ github.ref }}
steps:
- uses: actions/checkout@v1
- - uses: actions/download-artifact@v2
+ - name: Download linux build
+ uses: actions/download-artifact@v2
with:
name: kyoo_linux
path: artifact
- name: Unzip the published files.
run: mkdir dist && tar -C dist -xzf artifact/kyoo_linux.tar.gz
+ - name: Download windows build
+ uses: actions/download-artifact@v2
+ with:
+ name: kyoo_windows
+ path: artifact
+ - name: Unzip windows files
+ run: mkdir dist_win && 7z e artifact/kyoo_windows.zip -o dist_win
+ - name: Install Inno Setup
+ run: |
+ curl -L https://jrsoftware.org/download.php/is.exe > innosetup.exe
+ ./innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /Log=log.txt || (cat log.txt && exit 1)
+ - name: Create windows installer
+ run: iscc -Dkyoo=$(realpath dist_win) -O./ -Fkyoo-windows deployment/kyoo-windows.iss
- name: Create the package structure
run: |
sudo mkdir -p pkg/usr/lib/
@@ -119,6 +136,10 @@ jobs:
with:
pkgdir: deployment
namcapDisable: true
+ - uses: actions/upload-artifact@v2
+ with:
+ name: kyoo_windows
+ path: ./*.exe
- uses: actions/upload-artifact@v2
with:
name: kyoo_rpm
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index e61395ff..c68715f0 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,6 +1,5 @@
name: Docker
-
-on: [push, pull_request]
+on: [push, pull_request, workflow_dispatch]
jobs:
build:
diff --git a/Kyoo.WindowsHost/Kyoo.WindowsHost.csproj b/Kyoo.WindowsHost/Kyoo.WindowsHost.csproj
index fe167974..eeb412ca 100644
--- a/Kyoo.WindowsHost/Kyoo.WindowsHost.csproj
+++ b/Kyoo.WindowsHost/Kyoo.WindowsHost.csproj
@@ -3,7 +3,6 @@
WinExe
net5.0-windows
- enable
true
Kyoo.Host.Windows
diff --git a/Kyoo.WindowsHost/Program.cs b/Kyoo.WindowsHost/Program.cs
index ace92e24..73c1cedc 100644
--- a/Kyoo.WindowsHost/Program.cs
+++ b/Kyoo.WindowsHost/Program.cs
@@ -1,6 +1,8 @@
+using System;
using System.Threading.Tasks;
using Autofac;
using Microsoft.Extensions.Hosting;
+using Microsoft.Win32;
namespace Kyoo.Host.Windows
{
@@ -13,6 +15,10 @@ namespace Kyoo.Host.Windows
///
public static async Task Main(string[] args)
{
+ object dataDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\SDG\Kyoo\Settings", "DataDir", null)
+ ?? Registry.GetValue(@"HKEY_CURRENT_USER\Software\SDG\Kyoo\Settings", "DataDir", null);
+ if (dataDir is string data)
+ Environment.SetEnvironmentVariable("KYOO_DATA_DIR", data);
Kyoo.Program.SetupDataDir(args);
IHost host = Kyoo.Program.CreateWebHostBuilder(args)
diff --git a/Kyoo.WindowsHost/SystemTrait.cs b/Kyoo.WindowsHost/SystemTrait.cs
index 121360b7..5201f239 100644
--- a/Kyoo.WindowsHost/SystemTrait.cs
+++ b/Kyoo.WindowsHost/SystemTrait.cs
@@ -23,7 +23,7 @@ namespace Kyoo.Host.Windows
///
/// The thread where the trait is running.
///
- private Thread? _thread;
+ private Thread _thread;
///
diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj
index 0ccab98e..4fc74690 100644
--- a/Kyoo/Kyoo.csproj
+++ b/Kyoo/Kyoo.csproj
@@ -59,4 +59,8 @@
false
+
+
+
+
diff --git a/Kyoo/Program.cs b/Kyoo/Program.cs
index c7fbe06a..b2844b39 100644
--- a/Kyoo/Program.cs
+++ b/Kyoo/Program.cs
@@ -65,13 +65,13 @@ namespace Kyoo
{
try
{
- host.Services.GetRequiredService>()
- .LogInformation("Running as {Name}", System.Environment.UserName);
+ Log.Information("Running as {Name}", System.Environment.UserName);
+ Log.Information("Data directory: {DataDirectory}", System.Environment.CurrentDirectory);
await host.RunAsync();
}
catch (Exception ex)
{
- host.Services.GetRequiredService>().LogCritical(ex, "Unhandled exception");
+ Log.Fatal(ex, "Unhandled exception");
}
}
diff --git a/deployment/kyoo-windows.iss b/deployment/kyoo-windows.iss
index 99d9d426..720ea594 100644
--- a/deployment/kyoo-windows.iss
+++ b/deployment/kyoo-windows.iss
@@ -9,12 +9,12 @@ AppUpdatesURL=https://github.com/AnonymusRaccoon/Kyoo
DefaultDirName={commonpf}\Kyoo
DisableProgramGroupPage=yes
LicenseFile={#kyoo}\LICENSE
-OutputBaseFilename=kyoo-windows
SetupIconFile={#kyoo}\wwwroot\favicon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
AppCopyright=GPL-3.0
+ArchitecturesInstallIn64BitMode=x64 arm64 ia64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
@@ -26,14 +26,41 @@ Name: "none"; Description: "Do not start automatically"; GroupDescription: "Star
[Files]
Source: "{#kyoo}\Kyoo.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "{#kyoo}\Kyoo.WindowsHost.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#kyoo}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+[Registry]
+Root: HKA; Subkey: "Software\SDG"; Flags: uninsdeletekeyifempty
+Root: HKA; Subkey: "Software\SDG\Kyoo"; Flags: uninsdeletekey
+Root: HKA; Subkey: "Software\SDG\Kyoo\Settings"; ValueType: string; ValueName: "DataDir"; ValueData: "{code:GetDataDir}"
+
[UninstallDelete]
-Type: filesandordirs; Name: "{commonappdata}\Kyoo"
+Type: filesandordirs; Name: "{code:GetDataDir}"
[Icons]
-Name: "{autoprograms}\Kyoo"; Filename: "{app}\Kyoo.exe"
-Name: "{autodesktop}\Kyoo"; Filename: "{app}\Kyoo.exe"; Tasks: desktopicon
+Name: "{autoprograms}\Kyoo"; Filename: "{app}\Kyoo.WindowsHost.exe"
+Name: "{autoprograms}\Kyoo (Console)"; Filename: "{app}\Kyoo.exe"
+Name: "{autodesktop}\Kyoo"; Filename: "{app}\Kyoo.WindowsHost.exe"; Tasks: desktopicon
[Run]
-Filename: "{app}\Kyoo.exe"; Description: "{cm:LaunchProgram,Kyoo}"; Flags: nowait postinstall skipifsilent
\ No newline at end of file
+Filename: "{app}\Kyoo.WindowsHost.exe"; Description: "{cm:LaunchProgram,Kyoo}"; Flags: nowait postinstall skipifsilent
+
+[Code]
+var
+ DataDirPage: TInputDirWizardPage;
+
+procedure InitializeWizard;
+begin
+ DataDirPage := CreateInputDirPage(wpSelectDir,
+ 'Choose Data Location', 'Choose the folder in which to install the Kyoo data',
+ 'The installer will set the following folder for Kyoo. To install in a different folder, click Browse and select another folder.' +
+ 'Please make sure the folder exists and is accessible. Do not choose the server install folder. Click Next to continue.',
+ False, '');
+ DataDirPage.Add('');
+ DataDirPage.Values[0] := GetPreviousData('DataDir', 'C:\ProgramData\Kyoo');
+end;
+
+function GetDataDir(Param: String): String;
+begin
+ Result := DataDirPage.Values[0];
+end;
\ No newline at end of file
diff --git a/deployment/kyoo.service b/deployment/kyoo.service
index 277c26ca..88b91542 100644
--- a/deployment/kyoo.service
+++ b/deployment/kyoo.service
@@ -5,7 +5,7 @@ After=network.target
[Service]
User=kyoo
-WorkingDirectory=/var/lib/kyoo
+Environment=KYOO_DATA_DIR=/var/lib/kyoo
ExecStart=/usr/lib/kyoo/Kyoo
Restart=on-abort
TimeoutSec=20