IServerApplicationHost.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Net;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Common;
  7. using MediaBrowser.Model.System;
  8. using Microsoft.AspNetCore.Http;
  9. namespace MediaBrowser.Controller
  10. {
  11. /// <summary>
  12. /// Interface IServerApplicationHost
  13. /// </summary>
  14. public interface IServerApplicationHost : IApplicationHost
  15. {
  16. event EventHandler HasUpdateAvailableChanged;
  17. /// <summary>
  18. /// Gets the system info.
  19. /// </summary>
  20. /// <returns>SystemInfo.</returns>
  21. Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken);
  22. Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken);
  23. bool CanLaunchWebBrowser { get; }
  24. /// <summary>
  25. /// Gets the HTTP server port.
  26. /// </summary>
  27. /// <value>The HTTP server port.</value>
  28. int HttpPort { get; }
  29. /// <summary>
  30. /// Gets the HTTPS port.
  31. /// </summary>
  32. /// <value>The HTTPS port.</value>
  33. int HttpsPort { get; }
  34. /// <summary>
  35. /// Gets a value indicating whether [supports HTTPS].
  36. /// </summary>
  37. /// <value><c>true</c> if [supports HTTPS]; otherwise, <c>false</c>.</value>
  38. bool EnableHttps { get; }
  39. /// <summary>
  40. /// Gets a value indicating whether this instance has update available.
  41. /// </summary>
  42. /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
  43. bool HasUpdateAvailable { get; }
  44. /// <summary>
  45. /// Gets the name of the friendly.
  46. /// </summary>
  47. /// <value>The name of the friendly.</value>
  48. string FriendlyName { get; }
  49. /// <summary>
  50. /// Gets the local ip address.
  51. /// </summary>
  52. /// <value>The local ip address.</value>
  53. Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken);
  54. /// <summary>
  55. /// Gets the local API URL.
  56. /// </summary>
  57. /// <param name="cancellationToken">Token to cancel the request if needed.</param>
  58. /// <param name="forceHttp">Whether to force usage of plain HTTP protocol.</param>
  59. /// <value>The local API URL.</value>
  60. Task<string> GetLocalApiUrl(CancellationToken cancellationToken, bool forceHttp = false);
  61. /// <summary>
  62. /// Gets the local API URL.
  63. /// </summary>
  64. /// <param name="hostname">The hostname.</param>
  65. /// <param name="forceHttp">Whether to force usage of plain HTTP protocol.</param>
  66. /// <returns>The local API URL.</returns>
  67. string GetLocalApiUrl(ReadOnlySpan<char> hostname, bool forceHttp = false);
  68. /// <summary>
  69. /// Gets the local API URL.
  70. /// </summary>
  71. /// <param name="address">The IP address.</param>
  72. /// <param name="forceHttp">Whether to force usage of plain HTTP protocol.</param>
  73. /// <returns>The local API URL.</returns>
  74. string GetLocalApiUrl(IPAddress address, bool forceHttp = false);
  75. void LaunchUrl(string url);
  76. void EnableLoopback(string appName);
  77. IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
  78. string ExpandVirtualPath(string path);
  79. string ReverseVirtualPath(string path);
  80. Task ExecuteHttpHandlerAsync(HttpContext context, Func<Task> next);
  81. Task ExecuteWebsocketHandlerAsync(HttpContext context, Func<Task> next);
  82. }
  83. }