diff --git a/Kyoo/Controllers/AuthManager.cs b/Kyoo/Controllers/AuthManager.cs index 287dad4f..3c2c382d 100644 --- a/Kyoo/Controllers/AuthManager.cs +++ b/Kyoo/Controllers/AuthManager.cs @@ -87,14 +87,12 @@ namespace Kyoo.Controllers Pkcs12Store store = new Pkcs12StoreBuilder().Build(); store.SetKeyEntry("Kyoo_key", new AsymmetricKeyEntry(subjectKeyPair.Private), new [] {new X509CertificateEntry(bouncyCert)}); - - using (MemoryStream pfxStream = new MemoryStream()) - { - store.Save(pfxStream, password.ToCharArray(), random); - certificate = new X509Certificate2(pfxStream.ToArray(), password, X509KeyStorageFlags.Exportable); - using FileStream fileStream = File.OpenWrite(file); - pfxStream.WriteTo(fileStream); - } + + using MemoryStream pfxStream = new MemoryStream(); + store.Save(pfxStream, password.ToCharArray(), random); + certificate = new X509Certificate2(pfxStream.ToArray(), password, X509KeyStorageFlags.Exportable); + using FileStream fileStream = File.OpenWrite(file); + pfxStream.WriteTo(fileStream); return certificate; } } diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 32b3148f..c73f5ad2 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -45,15 +45,15 @@ - + - + - + @@ -104,6 +104,6 @@ - + diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index fc738d26..990b714e 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Reflection; using IdentityServer4.Services; using Kyoo.Api; @@ -37,7 +38,7 @@ namespace Kyoo { services.AddSpaStaticFiles(configuration => { - configuration.RootPath = "wwwroot"; + configuration.RootPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"); }); services.AddControllers() @@ -192,7 +193,7 @@ namespace Kyoo app.UseSpa(spa => { - spa.Options.SourcePath = "Views/WebClient"; + spa.Options.SourcePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "Views/WebClient"); if (env.IsDevelopment()) { diff --git a/Kyoo/kyoo.sh b/Kyoo/kyoo.sh deleted file mode 100644 index b614af45..00000000 --- a/Kyoo/kyoo.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/bash - -cd /opt/kyoo || exit 1 -dotnet Kyoo.dll \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 2ee5a44b..00000000 --- a/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -NEEDED = dotnet \ - cmake \ - gcc \ - node \ - npm - -ECHO = @echo -e -COL = \033[1;36m -RED = \033[1;31m -NOCOL = \033[0m - - -all: dependencies - -dependencies: - @for pkg in $(NEEDED); do \ - $$pkg --version >> /dev/null 2>&1 || ($(ECHO) "$(RED)ERROR: $$pkg could not be found.$(NOCOL)"; exit 1); \ - done - -install_kyoo: all - $(ECHO) "$(COL)Building the app$(NOCOL)" - @if ! [[ $$(mkdir --parent /opt/kyoo) -eq 0 && -w /opt/kyoo ]]; then echo -e "$(RED)You don't have permissions to install Kyoo. Try to re run with sudo privileges.$(NOCOL)"; exit 1; fi - dotnet publish -c Release -o /opt/kyoo Kyoo/Kyoo.csproj - id -u kyoo &> /dev/null || useradd -rU kyoo - chown -R kyoo /opt/kyoo - chgrp -R kyoo /opt/kyoo - chmod +x /opt/kyoo/kyoo.sh - -install: install_kyoo - chown -R kyoo /opt/kyoo - chgrp -R kyoo /opt/kyoo - -.PHONY = all dependencies transcoder diff --git a/install.sh b/install.sh deleted file mode 100755 index df9a0936..00000000 --- a/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -if [[ $(/usr/bin/id -u) -ne 0 ]]; then - echo "The script must be run as root since it create an user for kyoo and install the app inside the /opt folder." - exit -fi - -git clone https://github.com/AnonymusRaccoon/Kyoo --recurse -cd Kyoo -git pull --recurse -make install diff --git a/install/aur/.gitignore b/install/aur/.gitignore new file mode 100644 index 00000000..936548d0 --- /dev/null +++ b/install/aur/.gitignore @@ -0,0 +1,5 @@ +Kyoo/ +src/ +pkg/ +kyoo-1.0.0-1-x86_64.pkg.tar.zst + diff --git a/install/aur/PKGBUILD b/install/aur/PKGBUILD new file mode 100644 index 00000000..082b5874 --- /dev/null +++ b/install/aur/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: Zoe Roux +pkgname=kyoo +pkgver=1.0.0 +pkgrel=1 +epoch= +pkgdesc="A media browser." +arch=("i686" "x86_64" "armv6h") +url="https://github.com/AnonymusRaccoon/Kyoo" +license=("GPLv3") +groups=() +depends=("dotnet-runtime>=3" "aspnet-runtime>=3") +makedepends=("dotnet-sdk>=3" "cmake" "gcc" "make" "npm" "git") +source=("git+https://github.com/AnonymusRaccoon/Kyoo" #tag=v${pkgver} + "kyoo.service" + "kyoo.sysusers") +sha256sums=("SKIP" "SKIP" "SKIP") + + +prepare() { + # cd "Kyoo-$pkgver" + cd "Kyoo" + git submodule update --init --recursive +} + +build() { + # cd "Kyoo-$pkgver" + cd "Kyoo" + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + dotnet publish -c Release -o "$srcdir/output" Kyoo +} + +package() { + mkdir -p "$pkgdir/usr/lib" + mkdir -p "$pkgdir/var/lib/kyoo" + cp -r --no-preserve ownership "$srcdir/output" "$pkgdir/usr/lib/kyoo" + mv "$pkgdir/usr/lib/kyoo/appsettings.json" "$pkgdir/var/lib/kyoo/" + install -Dm 644 kyoo.service -t "$pkgdir/usr/lib/systemd/system/" + install -Dm 644 kyoo.sysusers "$pkgdir/usr/lib/sysusers.d/kyoo.conf" +} diff --git a/install/aur/kyoo.service b/install/aur/kyoo.service new file mode 100644 index 00000000..ceacfe65 --- /dev/null +++ b/install/aur/kyoo.service @@ -0,0 +1,12 @@ +[Unit] +Description=Kyoo Media Server +After=network.target + +[Service] +User=kyoo +ExecStart=/usr/lib/kyoo/Kyoo /var/lib/kyoo +Restart=on-abort +TimeoutSec=20 + +[Install] +WantedBy=multi-user.target diff --git a/install/aur/kyoo.sysusers b/install/aur/kyoo.sysusers new file mode 100644 index 00000000..35918eea --- /dev/null +++ b/install/aur/kyoo.sysusers @@ -0,0 +1 @@ +u kyoo - "Kyoo Media Server" /var/lib/kyoo diff --git a/install/aur/kyoo.tmpfiles b/install/aur/kyoo.tmpfiles new file mode 100644 index 00000000..c8772471 --- /dev/null +++ b/install/aur/kyoo.tmpfiles @@ -0,0 +1 @@ +d /var/lib/kyoo 0755 kyoo kyoo