ManagementController.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Net.Mime;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using Jellyfin.Api.Attributes;
  10. using Jellyfin.Api.Constants;
  11. using MediaBrowser.Common.Configuration;
  12. using MediaBrowser.Common.Extensions;
  13. using MediaBrowser.Common.Net;
  14. using MediaBrowser.Controller;
  15. using MediaBrowser.Controller.Configuration;
  16. using MediaBrowser.Model.IO;
  17. using MediaBrowser.Model.Net;
  18. using MediaBrowser.Model.System;
  19. using Microsoft.AspNetCore.Authorization;
  20. using Microsoft.AspNetCore.Http;
  21. using Microsoft.AspNetCore.Mvc;
  22. using Microsoft.Extensions.Logging;
  23. namespace Jellyfin.Api.Controllers
  24. {
  25. /// <summary>
  26. /// The management controller.
  27. /// </summary>
  28. [Management]
  29. [ApiExplorerSettings(IgnoreApi = true)]
  30. public class ManagementController : BaseJellyfinApiController
  31. {
  32. private readonly IServerApplicationHost _appHost;
  33. private readonly IApplicationPaths _appPaths;
  34. private readonly IFileSystem _fileSystem;
  35. private readonly INetworkManager _network;
  36. private readonly ILogger<ManagementController> _logger;
  37. /// <summary>
  38. /// Initializes a new instance of the <see cref="ManagementController"/> class.
  39. /// </summary>
  40. /// <param name="serverConfigurationManager">Instance of <see cref="IServerConfigurationManager"/> interface.</param>
  41. /// <param name="appHost">Instance of <see cref="IServerApplicationHost"/> interface.</param>
  42. /// <param name="fileSystem">Instance of <see cref="IFileSystem"/> interface.</param>
  43. /// <param name="network">Instance of <see cref="INetworkManager"/> interface.</param>
  44. /// <param name="logger">Instance of <see cref="ILogger{SystemController}"/> interface.</param>
  45. public ManagementController(
  46. IServerConfigurationManager serverConfigurationManager,
  47. IServerApplicationHost appHost,
  48. IFileSystem fileSystem,
  49. INetworkManager network,
  50. ILogger<ManagementController> logger)
  51. {
  52. _appPaths = serverConfigurationManager.ApplicationPaths;
  53. _appHost = appHost;
  54. _fileSystem = fileSystem;
  55. _network = network;
  56. _logger = logger;
  57. }
  58. /// <summary>
  59. /// Gets information about the server.
  60. /// </summary>
  61. /// <response code="200">Information retrieved.</response>
  62. /// <returns>A <see cref="SystemInfo"/> with info about the system.</returns>
  63. [HttpGet("Test")]
  64. [ProducesResponseType(StatusCodes.Status200OK)]
  65. public ActionResult<int> GetTest()
  66. {
  67. return 123456; // secret
  68. }
  69. }
  70. }