mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-01 04:34:26 -04:00
Fix third part integration
This commit is contained in:
parent
d7f0aaaec1
commit
eef15dc7ac
@ -590,15 +590,15 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports that new movies have been added by an external source.
|
/// Reports that new movies have been added by an external source.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="updates">A list of updated media paths.</param>
|
/// <param name="dto">The update paths.</param>
|
||||||
/// <response code="204">Report success.</response>
|
/// <response code="204">Report success.</response>
|
||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
[HttpPost("Library/Media/Updated")]
|
[HttpPost("Library/Media/Updated")]
|
||||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult PostUpdatedMedia([FromBody, Required] MediaUpdateInfoDto[] updates)
|
public ActionResult PostUpdatedMedia([FromBody, Required] MediaUpdateInfoDto dto)
|
||||||
{
|
{
|
||||||
foreach (var item in updates)
|
foreach (var item in dto.Updates)
|
||||||
{
|
{
|
||||||
_libraryMonitor.ReportFileSystemChanged(item.Path);
|
_libraryMonitor.ReportFileSystemChanged(item.Path);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
@ -86,26 +87,19 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a notification to all admins.
|
/// Sends a notification to all admins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL of the notification.</param>
|
/// <param name="notificationDto">The notification request.</param>
|
||||||
/// <param name="level">The level of the notification.</param>
|
|
||||||
/// <param name="name">The name of the notification.</param>
|
|
||||||
/// <param name="description">The description of the notification.</param>
|
|
||||||
/// <response code="204">Notification sent.</response>
|
/// <response code="204">Notification sent.</response>
|
||||||
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
||||||
[HttpPost("Admin")]
|
[HttpPost("Admin")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult CreateAdminNotification(
|
public ActionResult CreateAdminNotification([FromBody, Required] AdminNotificationDto notificationDto)
|
||||||
[FromQuery] string? url,
|
|
||||||
[FromQuery] NotificationLevel? level,
|
|
||||||
[FromQuery] string name = "",
|
|
||||||
[FromQuery] string description = "")
|
|
||||||
{
|
{
|
||||||
var notification = new NotificationRequest
|
var notification = new NotificationRequest
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = notificationDto.Name,
|
||||||
Description = description,
|
Description = notificationDto.Description,
|
||||||
Url = url,
|
Url = notificationDto.Url,
|
||||||
Level = level ?? NotificationLevel.Normal,
|
Level = notificationDto.NotificationLevel ?? NotificationLevel.Normal,
|
||||||
UserIds = _userManager.Users
|
UserIds = _userManager.Users
|
||||||
.Where(user => user.HasPermission(PermissionKind.IsAdministrator))
|
.Where(user => user.HasPermission(PermissionKind.IsAdministrator))
|
||||||
.Select(user => user.Id)
|
.Select(user => user.Id)
|
||||||
@ -114,7 +108,6 @@ namespace Jellyfin.Api.Controllers
|
|||||||
};
|
};
|
||||||
|
|
||||||
_notificationManager.SendNotification(notification, CancellationToken.None);
|
_notificationManager.SendNotification(notification, CancellationToken.None);
|
||||||
|
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
namespace Jellyfin.Api.Models.LibraryDtos
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Media Update Info Dto.
|
/// Media Update Info Dto.
|
||||||
@ -6,14 +9,8 @@
|
|||||||
public class MediaUpdateInfoDto
|
public class MediaUpdateInfoDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets media path.
|
/// Gets or sets the list of updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Path { get; set; }
|
public IReadOnlyList<MediaUpdateInfoPathDto> Updates { get; set; } = Array.Empty<MediaUpdateInfoPathDto>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets media update type.
|
|
||||||
/// Created, Modified, Deleted.
|
|
||||||
/// </summary>
|
|
||||||
public string? UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs
Normal file
19
Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The media update info path.
|
||||||
|
/// </summary>
|
||||||
|
public class MediaUpdateInfoPathDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets media path.
|
||||||
|
/// </summary>
|
||||||
|
public string? Path { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets media update type.
|
||||||
|
/// Created, Modified, Deleted.
|
||||||
|
/// </summary>
|
||||||
|
public string? UpdateType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
30
Jellyfin.Api/Models/NotificationDtos/AdminNotificationDto.cs
Normal file
30
Jellyfin.Api/Models/NotificationDtos/AdminNotificationDto.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.NotificationDtos
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The admin notification dto.
|
||||||
|
/// </summary>
|
||||||
|
public class AdminNotificationDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification name.
|
||||||
|
/// </summary>
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification description.
|
||||||
|
/// </summary>
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification level.
|
||||||
|
/// </summary>
|
||||||
|
public NotificationLevel? NotificationLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification url.
|
||||||
|
/// </summary>
|
||||||
|
public string? Url { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user