using System.Net.Mime; using System.Text; using MediaBrowser.Common; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace ConfusedPolarBear.Plugin.IntroSkipper.Controllers; /// /// Troubleshooting controller. /// [Authorize(Policy = "RequiresElevation")] [ApiController] [Produces(MediaTypeNames.Application.Json)] [Route("IntroSkipper")] public class TroubleshootingController : ControllerBase { private readonly IApplicationHost _applicationHost; private readonly ILogger _logger; /// /// Initializes a new instance of the class. /// /// Application host. /// Logger. public TroubleshootingController( IApplicationHost applicationHost, ILogger logger) { _applicationHost = applicationHost; _logger = logger; } /// /// Gets a Markdown formatted support bundle. /// /// Support bundle created. /// Support bundle. [HttpGet("SupportBundle")] [Produces(MediaTypeNames.Text.Plain)] public ActionResult GetSupportBundle() { var bundle = new StringBuilder(); bundle.Append("* Jellyfin version: "); bundle.Append(_applicationHost.ApplicationVersionString); bundle.Append('\n'); bundle.Append("* Plugin version: "); bundle.Append(Plugin.Instance!.Version.ToString(3)); bundle.Append('\n'); bundle.Append("* Queue contents: "); bundle.Append(Plugin.Instance!.TotalQueued); bundle.Append(" episodes, "); bundle.Append(Plugin.Instance!.AnalysisQueue.Count); bundle.Append(" seasons"); bundle.Append('\n'); bundle.Append(FFmpegWrapper.GetChromaprintLogs()); return bundle.ToString(); } }