minor fixed
This commit is contained in:
parent
4522992c0e
commit
b77bdbe793
@ -6,7 +6,7 @@
|
|||||||
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.2.2.0</Version>
|
<Version>2.2.2.2</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<AssemblyVersion>2.2.2.0</AssemblyVersion>
|
<AssemblyVersion>2.2.2.2</AssemblyVersion>
|
||||||
<FileVersion>2.2.2.0</FileVersion>
|
<FileVersion>2.2.2.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -40,7 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug
|
|||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
Plugins\ScriptPlugins\SharedGUIDKick.js = Plugins\ScriptPlugins\SharedGUIDKick.js
|
Plugins\ScriptPlugins\SharedGUIDKick.js = Plugins\ScriptPlugins\SharedGUIDKick.js
|
||||||
Plugins\ScriptPlugins\VPNDetection.js = Plugins\ScriptPlugins\VPNDetection.js
|
Plugins\ScriptPlugins\VPNDetection.js = Plugins\ScriptPlugins\VPNDetection.js
|
||||||
Plugins\ScriptPlugins\VpnDetectionPrivate.js = Plugins\ScriptPlugins\VpnDetectionPrivate.js
|
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "GameLogServer", "GameLogServer\GameLogServer.pyproj", "{42EFDA12-10D3-4C40-A210-9483520116BC}"
|
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "GameLogServer", "GameLogServer\GameLogServer.pyproj", "{42EFDA12-10D3-4C40-A210-9483520116BC}"
|
||||||
|
@ -485,7 +485,7 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
// hack: re apply the automated offense to the reban
|
// hack: re apply the automated offense to the reban
|
||||||
if (currentBan.AutomatedOffense != null)
|
if (currentBan.AutomatedOffense != null)
|
||||||
{
|
{
|
||||||
autoKickClient.AdministeredPenalties.Add(new EFPenalty()
|
autoKickClient.AdministeredPenalties?.Add(new EFPenalty()
|
||||||
{
|
{
|
||||||
AutomatedOffense = currentBan.AutomatedOffense
|
AutomatedOffense = currentBan.AutomatedOffense
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,6 @@ using System.Collections.Concurrent;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -29,7 +28,8 @@ namespace SharedLibraryCore.RCon
|
|||||||
static readonly ConcurrentDictionary<EndPoint, ConnectionState> ActiveQueries = new ConcurrentDictionary<EndPoint, ConnectionState>();
|
static readonly ConcurrentDictionary<EndPoint, ConnectionState> ActiveQueries = new ConcurrentDictionary<EndPoint, ConnectionState>();
|
||||||
public IPEndPoint Endpoint { get; private set; }
|
public IPEndPoint Endpoint { get; private set; }
|
||||||
public string RConPassword { get; private set; }
|
public string RConPassword { get; private set; }
|
||||||
ILogger Log;
|
|
||||||
|
private readonly ILogger Log;
|
||||||
|
|
||||||
public Connection(string ipAddress, int port, string password, ILogger log)
|
public Connection(string ipAddress, int port, string password, ILogger log)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ namespace SharedLibraryCore.RCon
|
|||||||
|
|
||||||
byte[] response = null;
|
byte[] response = null;
|
||||||
|
|
||||||
retrySend:
|
retrySend:
|
||||||
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
|
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
|
||||||
{
|
{
|
||||||
//DontFragment = true,
|
//DontFragment = true,
|
||||||
@ -107,7 +107,7 @@ namespace SharedLibraryCore.RCon
|
|||||||
{
|
{
|
||||||
response = await SendPayloadAsync(payload, waitForResponse);
|
response = await SendPayloadAsync(payload, waitForResponse);
|
||||||
|
|
||||||
if (response.Length == 0)
|
if (response.Length == 0 && waitForResponse)
|
||||||
{
|
{
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,12 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
public async Task UpdateAlias(EFClient entity)
|
public async Task UpdateAlias(EFClient entity)
|
||||||
{
|
{
|
||||||
|
// todo: move this out
|
||||||
|
if (entity.IsBot)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
using (var context = new DatabaseContext())
|
using (var context = new DatabaseContext())
|
||||||
{
|
{
|
||||||
context.Attach(entity);
|
context.Attach(entity);
|
||||||
@ -60,10 +66,16 @@ namespace SharedLibraryCore.Services
|
|||||||
bool hasExistingAlias = false;
|
bool hasExistingAlias = false;
|
||||||
|
|
||||||
// get all aliases by IP
|
// get all aliases by IP
|
||||||
var aliases = await context.Aliases
|
var iqAliases = context.Aliases
|
||||||
.Include(a => a.Link)
|
.Include(a => a.Link)
|
||||||
.Where(a => a.IPAddress != null && a.IPAddress == ip)
|
.Where(a => a.Link.Active)
|
||||||
.ToListAsync();
|
.Where(a => (a.IPAddress != null && a.IPAddress == ip) ||
|
||||||
|
a.LinkId == entity.AliasLinkId);
|
||||||
|
|
||||||
|
#if DEBUG == true
|
||||||
|
var aliasSql = iqAliases.ToSql();
|
||||||
|
#endif
|
||||||
|
var aliases = await iqAliases.ToListAsync();
|
||||||
|
|
||||||
// see if they have a matching IP + Name but new NetworkId
|
// see if they have a matching IP + Name but new NetworkId
|
||||||
var existingAlias = aliases.FirstOrDefault(a => a.Name == name);
|
var existingAlias = aliases.FirstOrDefault(a => a.Name == name);
|
||||||
@ -112,6 +124,7 @@ namespace SharedLibraryCore.Services
|
|||||||
|
|
||||||
existingAlias = alias;
|
existingAlias = alias;
|
||||||
aliasLink = _aliasLink;
|
aliasLink = _aliasLink;
|
||||||
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no existing alias create new alias
|
// if no existing alias create new alias
|
||||||
@ -128,10 +141,24 @@ namespace SharedLibraryCore.Services
|
|||||||
entity.CurrentServer.Logger.WriteDebug($"Connecting player does not have an existing alias {entity}");
|
entity.CurrentServer.Logger.WriteDebug($"Connecting player does not have an existing alias {entity}");
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.Level = hasExistingAlias ?
|
else
|
||||||
await context.Clients.Where(c => c.AliasLinkId == existingAlias.LinkId)
|
{
|
||||||
.MaxAsync(c => c.Level) :
|
var linkIds = aliases.Select(a => a.LinkId);
|
||||||
Permission.User;
|
|
||||||
|
if (linkIds.Count() > 0)
|
||||||
|
{
|
||||||
|
var highestLevel = await context.Clients
|
||||||
|
.Where(c => linkIds.Contains(c.AliasLinkId))
|
||||||
|
.MaxAsync(c => c.Level);
|
||||||
|
|
||||||
|
if (entity.Level != highestLevel)
|
||||||
|
{
|
||||||
|
context.Update(entity);
|
||||||
|
entity.Level = highestLevel;
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (entity.CurrentAlias != existingAlias ||
|
if (entity.CurrentAlias != existingAlias ||
|
||||||
entity.AliasLink != aliasLink)
|
entity.AliasLink != aliasLink)
|
||||||
|
@ -36,7 +36,8 @@ namespace SharedLibraryCore
|
|||||||
CurrentAlias = new EFAlias()
|
CurrentAlias = new EFAlias()
|
||||||
{
|
{
|
||||||
Name = "IW4MAdmin"
|
Name = "IW4MAdmin"
|
||||||
}
|
},
|
||||||
|
AdministeredPenalties = new List<EFPenalty>()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user