fix bug with chat context timestamps not parsing is different machine locales

add disallowed client names to default config
fix ping not working for targets
This commit is contained in:
RaidMax 2019-04-08 20:31:32 -05:00
parent 9d9be7f8af
commit 9f8c35dbed
7 changed files with 21 additions and 6 deletions

View File

@ -259,6 +259,7 @@ namespace IW4MAdmin.Application
newConfig.AutoMessages = defaultConfig.AutoMessages;
newConfig.GlobalRules = defaultConfig.GlobalRules;
newConfig.Maps = defaultConfig.Maps;
newConfig.DisallowedClientNames = defaultConfig.DisallowedClientNames;
newConfig.QuickMessages = defaultConfig.QuickMessages;
if (newConfig.Servers == null)
@ -287,7 +288,7 @@ namespace IW4MAdmin.Application
}
}
else if (config != null)
else
{
if (string.IsNullOrEmpty(config.Id))
{
@ -323,7 +324,7 @@ namespace IW4MAdmin.Application
}
}
else if (config.Servers.Count == 0)
if (config.Servers.Count == 0)
{
throw new ServerException("A server configuration in IW4MAdminSettings.json is invalid");
}

View File

@ -16,6 +16,7 @@
"Keep grenade launcher use to a minimum",
"Balance teams at ALL times"
],
"DisallowedClientNames": ["Unknown Soldier", "VickNet", "UnknownSoldier", "CHEATER"],
"QuickMessages": [
{
"Game": "IW4",

View File

@ -54,10 +54,11 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
}
[HttpGet]
public async Task<IActionResult> GetMessageAsync(int serverId, DateTime when)
public async Task<IActionResult> GetMessageAsync(int serverId, long when)
{
var whenUpper = when.AddMinutes(5);
var whenLower = when.AddMinutes(-5);
var whenTime = DateTime.FromFileTimeUtc(when);
var whenUpper = whenTime.AddMinutes(5);
var whenLower = whenTime.AddMinutes(-5);
using (var ctx = new SharedLibraryCore.Database.DatabaseContext(true))
{

View File

@ -1219,6 +1219,11 @@ namespace SharedLibraryCore.Commands
public override Task ExecuteAsync(GameEvent E)
{
if (E.Target == null)
{
E.Target = E.Owner.GetClientByName(E.Data).FirstOrDefault();
}
if (E.Message.IsBroadcastCommand())
{
if (E.Target == null)

View File

@ -11,6 +11,7 @@ namespace SharedLibraryCore.Configuration
public List<string> GlobalRules { get; set; }
public List<MapConfiguration> Maps { get; set; }
public List<QuickMessageConfiguration> QuickMessages {get; set;}
public List<string> DisallowedClientNames { get; set; }
public IBaseConfiguration Generate() => this;

View File

@ -22,6 +22,12 @@ namespace SharedLibraryCore.Services
/// <returns></returns>
public async Task AddPersistentMeta(string metaKey, string metaValue, EFClient client)
{
// this seems to happen if the client disconnects before they've had time to authenticate and be added
if (client.ClientId < 1)
{
return;
}
using (var ctx = new DatabaseContext())
{
var existingMeta = await ctx.EFMeta

View File

@ -55,7 +55,7 @@
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage:
<div class="profile-meta-entry loader-data-time" data-time="@meta.When">
<span style="color:white;">></span>
<span class="client-message text-muted" data-serverid="@meta.Extra" data-when="@meta.When" title="@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_MESSAGE_CONTEXT"]"> @meta.Value</span>
<span class="client-message text-muted" data-serverid="@meta.Extra" data-when="@meta.When.ToFileTimeUtc()" title="@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_MESSAGE_CONTEXT"]"> @meta.Value</span>
</div>
break;
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ReceivedPenalty: