This commit is contained in:
Zoe Roux 2021-01-11 22:58:58 +01:00
commit ac25a692fd
11 changed files with 71 additions and 62 deletions

View File

@ -88,13 +88,11 @@ 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;
}
}

View File

@ -45,15 +45,15 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<ProjectReference Include="..\Kyoo.CommonAPI\Kyoo.CommonAPI.csproj" />
<ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" />
</ItemGroup>
<ItemGroup>
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules/**" />
<StaticFiles Include="$(SpaRoot)static/**" />
<LoginFiles Include="$(LoginRoot)**" />
<StaticFiles Include="Views\Login\material-icons.css" />
<StaticFiles Include="Views/Login/material-icons.css" />
</ItemGroup>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
@ -104,6 +104,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\DatabaseMigrations\Internal" />
<Folder Include="Models/DatabaseMigrations/Internal" />
</ItemGroup>
</Project>

View File

@ -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())
{

View File

@ -1,4 +0,0 @@
#!/usr/bin/bash
cd /opt/kyoo || exit 1
dotnet Kyoo.dll

View File

@ -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

View File

@ -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

5
install/aur/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
Kyoo/
src/
pkg/
kyoo-1.0.0-1-x86_64.pkg.tar.zst

39
install/aur/PKGBUILD Normal file
View File

@ -0,0 +1,39 @@
# Maintainer: Zoe Roux <zoe.roux@sdg.moe>
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"
}

12
install/aur/kyoo.service Normal file
View File

@ -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

View File

@ -0,0 +1 @@
u kyoo - "Kyoo Media Server" /var/lib/kyoo

View File

@ -0,0 +1 @@
d /var/lib/kyoo 0755 kyoo kyoo