first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Jellyfin.Plugin.JRay.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Serves static client-side assets for JRay, e.g. the pause-overlay script
|
||||
/// injected into the web client.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("Plugins/JRay")]
|
||||
[AllowAnonymous]
|
||||
public class WebController : ControllerBase
|
||||
{
|
||||
private const string OverlayScriptResource = "Jellyfin.Plugin.JRay.Web.jray-overlay.js";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pause-overlay client script.
|
||||
/// </summary>
|
||||
/// <returns>The JavaScript source for the pause overlay.</returns>
|
||||
[HttpGet("ClientScript")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public IActionResult GetClientScript()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var stream = assembly.GetManifestResourceStream(OverlayScriptResource)
|
||||
?? throw new InvalidOperationException($"Embedded resource '{OverlayScriptResource}' not found.");
|
||||
|
||||
return File(stream, "application/javascript");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user