2
0

IServerApplicationHost.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 system info.
  47. /// </summary>
  48. /// <param name="source">The originator of the request.</param>
  49. /// <returns>SystemInfo.</returns>
  50. SystemInfo GetSystemInfo(IPAddress source);
  51. PublicSystemInfo GetPublicSystemInfo(IPAddress address);
  52. /// <summary>
  53. /// Gets a URL specific for the request.
  54. /// </summary>
  55. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  56. /// <param name="port">Optional port number.</param>
  57. /// <returns>An accessible URL.</returns>
  58. string GetSmartApiUrl(HttpRequest request, int? port = null);
  59. /// <summary>
  60. /// Gets a URL specific for the request.
  61. /// </summary>
  62. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  63. /// <param name="port">Optional port number.</param>
  64. /// <returns>An accessible URL.</returns>
  65. string GetSmartApiUrl(IPAddress remoteAddr, int? port = null);
  66. /// <summary>
  67. /// Gets a URL specific for the request.
  68. /// </summary>
  69. /// <param name="hostname">The hostname used in the connection.</param>
  70. /// <param name="port">Optional port number.</param>
  71. /// <returns>An accessible URL.</returns>
  72. string GetSmartApiUrl(string hostname, int? port = null);
  73. /// <summary>
  74. /// Gets a localhost URL that can be used to access the API using the loop-back IP address.
  75. /// over HTTP (not HTTPS).
  76. /// </summary>
  77. /// <returns>The API URL.</returns>
  78. string GetLoopbackHttpApiUrl();
  79. /// <summary>
  80. /// Gets a local (LAN) URL that can be used to access the API.
  81. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  82. /// </summary>
  83. /// <param name="hostname">The hostname to use in the URL.</param>
  84. /// <param name="scheme">
  85. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  86. /// preferring HTTPS, if available.
  87. /// </param>
  88. /// <param name="port">
  89. /// The port to use for the URL. If null, the port will be selected automatically,
  90. /// preferring the HTTPS port, if available.
  91. /// </param>
  92. /// <returns>The API URL.</returns>
  93. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  94. /// <summary>
  95. /// Open a URL in an external browser window.
  96. /// </summary>
  97. /// <param name="url">The URL to open.</param>
  98. /// <exception cref="NotSupportedException"><see cref="CanLaunchWebBrowser"/> is false.</exception>
  99. void LaunchUrl(string url);
  100. IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
  101. string ExpandVirtualPath(string path);
  102. string ReverseVirtualPath(string path);
  103. }
  104. }