2
0

IServerApplicationHost.cs 3.4 KB

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