Duncan Tourolle a38122e993
All checks were successful
🏗️ Build Plugin / build (push) Successful in 1m13s
🧪 Test Plugin / test (push) Successful in 20s
Latest Release / latest-release (push) Successful in 25s
first commit
2026-06-12 18:16:47 +02:00

36 lines
1.1 KiB
C#

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");
}
}