fix gravatars not showing
fix web config not saving Uri fix issue with token login
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Configuration.Attributes;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -10,7 +10,7 @@ namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
|
||||
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
|
||||
[LinkedConfiguration("WebfrontBindUrl", "ManualWebfrontUrl")]
|
||||
[ConfiguratinLinked("WebfrontBindUrl", "ManualWebfrontUrl")]
|
||||
public bool EnableWebFront { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
|
||||
public string WebfrontBindUrl { get; set; }
|
||||
@ -27,14 +27,14 @@ namespace SharedLibraryCore.Configuration
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
|
||||
public bool IgnoreBots { get; set; }
|
||||
|
||||
[LinkedConfiguration("CustomSayName")]
|
||||
[ConfiguratinLinked("CustomSayName")]
|
||||
[LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")]
|
||||
public bool EnableCustomSayName { get; set; }
|
||||
[LocalizedDisplayName("SETUP_SAY_NAME")]
|
||||
public string CustomSayName { get; set; }
|
||||
|
||||
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
|
||||
[LinkedConfiguration("SocialLinkAddress", "SocialLinkTitle")]
|
||||
[ConfiguratinLinked("SocialLinkAddress", "SocialLinkTitle")]
|
||||
public bool EnableSocialLink { get; set; }
|
||||
[LocalizedDisplayName("SETUP_SOCIAL_LINK")]
|
||||
public string SocialLinkAddress { get; set; }
|
||||
@ -42,18 +42,19 @@ namespace SharedLibraryCore.Configuration
|
||||
public string SocialLinkTitle { get; set; }
|
||||
|
||||
[LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")]
|
||||
[LinkedConfiguration("CustomParserEncoding")]
|
||||
[ConfiguratinLinked("CustomParserEncoding")]
|
||||
public bool EnableCustomParserEncoding { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")]
|
||||
public string CustomParserEncoding { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
|
||||
[LinkedConfiguration("WebfrontConnectionWhitelist")]
|
||||
[ConfiguratinLinked("WebfrontConnectionWhitelist")]
|
||||
public bool EnableWebfrontConnectionWhitelist { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_WHITELIST_LIST")]
|
||||
public List<string> WebfrontConnectionWhitelist { get; set; }
|
||||
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
||||
[LinkedConfiguration("CustomLocale")]
|
||||
[ConfiguratinLinked("CustomLocale")]
|
||||
public bool EnableCustomLocale { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
|
||||
public string CustomLocale { get; set; }
|
||||
@ -119,14 +120,7 @@ namespace SharedLibraryCore.Configuration
|
||||
}
|
||||
|
||||
RConPollRate = 5000;
|
||||
DisallowedClientNames = new List<string>()
|
||||
{
|
||||
"Unknown Soldier",
|
||||
"UnknownSoldier",
|
||||
"CHEATER",
|
||||
"VickNet"
|
||||
};
|
||||
|
||||
AutoMessagePeriod = 60;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
namespace SharedLibraryCore.Configuration.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class LinkedConfiguration : Attribute
|
||||
public class ConfiguratinLinked : Attribute
|
||||
{
|
||||
public string[] LinkedPropertyNames { get; set; }
|
||||
|
||||
public LinkedConfiguration(params string[] linkedPropertyNames)
|
||||
public ConfiguratinLinked(params string[] linkedPropertyNames)
|
||||
{
|
||||
LinkedPropertyNames = linkedPropertyNames;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
namespace SharedLibraryCore.Configuration.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class ConfigurationIgnore : Attribute
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
namespace SharedLibraryCore.Configuration.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||
public class ConfigurationOptional : Attribute
|
@ -3,12 +3,12 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Configuration
|
||||
namespace SharedLibraryCore.Configuration.Attributes
|
||||
{
|
||||
class LocalizedDisplayNameAttribute : DisplayNameAttribute
|
||||
class LocalizedDisplayName : DisplayNameAttribute
|
||||
{
|
||||
private readonly string _localizationKey;
|
||||
public LocalizedDisplayNameAttribute(string localizationKey)
|
||||
public LocalizedDisplayName(string localizationKey)
|
||||
{
|
||||
_localizationKey = localizationKey;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Configuration.Attributes;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -7,15 +8,27 @@ namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
public class ServerConfiguration : IBaseConfiguration
|
||||
{
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_IP")]
|
||||
public string IPAddress { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_PORT")]
|
||||
public int Port { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_PASSWORD")]
|
||||
public string Password { get; set; }
|
||||
public IList<string> Rules { get; set; }
|
||||
public IList<string> AutoMessages { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_RULES")]
|
||||
public List<string> Rules { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_AUTO_MESSAGES")]
|
||||
public List<string> AutoMessages { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_PATH")]
|
||||
[ConfigurationOptional]
|
||||
public string ManualLogPath { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_RCON_PARSER")]
|
||||
public string RConParserVersion { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_EVENT_PARSER")]
|
||||
public string EventParserVersion { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_RESERVED_SLOT")]
|
||||
public int ReservedSlotNumber { get; set; }
|
||||
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_SERVER_GAME_LOG_SERVER")]
|
||||
[ConfigurationOptional]
|
||||
public Uri GameLogServerUrl { get; set; }
|
||||
|
||||
private readonly IList<IRConParser> rconParsers;
|
||||
@ -25,6 +38,8 @@ namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
rconParsers = new List<IRConParser>();
|
||||
eventParsers = new List<IEventParser>();
|
||||
Rules = new List<string>();
|
||||
AutoMessages = new List<string>();
|
||||
}
|
||||
|
||||
public void AddRConParser(IRConParser parser)
|
||||
|
@ -244,19 +244,9 @@ namespace SharedLibraryCore.Services
|
||||
|
||||
// this updates the level for all the clients with the same LinkId
|
||||
// only if their new level is flagged or banned
|
||||
await iqMatchingClients.ForEachAsync(async (_client) =>
|
||||
await iqMatchingClients.ForEachAsync(_client =>
|
||||
{
|
||||
_client.Level = newPermission;
|
||||
|
||||
// hack this saves our change to the change history log
|
||||
await changeSvc.Add(new GameEvent()
|
||||
{
|
||||
Type = GameEvent.EventType.ChangePermission,
|
||||
Extra = newPermission,
|
||||
Origin = origin,
|
||||
Owner = temporalClient.CurrentServer,
|
||||
Target = _client
|
||||
}, ctx);
|
||||
#if DEBUG == true
|
||||
temporalClient.CurrentServer.Logger.WriteDebug($"Updated linked {_client.ClientId} to {newPermission}");
|
||||
#endif
|
||||
@ -451,7 +441,7 @@ namespace SharedLibraryCore.Services
|
||||
|
||||
public async Task<IList<EFClient>> FindClientsByIdentifier(string identifier)
|
||||
{
|
||||
if (identifier.Length < 3)
|
||||
if (identifier?.Length < 3)
|
||||
{
|
||||
return new List<EFClient>();
|
||||
}
|
||||
@ -468,7 +458,7 @@ namespace SharedLibraryCore.Services
|
||||
alias.Name.ToLower().Contains(identifier)
|
||||
select alias.LinkId).Distinct();
|
||||
|
||||
var linkIds = iqLinkIds.ToList();
|
||||
var linkIds = await iqLinkIds.ToListAsync();
|
||||
|
||||
var iqClients = context.Clients
|
||||
.Where(c => linkIds.Contains(c.AliasLinkId) ||
|
||||
|
@ -31,7 +31,6 @@ namespace SharedLibraryCore.Services
|
||||
IsEvadedOffense = newEntity.IsEvadedOffense
|
||||
};
|
||||
|
||||
newEntity.Offender.ReceivedPenalties?.Add(penalty);
|
||||
context.Penalties.Add(penalty);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
@ -40,11 +39,13 @@ namespace SharedLibraryCore.Services
|
||||
{
|
||||
var iqLinkedProfiles = context.Clients
|
||||
.Where(_client => _client.AliasLinkId == newEntity.Link.AliasLinkId)
|
||||
.Where(_client => _client.Level != EFClient.Permission.Banned)
|
||||
// prevent adding the penalty twice to the same profile
|
||||
.Where(_client => _client.ClientId != penalty.OffenderId);
|
||||
|
||||
await iqLinkedProfiles.ForEachAsync(_client =>
|
||||
{
|
||||
|
||||
var linkedPenalty = new EFPenalty()
|
||||
{
|
||||
OffenderId = _client.ClientId,
|
||||
|
Reference in New Issue
Block a user