Log server ID in connection logs table (#21911)

This commit is contained in:
Pieter-Jan Briers
2023-12-06 23:48:56 +01:00
committed by GitHub
parent e639006d42
commit b4f8393f42
16 changed files with 3690 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ namespace Content.Server.Connection
[Dependency] private readonly IServerDbManager _db = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly ServerDbEntryManager _serverDbEntry = default!;
public void Initialize()
{
@@ -66,11 +67,13 @@ namespace Content.Server.Connection
var addr = e.IP.Address;
var userId = e.UserId;
var serverId = (await _serverDbEntry.ServerEntity).Id;
if (deny != null)
{
var (reason, msg, banHits) = deny.Value;
var id = await _db.AddConnectionLogAsync(userId, e.UserName, addr, e.UserData.HWId, reason);
var id = await _db.AddConnectionLogAsync(userId, e.UserName, addr, e.UserData.HWId, reason, serverId);
if (banHits is { Count: > 0 })
await _db.AddServerBanHitsAsync(id, banHits);
@@ -78,7 +81,7 @@ namespace Content.Server.Connection
}
else
{
await _db.AddConnectionLogAsync(userId, e.UserName, addr, e.UserData.HWId, null);
await _db.AddConnectionLogAsync(userId, e.UserName, addr, e.UserData.HWId, null, serverId);
if (!ServerPreferencesManager.ShouldStorePrefs(e.AuthType))
return;