2
0

IServerApplicationHost.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System.Net;
  4. using MediaBrowser.Common;
  5. using Microsoft.AspNetCore.Http;
  6. namespace MediaBrowser.Controller
  7. {
  8. /// <summary>
  9. /// Interface IServerApplicationHost.
  10. /// </summary>
  11. public interface IServerApplicationHost : IApplicationHost
  12. {
  13. bool CoreStartupHasCompleted { get; }
  14. /// <summary>
  15. /// Gets the HTTP server port.
  16. /// </summary>
  17. /// <value>The HTTP server port.</value>
  18. int HttpPort { get; }
  19. /// <summary>
  20. /// Gets the HTTPS port.
  21. /// </summary>
  22. /// <value>The HTTPS port.</value>
  23. int HttpsPort { get; }
  24. /// <summary>
  25. /// Gets a value indicating whether the server should listen on an HTTPS port.
  26. /// </summary>
  27. bool ListenWithHttps { get; }
  28. /// <summary>
  29. /// Gets the name of the friendly.
  30. /// </summary>
  31. /// <value>The name of the friendly.</value>
  32. string FriendlyName { get; }
  33. /// <summary>
  34. /// Gets a URL specific for the request.
  35. /// </summary>
  36. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  37. /// <returns>An accessible URL.</returns>
  38. string GetSmartApiUrl(HttpRequest request);
  39. /// <summary>
  40. /// Gets a URL specific for the request.
  41. /// </summary>
  42. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  43. /// <returns>An accessible URL.</returns>
  44. string GetSmartApiUrl(IPAddress remoteAddr);
  45. /// <summary>
  46. /// Gets a URL specific for the request.
  47. /// </summary>
  48. /// <param name="hostname">The hostname used in the connection.</param>
  49. /// <returns>An accessible URL.</returns>
  50. string GetSmartApiUrl(string hostname);
  51. /// <summary>
  52. /// Gets an URL that can be used to access the API over LAN.
  53. /// </summary>
  54. /// <param name="ipAddress">An optional IP address to use.</param>
  55. /// <param name="allowHttps">A value indicating whether to allow HTTPS.</param>
  56. /// <returns>The API URL.</returns>
  57. string GetApiUrlForLocalAccess(IPAddress ipAddress = null, bool allowHttps = true);
  58. /// <summary>
  59. /// Gets a local (LAN) URL that can be used to access the API.
  60. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  61. /// </summary>
  62. /// <param name="hostname">The hostname to use in the URL.</param>
  63. /// <param name="scheme">
  64. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  65. /// preferring HTTPS, if available.
  66. /// </param>
  67. /// <param name="port">
  68. /// The port to use for the URL. If null, the port will be selected automatically,
  69. /// preferring the HTTPS port, if available.
  70. /// </param>
  71. /// <returns>The API URL.</returns>
  72. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  73. string ExpandVirtualPath(string path);
  74. string ReverseVirtualPath(string path);
  75. }
  76. }