Compare commits
5 Commits
2023.09.02
...
develop
Author | SHA1 | Date | |
---|---|---|---|
e6d159fc03 | |||
f3adb75d55 | |||
d7c24dc98f | |||
005a8b050d | |||
13d4ec3033 |
31
Application/Commands/ClearAllReportsCommand.cs
Normal file
31
Application/Commands/ClearAllReportsCommand.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Threading.Tasks;
|
||||
using Data.Models.Client;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace IW4MAdmin.Application.Commands;
|
||||
|
||||
public class ClearAllReportsCommand : Command
|
||||
{
|
||||
public ClearAllReportsCommand(CommandConfiguration config, ITranslationLookup layout) : base(config, layout)
|
||||
{
|
||||
Name = "clearallreports";
|
||||
Description = _translationLookup["COMMANDS_REPORTS_CLEAR_DESC"];
|
||||
Alias = "car";
|
||||
Permission = EFClient.Permission.Administrator;
|
||||
RequiresTarget = false;
|
||||
}
|
||||
|
||||
public override Task ExecuteAsync(GameEvent gameEvent)
|
||||
{
|
||||
foreach (var server in gameEvent.Owner.Manager.GetServers())
|
||||
{
|
||||
server.Reports.Clear();
|
||||
}
|
||||
|
||||
gameEvent.Origin.Tell(_translationLookup["COMMANDS_REPORTS_CLEAR_SUCCESS"]);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -8,9 +8,11 @@ using Data.Abstractions;
|
||||
using Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using WebfrontCore.Permissions;
|
||||
using WebfrontCore.QueryHelpers.Models;
|
||||
using EFClient = Data.Models.Client.EFClient;
|
||||
|
||||
@ -18,6 +20,7 @@ namespace IW4MAdmin.Application.QueryHelpers;
|
||||
|
||||
public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse>
|
||||
{
|
||||
public ApplicationConfiguration _appConfig { get; }
|
||||
private readonly IDatabaseContextFactory _contextFactory;
|
||||
private readonly IGeoLocationService _geoLocationService;
|
||||
|
||||
@ -27,8 +30,10 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
public EFAlias Alias { get; set; }
|
||||
}
|
||||
|
||||
public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService)
|
||||
public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService,
|
||||
ApplicationConfiguration appConfig)
|
||||
{
|
||||
_appConfig = appConfig;
|
||||
_contextFactory = contextFactory;
|
||||
_geoLocationService = geoLocationService;
|
||||
}
|
||||
@ -75,7 +80,9 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.ClientIp))
|
||||
{
|
||||
clientAliases = SearchByIp(query, clientAliases);
|
||||
clientAliases = SearchByIp(query, clientAliases,
|
||||
_appConfig.HasPermission(query.RequesterPermission, WebfrontEntity.ClientIPAddress,
|
||||
WebfrontPermission.Read));
|
||||
}
|
||||
|
||||
var iqGroupedClientAliases = clientAliases.GroupBy(a => new { a.Client.ClientId, a.Client.LastConnection });
|
||||
@ -203,7 +210,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
}
|
||||
|
||||
private static IQueryable<ClientAlias> SearchByIp(ClientResourceRequest query,
|
||||
IQueryable<ClientAlias> clientAliases)
|
||||
IQueryable<ClientAlias> clientAliases, bool canSearchIP)
|
||||
{
|
||||
var ipString = query.ClientIp.Trim();
|
||||
var ipAddress = ipString.ConvertToIP();
|
||||
@ -213,7 +220,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
|
||||
clientAliases = clientAliases.Where(clientAlias =>
|
||||
clientAlias.Alias.IPAddress != null && clientAlias.Alias.IPAddress == ipAddress);
|
||||
}
|
||||
else
|
||||
else if(canSearchIP)
|
||||
{
|
||||
clientAliases = clientAliases.Where(clientAlias =>
|
||||
EF.Functions.Like(clientAlias.Alias.SearchableIPAddress, $"{ipString}%"));
|
||||
|
@ -17,7 +17,7 @@
|
||||
SHG1 = 9,
|
||||
CSGO = 10,
|
||||
H1 = 11,
|
||||
LFD2 = 12,
|
||||
L4D2 = 12,
|
||||
}
|
||||
|
||||
public enum ConnectionType
|
||||
|
@ -137,6 +137,8 @@ waitForFrameThread()
|
||||
|
||||
waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount )
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
|
||||
currentIndex = self.currentAnglePosition;
|
||||
wait( 0.05 * afterFrameCount );
|
||||
|
||||
@ -246,4 +248,4 @@ Callback_PlayerDisconnect()
|
||||
{
|
||||
level notify( "disconnected", self );
|
||||
self maps\mp\gametypes\_playerlogic::Callback_PlayerDisconnect();
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,8 @@ waitForFrameThread()
|
||||
|
||||
waitForAdditionalAngles( logString, beforeFrameCount, afterFrameCount )
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
|
||||
currentIndex = self.currentAnglePosition;
|
||||
wait( 0.05 * afterFrameCount );
|
||||
|
||||
@ -260,4 +262,4 @@ Callback_PlayerDisconnect()
|
||||
{
|
||||
level notify( "disconnected", self );
|
||||
self [[maps\mp\gametypes\_globallogic_player::callback_playerdisconnect]]();
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug
|
||||
Plugins\ScriptPlugins\ParserPlutoniumT5.js = Plugins\ScriptPlugins\ParserPlutoniumT5.js
|
||||
Plugins\ScriptPlugins\ServerBanner.js = Plugins\ScriptPlugins\ServerBanner.js
|
||||
Plugins\ScriptPlugins\ParserBOIII.js = Plugins\ScriptPlugins\ParserBOIII.js
|
||||
Plugins\ScriptPlugins\ParserLFD2SM.js = Plugins\ScriptPlugins\ParserLFD2SM.js
|
||||
Plugins\ScriptPlugins\ParserL4D2SM.js = Plugins\ScriptPlugins\ParserL4D2SM.js
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}"
|
||||
|
@ -4,7 +4,7 @@ let eventParser;
|
||||
const plugin = {
|
||||
author: 'RaidMax',
|
||||
version: 0.1,
|
||||
name: 'LFD2 (SourceMod) Parser',
|
||||
name: 'L4D2 (SourceMod) Parser',
|
||||
engine: 'Source',
|
||||
isParser: true,
|
||||
|
||||
@ -120,10 +120,10 @@ const plugin = {
|
||||
|
||||
eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:';
|
||||
|
||||
rconParser.Version = 'LFD2SM';
|
||||
rconParser.GameName = 10; // LFD2
|
||||
eventParser.Version = 'LFD2SM';
|
||||
eventParser.GameName = 10; // LFD2
|
||||
rconParser.Version = 'L4D2SM';
|
||||
rconParser.GameName = 12; // L4D2
|
||||
eventParser.Version = 'L4D2SM';
|
||||
eventParser.GameName = 12; // L4D2
|
||||
eventParser.URLProtocolFormat = 'steam://connect/{{ip}}:{{port}}';
|
||||
},
|
||||
|
@ -36,7 +36,7 @@ namespace SharedLibraryCore
|
||||
SHG1 = 9,
|
||||
CSGO = 10,
|
||||
H1 = 11,
|
||||
LFD2 = 12
|
||||
L4D2 = 12
|
||||
}
|
||||
|
||||
// only here for performance
|
||||
|
@ -249,7 +249,8 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
ViewBag.Title = Localization["WEBFRONT_SEARCH_RESULTS_TITLE"];
|
||||
ViewBag.ClientResourceRequest = request;
|
||||
|
||||
|
||||
request.RequesterPermission = Client.Level;
|
||||
var response = await _clientResourceHelper.QueryResource(request);
|
||||
return request.Offset > 0
|
||||
? PartialView("Find/_AdvancedFindList", response.Results)
|
||||
|
@ -16,7 +16,9 @@ public class ClientResourceRequest : ClientPaginationRequest
|
||||
public EFClient.Permission? ClientLevel { get; set; }
|
||||
public Reference.Game? GameName { get; set; }
|
||||
public bool IncludeGeolocationData { get; set; } = true;
|
||||
|
||||
|
||||
public EFClient.Permission RequesterPermission { get; set; } = EFClient.Permission.User;
|
||||
|
||||
public bool HasData => !string.IsNullOrEmpty(ClientName) || !string.IsNullOrEmpty(ClientIp) ||
|
||||
!string.IsNullOrEmpty(ClientGuid) || ClientLevel is not null || GameName is not null;
|
||||
!string.IsNullOrEmpty(ClientGuid) || ClientLevel is not null || GameName is not null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user