IServerApplicationHost.cs 3.5 KB

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