IServerApplicationHost.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. bool CoreStartupHasCompleted { get; }
  20. bool CanLaunchWebBrowser { get; }
  21. /// <summary>
  22. /// Gets the HTTP server port.
  23. /// </summary>
  24. /// <value>The HTTP server port.</value>
  25. int HttpPort { get; }
  26. /// <summary>
  27. /// Gets the HTTPS port.
  28. /// </summary>
  29. /// <value>The HTTPS port.</value>
  30. int HttpsPort { get; }
  31. /// <summary>
  32. /// Gets a value indicating whether the server should listen on an HTTPS port.
  33. /// </summary>
  34. bool ListenWithHttps { get; }
  35. /// <summary>
  36. /// Gets a value indicating whether this instance has update available.
  37. /// </summary>
  38. /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
  39. bool HasUpdateAvailable { get; }
  40. /// <summary>
  41. /// Gets the name of the friendly.
  42. /// </summary>
  43. /// <value>The name of the friendly.</value>
  44. string FriendlyName { get; }
  45. /// <summary>
  46. /// Gets the configured published server url.
  47. /// </summary>
  48. string PublishedServerUrl { get; }
  49. /// <summary>
  50. /// Gets the system info.
  51. /// </summary>
  52. /// <param name="source">The originator of the request.</param>
  53. /// <returns>SystemInfo.</returns>
  54. SystemInfo GetSystemInfo(IPAddress source);
  55. PublicSystemInfo GetPublicSystemInfo(IPAddress address);
  56. /// <summary>
  57. /// Gets a URL specific for the request.
  58. /// </summary>
  59. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  60. /// <param name="port">Optional port number.</param>
  61. /// <returns>An accessible URL.</returns>
  62. string GetSmartApiUrl(HttpRequest request, int? port = null);
  63. /// <summary>
  64. /// Gets a URL specific for the request.
  65. /// </summary>
  66. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  67. /// <param name="port">Optional port number.</param>
  68. /// <returns>An accessible URL.</returns>
  69. string GetSmartApiUrl(IPAddress remoteAddr, int? port = null);
  70. /// <summary>
  71. /// Gets a URL specific for the request.
  72. /// </summary>
  73. /// <param name="hostname">The hostname used in the connection.</param>
  74. /// <param name="port">Optional port number.</param>
  75. /// <returns>An accessible URL.</returns>
  76. string GetSmartApiUrl(string hostname, int? port = null);
  77. /// <summary>
  78. /// Gets a localhost URL that can be used to access the API using the loop-back IP address.
  79. /// over HTTP (not HTTPS).
  80. /// </summary>
  81. /// <returns>The API URL.</returns>
  82. string GetLoopbackHttpApiUrl();
  83. /// <summary>
  84. /// Gets a local (LAN) URL that can be used to access the API.
  85. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  86. /// </summary>
  87. /// <param name="hostname">The hostname to use in the URL.</param>
  88. /// <param name="scheme">
  89. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  90. /// preferring HTTPS, if available.
  91. /// </param>
  92. /// <param name="port">
  93. /// The port to use for the URL. If null, the port will be selected automatically,
  94. /// preferring the HTTPS port, if available.
  95. /// </param>
  96. /// <returns>The API URL.</returns>
  97. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  98. /// <summary>
  99. /// Open a URL in an external browser window.
  100. /// </summary>
  101. /// <param name="url">The URL to open.</param>
  102. /// <exception cref="NotSupportedException"><see cref="CanLaunchWebBrowser"/> is false.</exception>
  103. void LaunchUrl(string url);
  104. IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
  105. string ExpandVirtualPath(string path);
  106. string ReverseVirtualPath(string path);
  107. }
  108. }