mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
Merge a7f66c0fb9 into eea700bfb4
This commit is contained in:
commit
5d4bebf02f
1 changed files with 6 additions and 6 deletions
|
|
@ -73,7 +73,7 @@ internal class CacheManager: IDisposable
|
||||||
if (CS2_SimpleAdmin.Instance.Config.OtherSettings.CheckMultiAccountsByIp)
|
if (CS2_SimpleAdmin.Instance.Config.OtherSettings.CheckMultiAccountsByIp)
|
||||||
{
|
{
|
||||||
// Optimization: Load IP history and build cache in single pass
|
// Optimization: Load IP history and build cache in single pass
|
||||||
var ipHistory = await connection.QueryAsync<(ulong steamid, string? name, uint address, DateTime used_at)>(
|
var ipHistory = await connection.QueryAsync<(ulong steamid, string? name, long address, DateTime used_at)>(
|
||||||
"SELECT steamid, name, address, used_at FROM sa_players_ips ORDER BY steamid, address, used_at DESC");
|
"SELECT steamid, name, address, used_at FROM sa_players_ips ORDER BY steamid, address, used_at DESC");
|
||||||
|
|
||||||
var unknownName = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
var unknownName = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||||
|
|
@ -94,12 +94,12 @@ internal class CacheManager: IDisposable
|
||||||
currentSteamId = record.steamid;
|
currentSteamId = record.steamid;
|
||||||
|
|
||||||
// Only keep the latest timestamp for each IP
|
// Only keep the latest timestamp for each IP
|
||||||
if (!latestIpTimestamps.TryGetValue(record.address, out var existingTimestamp) ||
|
if (!latestIpTimestamps.TryGetValue(((uint)(record.address & 0xFFFFFFFF)), out var existingTimestamp) ||
|
||||||
record.used_at > existingTimestamp)
|
record.used_at > existingTimestamp)
|
||||||
{
|
{
|
||||||
latestIpTimestamps[record.address] = record.used_at;
|
latestIpTimestamps[((uint)(record.address & 0xFFFFFFFF))] = record.used_at;
|
||||||
currentIpSet.Add(new IpRecord(
|
currentIpSet.Add(new IpRecord(
|
||||||
record.address,
|
((uint)(record.address & 0xFFFFFFFF)),
|
||||||
record.used_at,
|
record.used_at,
|
||||||
string.IsNullOrEmpty(record.name) ? unknownName : record.name
|
string.IsNullOrEmpty(record.name) ? unknownName : record.name
|
||||||
));
|
));
|
||||||
|
|
@ -283,7 +283,7 @@ internal class CacheManager: IDisposable
|
||||||
|
|
||||||
if (CS2_SimpleAdmin.Instance.Config.OtherSettings.CheckMultiAccountsByIp)
|
if (CS2_SimpleAdmin.Instance.Config.OtherSettings.CheckMultiAccountsByIp)
|
||||||
{
|
{
|
||||||
var ipHistory = (await connection.QueryAsync<(ulong steamid, string? name, uint address, DateTime used_at)>(
|
var ipHistory = (await connection.QueryAsync<(ulong steamid, string? name, long address, DateTime used_at)>(
|
||||||
"SELECT steamid, name, address, used_at FROM sa_players_ips WHERE used_at >= @lastUpdate ORDER BY used_at DESC LIMIT 300",
|
"SELECT steamid, name, address, used_at FROM sa_players_ips WHERE used_at >= @lastUpdate ORDER BY used_at DESC LIMIT 300",
|
||||||
new { lastUpdate = _lastUpdateTime }));
|
new { lastUpdate = _lastUpdateTime }));
|
||||||
|
|
||||||
|
|
@ -291,7 +291,7 @@ internal class CacheManager: IDisposable
|
||||||
{
|
{
|
||||||
var ipSet = new HashSet<IpRecord>(
|
var ipSet = new HashSet<IpRecord>(
|
||||||
group
|
group
|
||||||
.GroupBy(x => x.address)
|
.GroupBy(x => (uint)(x.address & 0xFFFFFFFF))
|
||||||
.Select(g =>
|
.Select(g =>
|
||||||
{
|
{
|
||||||
var latest = g.MaxBy(x => x.used_at);
|
var latest = g.MaxBy(x => x.used_at);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue