add "bad word filter" parameter

This commit is contained in:
Dave 2023-06-07 22:30:55 +02:00
parent 94493d71cb
commit 40d15dc74f
5 changed files with 131 additions and 1 deletions

View file

@ -41,5 +41,6 @@
RCONWindowExtents,
ServerOptions,
ServerLogOptions,
ServerBadWordFilterOptions,
}
}

View file

@ -1261,6 +1261,19 @@
<sys:String x:Key="ServerSettings_ClusterDirOverrideLabel">Cluster Directory Override</sys:String>
<sys:String x:Key="ServerSettings_ClusterDirOverrideTooltip">If enabled, allows you to use a common cross-server storage location that functions between multiple servers running on the same machine. Uses the clusters directory in the server manager Data directory.</sys:String>
<sys:String x:Key="ServerSettings_ServerBadWordFilterOptionsLabel">Bad Word Filter</sys:String>
<sys:String x:Key="ServerSettings_ResetBadWordFilterOptionsTooltip">Reset all bad word filter options to defaults.</sys:String>
<sys:String x:Key="ServerSettings_BadWordListURLLabel">Bad Word Filter URL:</sys:String>
<sys:String x:Key="ServerSettings_BadWordListURLTooltip">Add the url to hosting your own bad words list.</sys:String>
<sys:String x:Key="ServerSettings_BadWordWhiteListURLLabel">Bad Word Whitelist URL:</sys:String>
<sys:String x:Key="ServerSettings_BadWordWhiteListURLTooltip">Add the url to hosting your own good words list .</sys:String>
<sys:String x:Key="ServerSettings_FilterTribeNamesLabel">Filter Tribe Names</sys:String>
<sys:String x:Key="ServerSettings_FilterTribeNamesTooltip">Filters out tribe names based on the bad words/good words list.</sys:String>
<sys:String x:Key="ServerSettings_FilterCharacterNamesLabel">Filter Character Names</sys:String>
<sys:String x:Key="ServerSettings_FilterCharacterNamesTooltip">Filters out character names based on the bad words/good words list.</sys:String>
<sys:String x:Key="ServerSettings_FilterChatLabel">Filter Chat</sys:String>
<sys:String x:Key="ServerSettings_FilterChatTooltip">Filters chat messages based on the bad word/good words list.</sys:String>
<sys:String x:Key="ServerSettings_ServerLogOptionsLabel">Server Log Options</sys:String>
<sys:String x:Key="ServerSettings_ResetServerLogOptionsTooltip">Reset all server log options to defaults.</sys:String>
<sys:String x:Key="ServerSettings_EnableAdminLogsLabel">Enable Server Admin Logs</sys:String>

View file

@ -740,6 +740,62 @@ namespace ServerManagerTool.Lib
set { SetValue(UseVivoxProperty, value); }
}
public static readonly DependencyProperty EnableBadWordListURLProperty = DependencyProperty.Register(nameof(EnableBadWordListURL), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[DataMember]
public bool EnableBadWordListURL
{
get { return (bool)GetValue(EnableBadWordListURLProperty); }
set { SetValue(EnableBadWordListURLProperty, value); }
}
public static readonly DependencyProperty BadWordListURLProperty = DependencyProperty.Register(nameof(BadWordListURL), typeof(string), typeof(ServerProfile), new PropertyMetadata(""));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, ConditionedOn = nameof(EnableBadWordListURL), QuotedString = QuotedStringType.True)]
public string BadWordListURL
{
get { return (string)GetValue(BadWordListURLProperty); }
set { SetValue(BadWordListURLProperty, value); }
}
public static readonly DependencyProperty EnableBadWordWhiteListURLProperty = DependencyProperty.Register(nameof(EnableBadWordWhiteListURL), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[DataMember]
public bool EnableBadWordWhiteListURL
{
get { return (bool)GetValue(EnableBadWordWhiteListURLProperty); }
set { SetValue(EnableBadWordWhiteListURLProperty, value); }
}
public static readonly DependencyProperty BadWordWhiteListURLProperty = DependencyProperty.Register(nameof(BadWordWhiteListURL), typeof(string), typeof(ServerProfile), new PropertyMetadata(""));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, ConditionedOn = nameof(EnableBadWordWhiteListURL), QuotedString = QuotedStringType.True)]
public string BadWordWhiteListURL
{
get { return (string)GetValue(BadWordWhiteListURLProperty); }
set { SetValue(BadWordWhiteListURLProperty, value); }
}
public static readonly DependencyProperty FilterTribeNamesProperty = DependencyProperty.Register(nameof(FilterTribeNames), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterTribeNames")]
public bool FilterTribeNames
{
get { return (bool)GetValue(FilterTribeNamesProperty); }
set { SetValue(FilterTribeNamesProperty, value); }
}
public static readonly DependencyProperty FilterCharacterNamesProperty = DependencyProperty.Register(nameof(FilterCharacterNames), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterCharacterNames")]
public bool FilterCharacterNames
{
get { return (bool)GetValue(FilterCharacterNamesProperty); }
set { SetValue(FilterCharacterNamesProperty, value); }
}
public static readonly DependencyProperty FilterChatProperty = DependencyProperty.Register(nameof(FilterChat), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterChat")]
public bool FilterChat
{
get { return (bool)GetValue(FilterChatProperty); }
set { SetValue(FilterChatProperty, value); }
}
public static readonly DependencyProperty OutputServerLogProperty = DependencyProperty.Register(nameof(OutputServerLog), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true));
[DataMember]
public bool OutputServerLog
@ -5445,6 +5501,17 @@ namespace ServerManagerTool.Lib
this.ClearValue(ClusterDirOverrideProperty);
}
public void ResetServerBadWordFilterOptions()
{
this.ClearValue(EnableBadWordListURLProperty);
this.ClearValue(EnableBadWordWhiteListURLProperty);
this.ClearValue(BadWordListURLProperty);
this.ClearValue(BadWordWhiteListURLProperty);
this.ClearValue(FilterTribeNamesProperty);
this.ClearValue(FilterCharacterNamesProperty);
this.ClearValue(FilterChatProperty);
}
public void ResetServerLogOptions()
{
this.ClearValue(EnableServerAdminLogsProperty);
@ -5495,6 +5562,7 @@ namespace ServerManagerTool.Lib
this.ClearNullableValue(MOTDIntervalProperty);
ResetServerOptions();
ResetServerBadWordFilterOptions();
ResetServerLogOptions();
this.ClearValue(EnableWebAlarmProperty);
@ -6116,6 +6184,15 @@ namespace ServerManagerTool.Lib
this.SetValue(UseItemDupeCheckProperty, sourceProfile.UseItemDupeCheck);
this.SetValue(UseSecureSpawnRulesProperty, sourceProfile.UseSecureSpawnRules);
// server filter options
this.SetValue(EnableBadWordListURLProperty, sourceProfile.EnableBadWordListURL);
this.SetValue(EnableBadWordWhiteListURLProperty, sourceProfile.EnableBadWordWhiteListURL);
this.SetValue(BadWordListURLProperty, sourceProfile.BadWordListURL);
this.SetValue(BadWordWhiteListURLProperty, sourceProfile.BadWordWhiteListURL);
this.SetValue(FilterTribeNamesProperty, sourceProfile.FilterTribeNames);
this.SetValue(FilterCharacterNamesProperty, sourceProfile.FilterCharacterNames);
this.SetValue(FilterChatProperty, sourceProfile.FilterChat);
// server log options
this.SetValue(EnableServerAdminLogsProperty, sourceProfile.EnableServerAdminLogs);
this.SetValue(ServerAdminLogsIncludeTribeLogsProperty, sourceProfile.ServerAdminLogsIncludeTribeLogs);

View file

@ -1239,6 +1239,41 @@
</GroupBox>
<GroupBox Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="6" Style="{StaticResource GroupBoxStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource ServerSettings_ServerBadWordFilterOptionsLabel}"/>
<Button Margin="20,0,0,0" Command="{Binding ResetActionCommand, ElementName=SettingsControl}" CommandParameter="{x:Static enum:ServerSettingsResetAction.ServerBadWordFilterOptions}" ToolTip="{DynamicResource ServerSettings_ResetBadWordFilterOptionsTooltip}" Style="{StaticResource ButtonStyle1}">
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Refresh.ico,Size=32}"/>
</Button>
</StackPanel>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<cctl:CheckBoxAndTextBlock Grid.Row="0" Grid.Column="0" Margin="5" VerticalAlignment="Center" IsChecked="{Binding EnableBadWordListURL, Mode=TwoWay}" Text="{DynamicResource ServerSettings_BadWordListURLLabel}" ToolTip="{DynamicResource ServerSettings_BadWordListURLTooltip}"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding BadWordListURL}" ToolTip="{DynamicResource ServerSettings_BadWordListURLTooltip}" IsEnabled="{Binding EnableBadWordListURL}"/>
<cctl:CheckBoxAndTextBlock Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center" IsChecked="{Binding EnableBadWordWhiteListURL, Mode=TwoWay}" Text="{DynamicResource ServerSettings_BadWordWhiteListURLLabel}" ToolTip="{DynamicResource ServerSettings_BadWordWhiteListURLTooltip}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding BadWordWhiteListURL}" ToolTip="{DynamicResource ServerSettings_BadWordWhiteListURLTooltip}" IsEnabled="{Binding EnableBadWordWhiteListURL}"/>
<cctl:CheckBoxAndTextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding FilterTribeNames, Mode=TwoWay}" Text="{DynamicResource ServerSettings_FilterTribeNamesLabel}" VerticalAlignment="Center" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_FilterTribeNamesTooltip}"/>
<cctl:CheckBoxAndTextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding FilterCharacterNames, Mode=TwoWay}" Text="{DynamicResource ServerSettings_FilterCharacterNamesLabel}" VerticalAlignment="Center" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_FilterCharacterNamesTooltip}"/>
<cctl:CheckBoxAndTextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5,0" IsChecked="{Binding FilterChat, Mode=TwoWay}" Text="{DynamicResource ServerSettings_FilterChatLabel}" VerticalAlignment="Center" HorizontalAlignment="Left" ToolTip="{DynamicResource ServerSettings_FilterChatTooltip}"/>
</Grid>
</GroupBox>
<GroupBox Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="6" Style="{StaticResource GroupBoxStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource ServerSettings_ServerLogOptionsLabel}"/>
@ -1276,7 +1311,7 @@
</Grid>
</GroupBox>
<GroupBox Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="6" Style="{StaticResource GroupBoxStyle}">
<GroupBox Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="6" Style="{StaticResource GroupBoxStyle}">
<GroupBox.Header>
<cctl:CheckBoxAndTextBlock Name="EnableWebAlarmCheckbox" IsChecked="{Binding EnableWebAlarm, Mode=TwoWay}" Text="{DynamicResource ServerSettings_EnableWebAlarmLabel}" ToolTip="{DynamicResource ServerSettings_EnableWebAlarmTooltip}" />
</GroupBox.Header>

View file

@ -4302,6 +4302,10 @@ namespace ServerManagerTool
case ServerSettingsResetAction.ServerLogOptions:
this.Settings.ResetServerLogOptions();
break;
case ServerSettingsResetAction.ServerBadWordFilterOptions:
this.Settings.ResetServerBadWordFilterOptions();
break;
}
},
canExecute: (action) => true