IServerApplicationHost.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Net;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using MediaBrowser.Common;
  8. using MediaBrowser.Common.Plugins;
  9. using MediaBrowser.Model.System;
  10. using Microsoft.AspNetCore.Http;
  11. namespace MediaBrowser.Controller
  12. {
  13. /// <summary>
  14. /// Interface IServerApplicationHost.
  15. /// </summary>
  16. public interface IServerApplicationHost : IApplicationHost
  17. {
  18. event EventHandler HasUpdateAvailableChanged;
  19. IServiceProvider ServiceProvider { get; }
  20. bool CoreStartupHasCompleted { get; }
  21. bool CanLaunchWebBrowser { get; }
  22. /// <summary>
  23. /// Gets the HTTP server port.
  24. /// </summary>
  25. /// <value>The HTTP server port.</value>
  26. int HttpPort { get; }
  27. /// <summary>
  28. /// Gets the HTTPS port.
  29. /// </summary>
  30. /// <value>The HTTPS port.</value>
  31. int HttpsPort { get; }
  32. /// <summary>
  33. /// Gets a value indicating whether the server should listen on an HTTPS port.
  34. /// </summary>
  35. bool ListenWithHttps { get; }
  36. /// <summary>
  37. /// Gets a value indicating whether this instance has update available.
  38. /// </summary>
  39. /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
  40. bool HasUpdateAvailable { get; }
  41. /// <summary>
  42. /// Gets the name of the friendly.
  43. /// </summary>
  44. /// <value>The name of the friendly.</value>
  45. string FriendlyName { get; }
  46. /// <summary>
  47. /// Gets the system info.
  48. /// </summary>
  49. /// <param name="source">The originator of the request.</param>
  50. /// <returns>SystemInfo.</returns>
  51. SystemInfo GetSystemInfo(IPAddress source);
  52. PublicSystemInfo GetPublicSystemInfo(IPAddress address);
  53. /// <summary>
  54. /// Gets a URL specific for the request.
  55. /// </summary>
  56. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  57. /// <param name="port">Optional port number.</param>
  58. /// <returns>An accessible URL.</returns>
  59. string GetSmartApiUrl(HttpRequest request, int? port = null);
  60. /// <summary>
  61. /// Gets a URL specific for the request.
  62. /// </summary>
  63. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  64. /// <param name="port">Optional port number.</param>
  65. /// <returns>An accessible URL.</returns>
  66. string GetSmartApiUrl(IPAddress remoteAddr, int? port = null);
  67. /// <summary>
  68. /// Gets a URL specific for the request.
  69. /// </summary>
  70. /// <param name="hostname">The hostname used in the connection.</param>
  71. /// <param name="port">Optional port number.</param>
  72. /// <returns>An accessible URL.</returns>
  73. string GetSmartApiUrl(string hostname, int? port = null);
  74. /// <summary>
  75. /// Gets a localhost URL that can be used to access the API using the loop-back IP address.
  76. /// over HTTP (not HTTPS).
  77. /// </summary>
  78. /// <returns>The API URL.</returns>
  79. string GetLoopbackHttpApiUrl();
  80. /// <summary>
  81. /// Gets a local (LAN) URL that can be used to access the API.
  82. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  83. /// </summary>
  84. /// <param name="hostname">The hostname to use in the URL.</param>
  85. /// <param name="scheme">
  86. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  87. /// preferring HTTPS, if available.
  88. /// </param>
  89. /// <param name="port">
  90. /// The port to use for the URL. If null, the port will be selected automatically,
  91. /// preferring the HTTPS port, if available.
  92. /// </param>
  93. /// <returns>The API URL.</returns>
  94. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  95. /// <summary>
  96. /// Open a URL in an external browser window.
  97. /// </summary>
  98. /// <param name="url">The URL to open.</param>
  99. /// <exception cref="NotSupportedException"><see cref="CanLaunchWebBrowser"/> is false.</exception>
  100. void LaunchUrl(string url);
  101. IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
  102. string ExpandVirtualPath(string path);
  103. string ReverseVirtualPath(string path);
  104. /// <summary>
  105. /// Gets the list of local plugins.
  106. /// </summary>
  107. /// <param name="path">Plugin base directory.</param>
  108. /// <param name="cleanup">Cleanup old plugins.</param>
  109. /// <returns>Enumerable of local plugins.</returns>
  110. IEnumerable<LocalPlugin> GetLocalPlugins(string path, bool cleanup = true);
  111. }
  112. }