Skip to content

Commit 74b00d3

Browse files
committed
Add server password to config UI
1 parent 355375e commit 74b00d3

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎Torch.Server/ViewModels/ConfigDedicatedViewModel.cs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,26 @@ public WorldViewModel SelectedWorld
9999
public int SteamPort { get => _config.SteamPort; set => SetValue(x => _config.SteamPort = x, value); }
100100

101101
public string WorldName { get => _config.WorldName; set => SetValue(x => _config.WorldName = x, value); }
102+
103+
//this is a damn server password. I don't care if this is insecure. Bite me.
104+
private string _password;
105+
public string Password
106+
{
107+
get
108+
{
109+
if (string.IsNullOrEmpty(_password))
110+
{
111+
if (string.IsNullOrEmpty(_config.ServerPasswordHash))
112+
return string.Empty;
113+
return "**********";
114+
}
115+
return _password;
116+
}
117+
set
118+
{
119+
_password = value;
120+
_config.SetPassword(value);
121+
}
122+
}
102123
}
103124
}

‎Torch.Server/Views/ConfigControl.xaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
<Label Content=":" Width="12" />
8585
<TextBox Text="{Binding Port}" Width="48" Height="20" />
8686
</StackPanel>
87+
<Label Content="Server Password"/>
88+
<TextBox Text="{Binding Password}" Width="160"/>
8789
<CheckBox IsChecked="{Binding PauseGameWhenEmpty}" Content="Pause When Empty" Margin="3" />
8890
</StackPanel>
8991
<StackPanel Grid.Column="1" Margin="3">

0 commit comments

Comments
 (0)