Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Server/Components/Pages/ServerConfig.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Remotely.Server.Services;
using Remotely.Shared.Entities;
using Remotely.Shared.Interfaces;
using System.Net;
using System.Text.Json;

namespace Remotely.Server.Components.Pages;
Expand Down Expand Up @@ -105,12 +106,15 @@ private void AddBannedDevice()

private void AddKnownProxy()
{
if (string.IsNullOrWhiteSpace(_knownProxyToAdd))
if (IPAddress.TryParse(_knownProxyToAdd, out _))
{
return;
Input.KnownProxies.Add(_knownProxyToAdd);
}
else
{
ToastService.ShowToast2("Invalid IP address.", Enums.ToastType.Warning);
}

Input.KnownProxies.Add(_knownProxyToAdd);
_knownProxyToAdd = string.Empty;
}

Expand Down
5 changes: 4 additions & 1 deletion Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@
{
foreach (var proxy in knownProxies)
{
options.KnownProxies.Add(IPAddress.Parse(proxy));
if (IPAddress.TryParse(proxy, out var ip))
{
options.KnownProxies.Add(ip);
}
}
}
});
Expand Down