IServerApplicationHost.cs 4.5 KB

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