diff options
Diffstat (limited to 'Jellyfin.Api/Controllers')
| -rw-r--r-- | Jellyfin.Api/Controllers/ImageController.cs | 45 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/NotificationsController.cs | 53 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/PlaystateController.cs | 37 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/UserController.cs | 2 |
4 files changed, 28 insertions, 109 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index f866655c0..996dc0819 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -505,7 +505,6 @@ namespace Jellyfin.Api.Controllers /// <param name="tag">Optional. Supply the cache tag from the item object to receive strong caching headers.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> /// <param name="format">Optional. The <see cref="ImageFormat"/> of the returned image.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="percentPlayed">Optional. Percent to render for the percent played overlay.</param> /// <param name="unplayedCount">Optional. Unplayed count overlay to render.</param> /// <param name="blur">Optional. Blur image.</param> @@ -536,7 +535,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] string? tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromQuery] ImageFormat? format, - [FromQuery] bool? addPlayedIndicator, [FromQuery] double? percentPlayed, [FromQuery] int? unplayedCount, [FromQuery] int? blur, @@ -565,7 +563,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -589,7 +586,6 @@ namespace Jellyfin.Api.Controllers /// <param name="tag">Optional. Supply the cache tag from the item object to receive strong caching headers.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> /// <param name="format">Optional. The <see cref="ImageFormat"/> of the returned image.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="percentPlayed">Optional. Percent to render for the percent played overlay.</param> /// <param name="unplayedCount">Optional. Unplayed count overlay to render.</param> /// <param name="blur">Optional. Blur image.</param> @@ -620,7 +616,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] string? tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromQuery] ImageFormat? format, - [FromQuery] bool? addPlayedIndicator, [FromQuery] double? percentPlayed, [FromQuery] int? unplayedCount, [FromQuery] int? blur, @@ -648,7 +643,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -671,7 +665,6 @@ namespace Jellyfin.Api.Controllers /// <param name="tag">Optional. Supply the cache tag from the item object to receive strong caching headers.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> /// <param name="format">Determines the output format of the image - original,gif,jpg,png.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="percentPlayed">Optional. Percent to render for the percent played overlay.</param> /// <param name="unplayedCount">Optional. Unplayed count overlay to render.</param> /// <param name="blur">Optional. Blur image.</param> @@ -702,7 +695,6 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] string tag, [FromQuery, ParameterObsolete] bool? cropWhitespace, [FromRoute, Required] ImageFormat format, - [FromQuery] bool? addPlayedIndicator, [FromRoute, Required] double percentPlayed, [FromRoute, Required] int unplayedCount, [FromQuery] int? blur, @@ -731,7 +723,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -756,7 +747,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -787,7 +777,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -814,7 +803,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -839,7 +827,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -870,7 +857,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -897,7 +883,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -923,7 +908,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -954,7 +938,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -980,7 +963,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1005,7 +987,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1036,7 +1017,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1063,7 +1043,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1089,7 +1068,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1120,7 +1098,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1146,7 +1123,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1171,7 +1147,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1202,7 +1177,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1229,7 +1203,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1255,7 +1228,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1286,7 +1258,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1312,7 +1283,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1337,7 +1307,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1368,7 +1337,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1395,7 +1363,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1421,7 +1388,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1452,7 +1418,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1478,7 +1443,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1503,7 +1467,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1534,7 +1497,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer, @@ -1578,7 +1540,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1605,7 +1566,6 @@ namespace Jellyfin.Api.Controllers /// <param name="fillWidth">Width of box to fill.</param> /// <param name="fillHeight">Height of box to fill.</param> /// <param name="cropWhitespace">Optional. Specify if whitespace should be cropped out of the image. True/False. If unspecified, whitespace will be cropped from logos and clear art.</param> - /// <param name="addPlayedIndicator">Optional. Add a played indicator.</param> /// <param name="blur">Optional. Blur image.</param> /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param> /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param> @@ -1636,7 +1596,6 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? fillWidth, [FromQuery] int? fillHeight, [FromQuery, ParameterObsolete] bool? cropWhitespace, - [FromQuery] bool? addPlayedIndicator, [FromQuery] int? blur, [FromQuery] string? backgroundColor, [FromQuery] string? foregroundLayer) @@ -1679,7 +1638,6 @@ namespace Jellyfin.Api.Controllers quality, fillWidth, fillHeight, - addPlayedIndicator, blur, backgroundColor, foregroundLayer, @@ -1924,7 +1882,6 @@ namespace Jellyfin.Api.Controllers int? quality, int? fillWidth, int? fillHeight, - bool? addPlayedIndicator, int? blur, string? backgroundColor, string? foregroundLayer, @@ -1940,7 +1897,6 @@ namespace Jellyfin.Api.Controllers else if (percentPlayed.Value >= 100) { percentPlayed = null; - addPlayedIndicator = true; } } @@ -1997,7 +1953,6 @@ namespace Jellyfin.Api.Controllers FillWidth = fillWidth, Quality = quality ?? 100, Width = width, - AddPlayedIndicator = addPlayedIndicator ?? false, PercentPlayed = percentPlayed ?? 0, UnplayedCount = unplayedCount, Blur = blur, diff --git a/Jellyfin.Api/Controllers/NotificationsController.cs b/Jellyfin.Api/Controllers/NotificationsController.cs deleted file mode 100644 index a28556476..000000000 --- a/Jellyfin.Api/Controllers/NotificationsController.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Api.Constants; -using MediaBrowser.Controller.Notifications; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Notifications; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; - -namespace Jellyfin.Api.Controllers -{ - /// <summary> - /// The notification controller. - /// </summary> - [Authorize(Policy = Policies.DefaultAuthorization)] - public class NotificationsController : BaseJellyfinApiController - { - private readonly INotificationManager _notificationManager; - - /// <summary> - /// Initializes a new instance of the <see cref="NotificationsController" /> class. - /// </summary> - /// <param name="notificationManager">The notification manager.</param> - public NotificationsController(INotificationManager notificationManager) - { - _notificationManager = notificationManager; - } - - /// <summary> - /// Gets notification types. - /// </summary> - /// <response code="200">All notification types returned.</response> - /// <returns>An <cref see="OkResult"/> containing a list of all notification types.</returns> - [HttpGet("Types")] - [ProducesResponseType(StatusCodes.Status200OK)] - public IEnumerable<NotificationTypeInfo> GetNotificationTypes() - { - return _notificationManager.GetNotificationTypes(); - } - - /// <summary> - /// Gets notification services. - /// </summary> - /// <response code="200">All notification services returned.</response> - /// <returns>An <cref see="OkResult"/> containing a list of all notification services.</returns> - [HttpGet("Services")] - [ProducesResponseType(StatusCodes.Status200OK)] - public IEnumerable<NameIdPair> GetNotificationServices() - { - return _notificationManager.GetNotificationServices(); - } - } -} diff --git a/Jellyfin.Api/Controllers/PlaystateController.cs b/Jellyfin.Api/Controllers/PlaystateController.cs index 58f9b7d35..0260f9e2a 100644 --- a/Jellyfin.Api/Controllers/PlaystateController.cs +++ b/Jellyfin.Api/Controllers/PlaystateController.cs @@ -7,6 +7,7 @@ using Jellyfin.Api.Extensions; using Jellyfin.Api.Helpers; using Jellyfin.Api.ModelBinders; using Jellyfin.Data.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Dto; @@ -65,9 +66,11 @@ namespace Jellyfin.Api.Controllers /// <param name="itemId">Item id.</param> /// <param name="datePlayed">Optional. The date the item was played.</param> /// <response code="200">Item marked as played.</response> - /// <returns>An <see cref="OkResult"/> containing the <see cref="UserItemDataDto"/>.</returns> + /// <response code="404">Item not found.</response> + /// <returns>An <see cref="OkResult"/> containing the <see cref="UserItemDataDto"/>, or a <see cref="NotFoundResult"/> if item was not found.</returns> [HttpPost("Users/{userId}/PlayedItems/{itemId}")] [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task<ActionResult<UserItemDataDto>> MarkPlayedItem( [FromRoute, Required] Guid userId, [FromRoute, Required] Guid itemId, @@ -75,11 +78,18 @@ namespace Jellyfin.Api.Controllers { var user = _userManager.GetUserById(userId); var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false); - var dto = UpdatePlayedStatus(user, itemId, true, datePlayed); + + var item = _libraryManager.GetItemById(itemId); + if (item is null) + { + return NotFound(); + } + + var dto = UpdatePlayedStatus(user, item, true, datePlayed); foreach (var additionalUserInfo in session.AdditionalUsers) { var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId); - UpdatePlayedStatus(additionalUser, itemId, true, datePlayed); + UpdatePlayedStatus(additionalUser, item, true, datePlayed); } return dto; @@ -91,18 +101,27 @@ namespace Jellyfin.Api.Controllers /// <param name="userId">User id.</param> /// <param name="itemId">Item id.</param> /// <response code="200">Item marked as unplayed.</response> - /// <returns>A <see cref="OkResult"/> containing the <see cref="UserItemDataDto"/>.</returns> + /// <response code="404">Item not found.</response> + /// <returns>A <see cref="OkResult"/> containing the <see cref="UserItemDataDto"/>, or a <see cref="NotFoundResult"/> if item was not found.</returns> [HttpDelete("Users/{userId}/PlayedItems/{itemId}")] [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task<ActionResult<UserItemDataDto>> MarkUnplayedItem([FromRoute, Required] Guid userId, [FromRoute, Required] Guid itemId) { var user = _userManager.GetUserById(userId); var session = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false); - var dto = UpdatePlayedStatus(user, itemId, false, null); + var item = _libraryManager.GetItemById(itemId); + + if (item is null) + { + return NotFound(); + } + + var dto = UpdatePlayedStatus(user, item, false, null); foreach (var additionalUserInfo in session.AdditionalUsers) { var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId); - UpdatePlayedStatus(additionalUser, itemId, false, null); + UpdatePlayedStatus(additionalUser, item, false, null); } return dto; @@ -328,14 +347,12 @@ namespace Jellyfin.Api.Controllers /// Updates the played status. /// </summary> /// <param name="user">The user.</param> - /// <param name="itemId">The item id.</param> + /// <param name="item">The item.</param> /// <param name="wasPlayed">if set to <c>true</c> [was played].</param> /// <param name="datePlayed">The date played.</param> /// <returns>Task.</returns> - private UserItemDataDto UpdatePlayedStatus(User user, Guid itemId, bool wasPlayed, DateTime? datePlayed) + private UserItemDataDto UpdatePlayedStatus(User user, BaseItem item, bool wasPlayed, DateTime? datePlayed) { - var item = _libraryManager.GetItemById(itemId); - if (wasPlayed) { item.MarkPlayed(user, datePlayed, true); diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.cs index 568224a42..06f2227b8 100644 --- a/Jellyfin.Api/Controllers/UserController.cs +++ b/Jellyfin.Api/Controllers/UserController.cs @@ -277,7 +277,7 @@ namespace Jellyfin.Api.Controllers } else { - if (!User.IsInRole(UserRoles.Administrator)) + if (!User.IsInRole(UserRoles.Administrator) || User.GetUserId().Equals(userId)) { var success = await _userManager.AuthenticateUser( user.Username, |
