mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-05 06:15:25 -04:00
Koreader Progress Sync for all files (#4323)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
@@ -244,11 +244,7 @@ public class AccountController : BaseApiController
|
||||
AppUser? user;
|
||||
if (!string.IsNullOrEmpty(loginDto.ApiKey))
|
||||
{
|
||||
user = await _userManager.Users
|
||||
.Include(u => u.UserPreferences)
|
||||
.Include(u => u.AuthKeys)
|
||||
.AsSplitQuery()
|
||||
.SingleOrDefaultAsync(x => x.GetOpdsAuthKey() == loginDto.ApiKey);
|
||||
user = await _unitOfWork.UserRepository.GetUserByAuthKey(loginDto.ApiKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -518,7 +514,8 @@ public class AccountController : BaseApiController
|
||||
}
|
||||
|
||||
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
|
||||
if (!await _accountService.CanChangeAgeRestriction(user)) return BadRequest(await _localizationService.Translate(UserId, "permission-denied"));
|
||||
var hasRole = await _accountService.CanChangeAgeRestriction(user);
|
||||
if (!hasRole) return BadRequest(await _localizationService.Translate(UserId, "permission-denied"));
|
||||
|
||||
user.AgeRestriction = isAdmin ? AgeRating.NotApplicable : dto.AgeRating;
|
||||
user.AgeRestrictionIncludeUnknowns = isAdmin || dto.IncludeUnknowns;
|
||||
@@ -1285,7 +1282,7 @@ public class AccountController : BaseApiController
|
||||
_unitOfWork.UserRepository.Delete(authKey);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.AuthKeyUpdate, MessageFactory.AuthKeyDeletedEvent(authKeyId), UserId);
|
||||
await _eventHub.SendMessageToAsync(MessageFactory.AuthKeyDeleted, MessageFactory.AuthKeyDeletedEvent(authKeyId), UserId);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user