IServerApplicationHost.cs 4.1 KB

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