From 5bc4d489710f582eb5ad1208eb72d5a69505bdb2 Mon Sep 17 00:00:00 2001 From: CmTheLuke Date: Wed, 29 Jan 2020 11:43:42 -0500 Subject: [PATCH] UI.cs - Listen to "localhost" by default --- Ooui/UI.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Ooui/UI.cs b/Ooui/UI.cs index 51a5842..97c10d1 100644 --- a/Ooui/UI.cs +++ b/Ooui/UI.cs @@ -33,7 +33,7 @@ namespace Ooui static string host = "*"; public static string Host { - get => host; + get => host == "*" ? "localhost" : host; set { if (!string.IsNullOrWhiteSpace (value) && host != value) { host = value; @@ -191,9 +191,8 @@ namespace Ooui } public static string GetUrl (string path) - { - var localhost = host == "*" ? "localhost" : host; - var url = $"http://{localhost}:{port}{path}"; + { + var url = $"http://{Host}:{port}{path}"; return url; } @@ -205,7 +204,7 @@ namespace Ooui if (serverCts != null) return; serverCts = new CancellationTokenSource (); var token = serverCts.Token; - var listenerPrefix = $"http://{host}:{port}/"; + var listenerPrefix = $"http://{Host}:{port}/"; Task.Run (() => RunAsync (listenerPrefix, token), token); }