diff options
| author | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-05-10 14:36:11 -0400 |
|---|---|---|
| committer | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-05-10 14:36:11 -0400 |
| commit | 43c22a58229892836df645031fb570f37994e19e (patch) | |
| tree | 78223ac23c1091245df8ac36db9ad486277ec20a /MediaBrowser.Controller/IServerApplicationHost.cs | |
| parent | 15fd4812f09282e9b81f53845ce462f42ff1b5e9 (diff) | |
Add GetLoopbackHttpApiUrl() helper method to replace forceHttps functionality
Also refactor to use return a Uri instead of a string and use UriBuilder under the hood
Diffstat (limited to 'MediaBrowser.Controller/IServerApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Controller/IServerApplicationHost.cs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 8537e4180..0028bd689 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -65,27 +65,42 @@ namespace MediaBrowser.Controller /// <summary> /// Gets a local (LAN) URL that can be used to access the API. The hostname used is the first valid configured - /// IP address that can be found via <see cref="GetLocalIpAddresses"/>. + /// IP address that can be found via <see cref="GetLocalIpAddresses"/>. HTTPS will be preferred when available. /// </summary> /// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param> /// <returns>The server URL.</returns> Task<string> GetLocalApiUrl(CancellationToken cancellationToken); /// <summary> - /// Gets a local (LAN) URL that can be used to access the API. + /// Gets a local (LAN) URL that can be used to access the API using the loop-back IP address (127.0.0.1) + /// over HTTP (not HTTPS). /// </summary> - /// <param name="hostname">The hostname to use in the URL.</param> /// <returns>The API URL.</returns> - string GetLocalApiUrl(ReadOnlySpan<char> hostname); + public Uri GetLoopbackHttpApiUrl(); /// <summary> - /// Gets a local (LAN) URL that can be used to access the API. + /// Gets a local (LAN) URL that can be used to access the API. HTTPS will be preferred when available. /// </summary> /// <param name="address">The IP address to use as the hostname in the URL.</param> /// <returns>The API URL.</returns> string GetLocalApiUrl(IPAddress address); /// <summary> + /// Gets a local (LAN) URL that can be used to access the API. + /// </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> + Uri GetLocalApiUrl(ReadOnlySpan<char> hostname, string scheme = null, int? port = null); + + /// <summary> /// Open a URL in an external browser window. /// </summary> /// <param name="url">The URL to open.</param> |
