Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Move to Asp.Net Core Web Api #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions MediaBrowser.Channels.IPTV/Api/IptvController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using MediaBrowser.Channels.IPTV.Configuration;
using MediaBrowser.Model.MediaInfo;
using System.Linq;
using System.Net.Mime;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MediaBrowser.Channels.IPTV.Api
{
/// <summary>
/// The IP TV controller.
/// </summary>
[ApiController]
[Route("[controller]")]
[Produces(MediaTypeNames.Application.Json)]
public class IptvController : ControllerBase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endpoint should probably require authentication

{
/// <summary>
/// Bookmarks a video.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="path">The path.</param>
/// <param name="userId">The user id.</param>
/// <param name="protocol">The <see cref="MediaProtocol"/>.</param>
/// <param name="imagePath">The image path.</param>
/// <response code="204">Bookmark set successfully.</response>
/// <returns>A <see cref="NoContentResult"/> indicting success.</returns>
[HttpPost("Bookmarks")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SetBookmark(
[FromQuery] string name,
[FromQuery] string path,
[FromQuery] string userId,
[FromQuery] MediaProtocol protocol,
[FromQuery] string imagePath)
{
var list = Plugin.Instance.Configuration.Bookmarks.ToList();
list.Add(new Bookmark
{
UserId = userId,
Name = name,
Image = imagePath,
Path = path,
Protocol = protocol
});

Plugin.Instance.Configuration.Bookmarks = list.ToArray();

Plugin.Instance.SaveConfiguration();
return NoContent();
}
}
}
63 changes: 0 additions & 63 deletions MediaBrowser.Channels.IPTV/Api/ServerApiEndpoints.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ItemGroup>
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
</ItemGroup>

</Project>