This commit is contained in:
Bitl 2021-11-14 10:00:39 -07:00
parent b528304cf1
commit 5a5b20aea4
5 changed files with 62 additions and 19 deletions

View File

@ -2082,10 +2082,7 @@ public class GlobalFuncs
break;
case ScriptType.Server:
#if LAUNCHER
if (box != null)
{
PingMasterServer(1, "Server will now display on the defined master server.", box);
}
PingMasterServer(1, "Server will now display on the defined master server.", box);
#elif CMD
PingMasterServer(1, "Server will now display on the defined master server.");
#endif

View File

@ -42,6 +42,7 @@ namespace NovetusLauncher
public List<TreeNode> CurrentNodeMatches = new List<TreeNode>();
public int LastNodeIndex = 0;
public string LastSearchText;
public bool HideMasterAddressWarning;
//CONTROLS
public Form Parent = null;
@ -200,6 +201,8 @@ namespace NovetusLauncher
#region Form Event Functions
public void InitForm()
{
HideMasterAddressWarning = false;
if (FormStyle != Settings.Style.Stylish)
{
Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version;
@ -489,9 +492,9 @@ namespace NovetusLauncher
else if (FormStyle != Settings.Style.Stylish && no3d)
{
DialogResult result = MessageBox.Show("Launching the server without graphics enables better performance.\n" +
"However, launching the server with no graphics may cause some elements in later clients may be disabled, such as Dialog boxes. " +
"This feature may also make your server unstable.",
"Novetus - No3D Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
"However, launching the server with no graphics may cause some elements in later clients may be disabled, such as Dialog boxes. " +
"This feature may also make your server unstable.",
"Novetus - No3D Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
switch (result)
{
@ -1342,16 +1345,23 @@ namespace NovetusLauncher
public void ShowMasterServerWarning()
{
DialogResult res = MessageBox.Show("Due to Novetus' open nature when it comes to hosting master servers, hosting on a public master server may leave your server (and potentially computer) open for security vulnerabilities.\nTo protect yourself against this, host under a VPN, use a host name, or use a trustworthy master server that is hosted privately or an official server.\n\nDo you trust this master server?", "Novetus - Master Server Security Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
switch (res)
if (!HideMasterAddressWarning)
{
case DialogResult.Yes:
break;
case DialogResult.No:
default:
ServerBrowserAddressBox.Text = "localhost";
break;
DialogResult res = MessageBox.Show("Due to Novetus' open nature when it comes to hosting master servers, hosting on a public master server may leave your server (and potentially computer) open for security vulnerabilities." +
"\nTo protect yourself against this, host under a VPN, use a host name, or use a trustworthy master server that is hosted privately or an official server." +
"\n\nDo you trust the master server you're about to input in?", "Novetus - Master Server Security Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
switch (res)
{
case DialogResult.Yes:
break;
case DialogResult.No:
default:
ServerBrowserAddressBox.Text = "localhost";
break;
}
HideMasterAddressWarning = true;
}
}

View File

@ -797,7 +797,7 @@
<Label x:Name="browserNameLabel" Content="Browser Server Name:" HorizontalAlignment="Left" Margin="9,120,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="browserNameBox" HorizontalAlignment="Left" Height="20" Margin="11,141,0,0" Text="Novetus" VerticalAlignment="Top" Width="135" TextChanged="browserNameBox_TextChanged"/>
<Label x:Name="browserAddressLabel" Content="Browser Master Server:" HorizontalAlignment="Left" Margin="6,155,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="browserAddressBox" HorizontalAlignment="Left" Height="20" Margin="11,176,0,0" Text="localhost" VerticalAlignment="Top" Width="135" TextChanged="browserAddressBox_TextChanged"/>
<TextBox x:Name="browserAddressBox" HorizontalAlignment="Left" Height="20" Margin="11,176,0,0" Text="localhost" VerticalAlignment="Top" Width="135" TextChanged="browserAddressBox_TextChanged" PreviewMouseUp="browserAddressBox_Mouse"/>
<Button x:Name="ServerButton" Style="{DynamicResource ImportantButton}" Content="Start Server!" HorizontalAlignment="Left" Margin="10,202,0,0" VerticalAlignment="Top" Width="136" Height="34" Click="ServerButton_Click"/>
</Grid>
</GroupBox>

View File

@ -18,6 +18,7 @@ namespace NovetusLauncher
private System.Windows.Forms.TreeView _fieldsTreeCache;
public LauncherFormStylish FormParent;
private bool hostPanelOpen;
public bool HideMasterAddressWarning;
#endregion
#region Constructor
@ -38,6 +39,7 @@ namespace NovetusLauncher
launcherForm._TreeCache = _fieldsTreeCache;
hostPanelOpen = true;
HideMasterAddressWarning = false;
}
#endregion
@ -502,6 +504,31 @@ namespace NovetusLauncher
ToggleServerOptions();
}
private void browserAddressBox_Mouse(object sender, MouseButtonEventArgs e)
{
if (!IsLoaded)
return;
if (!HideMasterAddressWarning)
{
DialogResult res = System.Windows.Forms.MessageBox.Show("Due to Novetus' open nature when it comes to hosting master servers, hosting on a public master server may leave your server (and potentially computer) open for security vulnerabilities." +
"\nTo protect yourself against this, host under a VPN, use a host name, or use a trustworthy master server that is hosted privately or an official server." +
"\n\nDo you trust the master server you're about to input in?", "Novetus - Master Server Security Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
switch (res)
{
case DialogResult.Yes:
break;
case DialogResult.No:
default:
browserAddressBox.Text = "localhost";
break;
}
HideMasterAddressWarning = true;
}
}
#endregion
#region Functions
@ -522,6 +549,8 @@ namespace NovetusLauncher
public void ToggleServerOptions()
{
browserAddressBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerAddress;
if (!hostPanelOpen)
{
hostBox.Visibility = Visibility.Visible;
@ -558,8 +587,8 @@ namespace NovetusLauncher
hostPanelOpen = false;
}
#endregion
}
#endregion
}
#endregion

View File

@ -1,6 +1,7 @@
#region Usings
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
@ -190,11 +191,18 @@ namespace NovetusLauncher
foreach (var server in serverList)
{
var serverItem = new ListViewItem(server.ServerName);
serverItem.UseItemStyleForSubItems = false;
var serverClient = new ListViewItem.ListViewSubItem(serverItem, server.ServerClient);
serverItem.SubItems.Add(serverClient);
var serverVersion = new ListViewItem.ListViewSubItem(serverItem, server.ServerVersion);
if (serverVersion.Text != GlobalVars.ProgramInformation.Version)
{
serverVersion.ForeColor = Color.Red;
}
serverItem.SubItems.Add(serverVersion);
ServerListView.Items.Add(serverItem);
@ -250,7 +258,6 @@ namespace NovetusLauncher
!string.IsNullOrWhiteSpace(ServerVersion) &&
GlobalFuncs.IsClientValid(ServerClient) &&
GlobalFuncs.IsIPValid(ServerIP) &&
ServerVersion == GlobalVars.ProgramInformation.Version &&
(!ServerIP.Equals("localhost") || !ServerIP.Equals("127.0.0.1")))
{
return true;