IServerApplicationHost.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 or sets the path to the backup archive used to restore upon restart.
  35. /// </summary>
  36. string RestoreBackupPath { get; set; }
  37. /// <summary>
  38. /// Gets a URL specific for the request.
  39. /// </summary>
  40. /// <param name="request">The <see cref="HttpRequest"/> instance.</param>
  41. /// <returns>An accessible URL.</returns>
  42. string GetSmartApiUrl(HttpRequest request);
  43. /// <summary>
  44. /// Gets a URL specific for the request.
  45. /// </summary>
  46. /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param>
  47. /// <returns>An accessible URL.</returns>
  48. string GetSmartApiUrl(IPAddress remoteAddr);
  49. /// <summary>
  50. /// Gets a URL specific for the request.
  51. /// </summary>
  52. /// <param name="hostname">The hostname used in the connection.</param>
  53. /// <returns>An accessible URL.</returns>
  54. string GetSmartApiUrl(string hostname);
  55. /// <summary>
  56. /// Gets an URL that can be used to access the API over LAN.
  57. /// </summary>
  58. /// <param name="ipAddress">An optional IP address to use.</param>
  59. /// <param name="allowHttps">A value indicating whether to allow HTTPS.</param>
  60. /// <returns>The API URL.</returns>
  61. string GetApiUrlForLocalAccess(IPAddress ipAddress = null, bool allowHttps = true);
  62. /// <summary>
  63. /// Gets a local (LAN) URL that can be used to access the API.
  64. /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair.
  65. /// </summary>
  66. /// <param name="hostname">The hostname to use in the URL.</param>
  67. /// <param name="scheme">
  68. /// The scheme to use for the URL. If null, the scheme will be selected automatically,
  69. /// preferring HTTPS, if available.
  70. /// </param>
  71. /// <param name="port">
  72. /// The port to use for the URL. If null, the port will be selected automatically,
  73. /// preferring the HTTPS port, if available.
  74. /// </param>
  75. /// <returns>The API URL.</returns>
  76. string GetLocalApiUrl(string hostname, string scheme = null, int? port = null);
  77. string ExpandVirtualPath(string path);
  78. string ReverseVirtualPath(string path);
  79. }
  80. }