mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 21:24:20 -04:00
Migrate to dotnet8
This commit is contained in:
parent
5fedce71a0
commit
5a461bca7d
@ -1,4 +1,4 @@
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 as builder
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as builder
|
||||
ARG TARGETARCH
|
||||
WORKDIR /kyoo
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
WORKDIR /app
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Company>Kyoo</Company>
|
||||
<Authors>Kyoo</Authors>
|
||||
<Copyright>Copyright (c) Kyoo</Copyright>
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||
|
||||
@ -25,28 +24,10 @@ namespace Kyoo.Abstractions.Models.Exceptions;
|
||||
/// An exception raised when an item already exists in the database.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class DuplicatedItemException : Exception
|
||||
public class DuplicatedItemException(object? existing = null) : Exception("Already exists in the database.")
|
||||
{
|
||||
/// <summary>
|
||||
/// The existing object.
|
||||
/// </summary>
|
||||
public object? Existing { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="DuplicatedItemException"/> with the default message.
|
||||
/// </summary>
|
||||
/// <param name="existing">The existing object.</param>
|
||||
public DuplicatedItemException(object? existing = null)
|
||||
: base("Already exists in the database.")
|
||||
{
|
||||
Existing = existing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The serialization constructor.
|
||||
/// </summary>
|
||||
/// <param name="info">Serialization infos</param>
|
||||
/// <param name="context">The serialization context</param>
|
||||
protected DuplicatedItemException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
public object? Existing { get; } = existing;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||
|
||||
@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception
|
||||
/// <param name="message">The message of the exception</param>
|
||||
public ItemNotFoundException(string message)
|
||||
: base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// The serialization constructor
|
||||
/// </summary>
|
||||
/// <param name="info">Serialization infos</param>
|
||||
/// <param name="context">The serialization context</param>
|
||||
protected ItemNotFoundException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||
|
||||
@ -29,7 +28,4 @@ public class UnauthorizedException : Exception
|
||||
|
||||
public UnauthorizedException(string message)
|
||||
: base(message) { }
|
||||
|
||||
protected UnauthorizedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ public class AuthApi(
|
||||
{
|
||||
Stream img = await thumbs.GetUserImage(User.GetIdOrThrow());
|
||||
// Allow clients to cache the image for 6 month.
|
||||
Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
|
||||
Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
|
||||
return File(img, "image/webp", true);
|
||||
}
|
||||
|
||||
|
@ -74,10 +74,10 @@ public class CrudThumbsApi<T> : CrudApi<T>
|
||||
if (!identifier.Match(id => false, slug => slug == "random"))
|
||||
{
|
||||
// Allow clients to cache the image for 6 month.
|
||||
Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
|
||||
Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
|
||||
}
|
||||
else
|
||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
||||
Response.Headers.CacheControl = $"public, no-store";
|
||||
return PhysicalFile(Path.GetFullPath(path), "image/webp", true);
|
||||
}
|
||||
|
||||
|
@ -59,11 +59,11 @@ public class UserApi(ILibraryManager libraryManager, IThumbnailsManager thumbs)
|
||||
);
|
||||
Stream img = await thumbs.GetUserImage(gid);
|
||||
if (identifier.Is("random"))
|
||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
||||
Response.Headers.CacheControl = $"public, no-store";
|
||||
else
|
||||
{
|
||||
// Allow clients to cache the image for 6 month.
|
||||
Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}");
|
||||
Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}";
|
||||
}
|
||||
return File(img, "image/webp", true);
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -566,5 +566,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
migrationBuilder.DropTable(name: "studios");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class Watchlist : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Watchlist : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -220,5 +220,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
.OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||
.OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class Settings : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Settings : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -24,5 +24,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
migrationBuilder.DropColumn(name: "settings", table: "users");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class RuntimeNullable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RuntimeNullable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -54,5 +54,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
oldNullable: true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveUserLogo : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveUserLogo : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -31,5 +31,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
nullable: true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddIssues : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddIssues : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -64,5 +64,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
principalColumn: "id"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddPlayPermission : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPlayPermission : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -18,5 +18,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) { }
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddUserExternalId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUserExternalId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -24,5 +24,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
{
|
||||
migrationBuilder.DropColumn(name: "external_id", table: "users");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kyoo.Postgresql.Migrations
|
||||
namespace Kyoo.Postgresql.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class MakePasswordOptional : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class MakePasswordOptional : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -34,5 +34,4 @@ namespace Kyoo.Postgresql.Migrations
|
||||
oldNullable: true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user