- Fixed ban checking
- Small changes
- Updated css
This commit is contained in:
Dawid Bepierszcz
2024-03-09 12:06:50 +01:00
parent 2ab2f9c4dc
commit 525905194c
10 changed files with 62 additions and 45 deletions

View File

@@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging;
namespace CS2_SimpleAdmin;
internal class BanManager
{
private readonly Database _database;
@@ -188,14 +189,14 @@ internal class BanManager
*/
string sql = @"
UPDATE sa_bans
SET
UPDATE sa_bans
SET
status = 'EXPIRED'
WHERE
status = 'ACTIVE'
AND
`duration` > 0
AND
WHERE
status = 'ACTIVE'
AND
`duration` > 0
AND
ends <= @currentTime";
await connection.ExecuteAsync(sql, new { currentTime });
@@ -205,21 +206,20 @@ internal class BanManager
DateTime ipBansTime = currentTime.AddDays(-_config.ExpireOldIpBans).ToLocalTime();
sql = @"
UPDATE sa_bans
SET
UPDATE sa_bans
SET
player_ip = NULL
WHERE
status = 'ACTIVE'
AND
WHERE
status = 'ACTIVE'
AND
ends <= @ipBansTime";
await connection.ExecuteAsync(sql, new { ipBansTime });
}
}
catch (Exception)
{
CS2_SimpleAdmin._logger?.LogCritical("Unable to remove expired bans");
}
}
}
}