mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Merge branch 'develop' of https://github.com/Kareadita/Kavita into develop
This commit is contained in:
commit
d3ce3d9eee
@ -1,4 +1,5 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using Kavita.Common;
|
||||||
|
|
||||||
namespace API.Extensions
|
namespace API.Extensions
|
||||||
{
|
{
|
||||||
@ -6,7 +7,9 @@ namespace API.Extensions
|
|||||||
{
|
{
|
||||||
public static string GetUsername(this ClaimsPrincipal user)
|
public static string GetUsername(this ClaimsPrincipal user)
|
||||||
{
|
{
|
||||||
return user.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
var userClaim = user.FindFirst(ClaimTypes.NameIdentifier);
|
||||||
|
if (userClaim == null) throw new KavitaException("User is not authenticated");
|
||||||
|
return userClaim.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -99,6 +99,7 @@ namespace API
|
|||||||
options.AddExceptionFilterForType<OutOfMemoryException>();
|
options.AddExceptionFilterForType<OutOfMemoryException>();
|
||||||
options.AddExceptionFilterForType<NetVips.VipsException>();
|
options.AddExceptionFilterForType<NetVips.VipsException>();
|
||||||
options.AddExceptionFilterForType<InvalidDataException>();
|
options.AddExceptionFilterForType<InvalidDataException>();
|
||||||
|
options.AddExceptionFilterForType<KavitaException>();
|
||||||
|
|
||||||
options.BeforeSend = sentryEvent =>
|
options.BeforeSend = sentryEvent =>
|
||||||
{
|
{
|
||||||
|
21
Kavita.Common/KavitaException.cs
Normal file
21
Kavita.Common/KavitaException.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Kavita.Common
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// These are used for errors to send to the UI that should not be reported to Sentry
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
public class KavitaException : Exception
|
||||||
|
{
|
||||||
|
public KavitaException()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public KavitaException(string message) : base(message)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -40,6 +40,7 @@ your reading collection with your friends and family!
|
|||||||
## How to install
|
## How to install
|
||||||
- Unzip the archive for your target OS
|
- Unzip the archive for your target OS
|
||||||
- Place in a directory that is writable. If on windows, do not place in Program Files
|
- Place in a directory that is writable. If on windows, do not place in Program Files
|
||||||
|
- Linux users must ensure the directory & kavita.db is writable by Kavita (might require starting server once)
|
||||||
- Run Kavita
|
- Run Kavita
|
||||||
- If you are updating, do not copy appsettings.json from the new version over. It will override your TokenKey and you will have to reauthenticate on your devices.
|
- If you are updating, do not copy appsettings.json from the new version over. It will override your TokenKey and you will have to reauthenticate on your devices.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user