IServerApplicationHost.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System.Collections.Generic;
  4. using System.Net;
  5. using MediaBrowser.Common;
  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 configured published server url.
  38. /// </summary>
  39. string PublishedServerUrl { get; }
  40. /// <summary>
  41. /// Gets the system info.
  42. /// </summary>
  43. /// <param name="source">The originator of the request.</param>
  44. /// <returns>SystemInfo.</returns>
  45. SystemInfo GetSystemInfo(IPAddress source);
  46. PublicSystemInfo GetPublicSystemInfo(IPAddress address);
  47. /// <summary>
  48. /// Gets a URL specific for the request.
  49. /// </summary>
  50. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  51. /// <param name="port">Optional port number.</param>
  52. /// <returns>An accessible URL.</returns>
  53. string GetSmartApiUrl(HttpRequest request, int? port = null);
  54. /// <summary>
  55. /// Gets a URL specific for the request.
  56. /// </summary>
  57. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  58. /// <param name="port">Optional port number.</param>
  59. /// <returns>An accessible URL.</returns>
  60. string GetSmartApiUrl(IPAddress remoteAddr, int? port = null);
  61. /// <summary>
  62. /// Gets a URL specific for the request.
  63. /// </summary>
  64. /// <param name="hostname">The hostname used in the connection.</param>
  65. /// <param name="port">Optional port number.</param>
  66. /// <returns>An accessible URL.</returns>
  67. string GetSmartApiUrl(string hostname, int? port = null);
  68. /// <summary>
  69. /// Gets a localhost URL that can be used to access the API using the loop-back IP address.
  70. /// over HTTP (not HTTPS).
  71. /// </summary>
  72. /// <returns>The API URL.</returns>
  73. string GetLoopbackHttpApiUrl();
  74. /// <summary>
  75. /// Gets a local (LAN) URL that can be used to access the API.
  76. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  77. /// </summary>
  78. /// <param name="hostname">The hostname to use in the URL.</param>
  79. /// <param name="scheme">
  80. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  81. /// preferring HTTPS, if available.
  82. /// </param>
  83. /// <param name="port">
  84. /// The port to use for the URL. If null, the port will be selected automatically,
  85. /// preferring the HTTPS port, if available.
  86. /// </param>
  87. /// <returns>The API URL.</returns>
  88. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  89. IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo();
  90. string ExpandVirtualPath(string path);
  91. string ReverseVirtualPath(string path);
  92. }
  93. }