mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-04 22:24:14 -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
|
ARG TARGETARCH
|
||||||
WORKDIR /kyoo
|
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
|
RUN apt-get update && apt-get install -y curl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>default</LangVersion>
|
||||||
<Company>Kyoo</Company>
|
<Company>Kyoo</Company>
|
||||||
<Authors>Kyoo</Authors>
|
<Authors>Kyoo</Authors>
|
||||||
<Copyright>Copyright (c) Kyoo</Copyright>
|
<Copyright>Copyright (c) Kyoo</Copyright>
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
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.
|
/// An exception raised when an item already exists in the database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class DuplicatedItemException : Exception
|
public class DuplicatedItemException(object? existing = null) : Exception("Already exists in the database.")
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The existing object.
|
/// The existing object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object? Existing { get; }
|
public object? Existing { get; } = existing;
|
||||||
|
|
||||||
/// <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) { }
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||||
|
|
||||||
@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception
|
|||||||
/// <param name="message">The message of the exception</param>
|
/// <param name="message">The message of the exception</param>
|
||||||
public ItemNotFoundException(string message)
|
public ItemNotFoundException(string message)
|
||||||
: base(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/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||||
|
|
||||||
@ -29,7 +28,4 @@ public class UnauthorizedException : Exception
|
|||||||
|
|
||||||
public UnauthorizedException(string message)
|
public UnauthorizedException(string message)
|
||||||
: base(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());
|
Stream img = await thumbs.GetUserImage(User.GetIdOrThrow());
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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);
|
return File(img, "image/webp", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class CrudThumbsApi<T> : CrudApi<T>
|
|||||||
if (!identifier.Match(id => false, slug => slug == "random"))
|
if (!identifier.Match(id => false, slug => slug == "random"))
|
||||||
{
|
{
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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
|
else
|
||||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
Response.Headers.CacheControl = $"public, no-store";
|
||||||
return PhysicalFile(Path.GetFullPath(path), "image/webp", true);
|
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);
|
Stream img = await thumbs.GetUserImage(gid);
|
||||||
if (identifier.Is("random"))
|
if (identifier.Is("random"))
|
||||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
Response.Headers.CacheControl = $"public, no-store";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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);
|
return File(img, "image/webp", true);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Initial : Migration
|
public partial class Initial : Migration
|
||||||
{
|
{
|
||||||
@ -567,4 +567,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
migrationBuilder.DropTable(name: "studios");
|
migrationBuilder.DropTable(name: "studios");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -22,8 +22,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Watchlist : Migration
|
public partial class Watchlist : Migration
|
||||||
{
|
{
|
||||||
@ -221,4 +221,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
.OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned");
|
.OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Settings : Migration
|
public partial class Settings : Migration
|
||||||
{
|
{
|
||||||
@ -25,4 +25,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
migrationBuilder.DropColumn(name: "settings", table: "users");
|
migrationBuilder.DropColumn(name: "settings", table: "users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RuntimeNullable : Migration
|
public partial class RuntimeNullable : Migration
|
||||||
{
|
{
|
||||||
@ -55,4 +55,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RemoveUserLogo : Migration
|
public partial class RemoveUserLogo : Migration
|
||||||
{
|
{
|
||||||
@ -32,4 +32,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -3,8 +3,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddIssues : Migration
|
public partial class AddIssues : Migration
|
||||||
{
|
{
|
||||||
@ -65,4 +65,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddPlayPermission : Migration
|
public partial class AddPlayPermission : Migration
|
||||||
{
|
{
|
||||||
@ -19,4 +19,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder) { }
|
protected override void Down(MigrationBuilder migrationBuilder) { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddUserExternalId : Migration
|
public partial class AddUserExternalId : Migration
|
||||||
{
|
{
|
||||||
@ -25,4 +25,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
migrationBuilder.DropColumn(name: "external_id", table: "users");
|
migrationBuilder.DropColumn(name: "external_id", table: "users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -2,8 +2,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class MakePasswordOptional : Migration
|
public partial class MakePasswordOptional : Migration
|
||||||
{
|
{
|
||||||
@ -35,4 +35,3 @@ namespace Kyoo.Postgresql.Migrations
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user