test 6
This commit is contained in:
@@ -6,10 +6,17 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Jellyfin.Plugin.Seasonals.Api;
|
||||
|
||||
/// <summary>
|
||||
/// Controller for serving seasonal resources and configuration.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("Seasonals")]
|
||||
public class SeasonalsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current plugin configuration.
|
||||
/// </summary>
|
||||
/// <returns>The configuration object.</returns>
|
||||
[HttpGet("Config")]
|
||||
[Produces("application/json")]
|
||||
public ActionResult<object> GetConfig()
|
||||
@@ -22,11 +29,16 @@ public class SeasonalsController : ControllerBase
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serves embedded resources.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the resource.</param>
|
||||
/// <returns>The resource file.</returns>
|
||||
[HttpGet("Resources/{*path}")]
|
||||
public ActionResult GetResource(string path)
|
||||
{
|
||||
// Sanitize path
|
||||
if (string.IsNullOrWhiteSpace(path) || path.Contains(".."))
|
||||
if (string.IsNullOrWhiteSpace(path) || path.Contains("..", StringComparison.Ordinal))
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
@@ -47,7 +59,7 @@ public class SeasonalsController : ControllerBase
|
||||
return File(stream, contentType);
|
||||
}
|
||||
|
||||
private string GetContentType(string path)
|
||||
private static string GetContentType(string path)
|
||||
{
|
||||
if (path.EndsWith(".js", StringComparison.OrdinalIgnoreCase)) return "application/javascript";
|
||||
if (path.EndsWith(".css", StringComparison.OrdinalIgnoreCase)) return "text/css";
|
||||
|
||||
Reference in New Issue
Block a user