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; break;
case ScriptType.Server: case ScriptType.Server:
#if LAUNCHER #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 #elif CMD
PingMasterServer(1, "Server will now display on the defined master server."); PingMasterServer(1, "Server will now display on the defined master server.");
#endif #endif

View File

@ -42,6 +42,7 @@ namespace NovetusLauncher
public List<TreeNode> CurrentNodeMatches = new List<TreeNode>(); public List<TreeNode> CurrentNodeMatches = new List<TreeNode>();
public int LastNodeIndex = 0; public int LastNodeIndex = 0;
public string LastSearchText; public string LastSearchText;
public bool HideMasterAddressWarning;
//CONTROLS //CONTROLS
public Form Parent = null; public Form Parent = null;
@ -200,6 +201,8 @@ namespace NovetusLauncher
#region Form Event Functions #region Form Event Functions
public void InitForm() public void InitForm()
{ {
HideMasterAddressWarning = false;
if (FormStyle != Settings.Style.Stylish) if (FormStyle != Settings.Style.Stylish)
{ {
Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version; Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version;
@ -489,9 +492,9 @@ namespace NovetusLauncher
else if (FormStyle != Settings.Style.Stylish && no3d) else if (FormStyle != Settings.Style.Stylish && no3d)
{ {
DialogResult result = MessageBox.Show("Launching the server without graphics enables better performance.\n" + 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. " + "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.", "This feature may also make your server unstable.",
"Novetus - No3D Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); "Novetus - No3D Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
switch (result) switch (result)
{ {
@ -1342,16 +1345,23 @@ namespace NovetusLauncher
public void ShowMasterServerWarning() 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); if (!HideMasterAddressWarning)
switch (res)
{ {
case DialogResult.Yes: 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." +
break; "\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." +
case DialogResult.No: "\n\nDo you trust the master server you're about to input in?", "Novetus - Master Server Security Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
default:
ServerBrowserAddressBox.Text = "localhost"; switch (res)
break; {
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"/> <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"/> <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"/> <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"/> <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> </Grid>
</GroupBox> </GroupBox>

View File

@ -18,6 +18,7 @@ namespace NovetusLauncher
private System.Windows.Forms.TreeView _fieldsTreeCache; private System.Windows.Forms.TreeView _fieldsTreeCache;
public LauncherFormStylish FormParent; public LauncherFormStylish FormParent;
private bool hostPanelOpen; private bool hostPanelOpen;
public bool HideMasterAddressWarning;
#endregion #endregion
#region Constructor #region Constructor
@ -38,6 +39,7 @@ namespace NovetusLauncher
launcherForm._TreeCache = _fieldsTreeCache; launcherForm._TreeCache = _fieldsTreeCache;
hostPanelOpen = true; hostPanelOpen = true;
HideMasterAddressWarning = false;
} }
#endregion #endregion
@ -502,6 +504,31 @@ namespace NovetusLauncher
ToggleServerOptions(); 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 #endregion
#region Functions #region Functions
@ -522,6 +549,8 @@ namespace NovetusLauncher
public void ToggleServerOptions() public void ToggleServerOptions()
{ {
browserAddressBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerAddress;
if (!hostPanelOpen) if (!hostPanelOpen)
{ {
hostBox.Visibility = Visibility.Visible; hostBox.Visibility = Visibility.Visible;
@ -558,8 +587,8 @@ namespace NovetusLauncher
hostPanelOpen = false; hostPanelOpen = false;
} }
#endregion
} }
#endregion
} }
#endregion #endregion

View File

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