diff options
Diffstat (limited to 'MediaBrowser.Controller/IServerApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Controller/IServerApplicationHost.cs | 99 |
1 files changed, 59 insertions, 40 deletions
diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 22797aa0d..7e5e742f5 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -1,27 +1,21 @@ -using System; +#nullable disable + +#pragma warning disable CS1591 + using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; +using System.Net; using MediaBrowser.Common; -using MediaBrowser.Model.Net; using MediaBrowser.Model.System; +using Microsoft.AspNetCore.Http; namespace MediaBrowser.Controller { /// <summary> - /// Interface IServerApplicationHost + /// Interface IServerApplicationHost. /// </summary> public interface IServerApplicationHost : IApplicationHost { - event EventHandler HasUpdateAvailableChanged; - - /// <summary> - /// Gets the system info. - /// </summary> - /// <returns>SystemInfo.</returns> - Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken); - - Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken); + bool CoreStartupHasCompleted { get; } bool CanLaunchWebBrowser { get; } @@ -38,16 +32,9 @@ namespace MediaBrowser.Controller int HttpsPort { get; } /// <summary> - /// Gets a value indicating whether [supports HTTPS]. - /// </summary> - /// <value><c>true</c> if [supports HTTPS]; otherwise, <c>false</c>.</value> - bool EnableHttps { get; } - - /// <summary> - /// Gets a value indicating whether this instance has update available. + /// Gets a value indicating whether the server should listen on an HTTPS port. /// </summary> - /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value> - bool HasUpdateAvailable { get; } + bool ListenWithHttps { get; } /// <summary> /// Gets the name of the friendly. @@ -56,38 +43,70 @@ namespace MediaBrowser.Controller string FriendlyName { get; } /// <summary> - /// Gets the local ip address. + /// Gets the configured published server url. /// </summary> - /// <value>The local ip address.</value> - Task<List<IpAddressInfo>> GetLocalIpAddresses(CancellationToken cancellationToken); + string PublishedServerUrl { get; } /// <summary> - /// Gets the local API URL. + /// Gets the system info. /// </summary> - /// <value>The local API URL.</value> - Task<string> GetLocalApiUrl(CancellationToken cancellationToken); + /// <param name="request">The HTTP request.</param> + /// <returns>SystemInfo.</returns> + SystemInfo GetSystemInfo(HttpRequest request); + + PublicSystemInfo GetPublicSystemInfo(HttpRequest request); /// <summary> - /// Gets the local API URL. + /// Gets a URL specific for the request. /// </summary> - /// <param name="host">The host.</param> - /// <returns>System.String.</returns> - string GetLocalApiUrl(string host); + /// <param name="request">The <see cref="HttpRequest"/> instance.</param> + /// <param name="port">Optional port number.</param> + /// <returns>An accessible URL.</returns> + string GetSmartApiUrl(HttpRequest request, int? port = null); /// <summary> - /// Gets the local API URL. + /// Gets a URL specific for the request. /// </summary> - string GetLocalApiUrl(IpAddressInfo address); + /// <param name="remoteAddr">The remote <see cref="IPAddress"/> of the connection.</param> + /// <param name="port">Optional port number.</param> + /// <returns>An accessible URL.</returns> + string GetSmartApiUrl(IPAddress remoteAddr, int? port = null); - void LaunchUrl(string url); - - void EnableLoopback(string appName); + /// <summary> + /// Gets a URL specific for the request. + /// </summary> + /// <param name="hostname">The hostname used in the connection.</param> + /// <param name="port">Optional port number.</param> + /// <returns>An accessible URL.</returns> + string GetSmartApiUrl(string hostname, int? port = null); - string PackageRuntime { get; } + /// <summary> + /// Gets a localhost URL that can be used to access the API using the loop-back IP address. + /// over HTTP (not HTTPS). + /// </summary> + /// <returns>The API URL.</returns> + string GetLoopbackHttpApiUrl(); - WakeOnLanInfo[] GetWakeOnLanInfo(); + /// <summary> + /// Gets a local (LAN) URL that can be used to access the API. + /// Note: if passing non-null scheme or port it is up to the caller to ensure they form the correct pair. + /// </summary> + /// <param name="hostname">The hostname to use in the URL.</param> + /// <param name="scheme"> + /// The scheme to use for the URL. If null, the scheme will be selected automatically, + /// preferring HTTPS, if available. + /// </param> + /// <param name="port"> + /// The port to use for the URL. If null, the port will be selected automatically, + /// preferring the HTTPS port, if available. + /// </param> + /// <returns>The API URL.</returns> + string GetLocalApiUrl(string hostname, string scheme = null, int? port = null); + + IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo(); string ExpandVirtualPath(string path); + string ReverseVirtualPath(string path); } } |
