Compare commits

..

No commits in common. "release/pre" and "2023.09.02.2-prerelease" have entirely different histories.

9 changed files with 16 additions and 26 deletions

View File

@ -8,11 +8,9 @@ using Data.Abstractions;
using Data.Models; using Data.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Helpers; using SharedLibraryCore.Helpers;
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
using WebfrontCore.Permissions;
using WebfrontCore.QueryHelpers.Models; using WebfrontCore.QueryHelpers.Models;
using EFClient = Data.Models.Client.EFClient; using EFClient = Data.Models.Client.EFClient;
@ -20,7 +18,6 @@ namespace IW4MAdmin.Application.QueryHelpers;
public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse> public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse>
{ {
public ApplicationConfiguration _appConfig { get; }
private readonly IDatabaseContextFactory _contextFactory; private readonly IDatabaseContextFactory _contextFactory;
private readonly IGeoLocationService _geoLocationService; private readonly IGeoLocationService _geoLocationService;
@ -30,10 +27,8 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
public EFAlias Alias { get; set; } public EFAlias Alias { get; set; }
} }
public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService, public ClientResourceQueryHelper(IDatabaseContextFactory contextFactory, IGeoLocationService geoLocationService)
ApplicationConfiguration appConfig)
{ {
_appConfig = appConfig;
_contextFactory = contextFactory; _contextFactory = contextFactory;
_geoLocationService = geoLocationService; _geoLocationService = geoLocationService;
} }
@ -80,9 +75,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
if (!string.IsNullOrWhiteSpace(query.ClientIp)) 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 }); var iqGroupedClientAliases = clientAliases.GroupBy(a => new { a.Client.ClientId, a.Client.LastConnection });
@ -210,7 +203,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
} }
private static IQueryable<ClientAlias> SearchByIp(ClientResourceRequest query, private static IQueryable<ClientAlias> SearchByIp(ClientResourceRequest query,
IQueryable<ClientAlias> clientAliases, bool canSearchIP) IQueryable<ClientAlias> clientAliases)
{ {
var ipString = query.ClientIp.Trim(); var ipString = query.ClientIp.Trim();
var ipAddress = ipString.ConvertToIP(); var ipAddress = ipString.ConvertToIP();
@ -220,7 +213,7 @@ public class ClientResourceQueryHelper : IResourceQueryHelper<ClientResourceRequ
clientAliases = clientAliases.Where(clientAlias => clientAliases = clientAliases.Where(clientAlias =>
clientAlias.Alias.IPAddress != null && clientAlias.Alias.IPAddress == ipAddress); clientAlias.Alias.IPAddress != null && clientAlias.Alias.IPAddress == ipAddress);
} }
else if(canSearchIP) else
{ {
clientAliases = clientAliases.Where(clientAlias => clientAliases = clientAliases.Where(clientAlias =>
EF.Functions.Like(clientAlias.Alias.SearchableIPAddress, $"{ipString}%")); EF.Functions.Like(clientAlias.Alias.SearchableIPAddress, $"{ipString}%"));

View File

@ -17,7 +17,7 @@
SHG1 = 9, SHG1 = 9,
CSGO = 10, CSGO = 10,
H1 = 11, H1 = 11,
L4D2 = 12, LFD2 = 12,
} }
public enum ConnectionType public enum ConnectionType

View File

@ -53,7 +53,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug
Plugins\ScriptPlugins\ParserPlutoniumT5.js = Plugins\ScriptPlugins\ParserPlutoniumT5.js Plugins\ScriptPlugins\ParserPlutoniumT5.js = Plugins\ScriptPlugins\ParserPlutoniumT5.js
Plugins\ScriptPlugins\ServerBanner.js = Plugins\ScriptPlugins\ServerBanner.js Plugins\ScriptPlugins\ServerBanner.js = Plugins\ScriptPlugins\ServerBanner.js
Plugins\ScriptPlugins\ParserBOIII.js = Plugins\ScriptPlugins\ParserBOIII.js Plugins\ScriptPlugins\ParserBOIII.js = Plugins\ScriptPlugins\ParserBOIII.js
Plugins\ScriptPlugins\ParserL4D2SM.js = Plugins\ScriptPlugins\ParserL4D2SM.js Plugins\ScriptPlugins\ParserLFD2SM.js = Plugins\ScriptPlugins\ParserLFD2SM.js
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}"

View File

@ -4,7 +4,7 @@ let eventParser;
const plugin = { const plugin = {
author: 'RaidMax', author: 'RaidMax',
version: 0.1, version: 0.1,
name: 'L4D2 (SourceMod) Parser', name: 'LFD2 (SourceMod) Parser',
engine: 'Source', engine: 'Source',
isParser: true, 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:'; eventParser.Configuration.Time.Pattern = '^L [01]\\d/[0-3]\\d/\\d+ - [0-2]\\d:[0-5]\\d:[0-5]\\d:';
rconParser.Version = 'L4D2SM'; rconParser.Version = 'LFD2SM';
rconParser.GameName = 12; // L4D2 rconParser.GameName = 10; // LFD2
eventParser.Version = 'L4D2SM'; eventParser.Version = 'LFD2SM';
eventParser.GameName = 12; // L4D2 eventParser.GameName = 10; // LFD2
eventParser.URLProtocolFormat = 'steam://connect/{{ip}}:{{port}}'; eventParser.URLProtocolFormat = 'steam://connect/{{ip}}:{{port}}';
}, },

View File

@ -56,4 +56,4 @@ Feel free to join the **IW4MAdmin** [Discord](https://discord.gg/ZZFK5p3)
If you come across an issue, bug, or feature request please post an [issue](https://github.com/RaidMax/IW4M-Admin/issues) If you come across an issue, bug, or feature request please post an [issue](https://github.com/RaidMax/IW4M-Admin/issues)
#### Explore the [wiki](https://git.rimmyscorner.com/Parasyn/IW4M-Admin/wiki) to find more information. #### Explore the [wiki](https://github.com/RaidMax/IW4M-Admin/wiki) to find more information.

View File

@ -36,7 +36,7 @@ namespace SharedLibraryCore
SHG1 = 9, SHG1 = 9,
CSGO = 10, CSGO = 10,
H1 = 11, H1 = 11,
L4D2 = 12 LFD2 = 12
} }
// only here for performance // only here for performance

View File

@ -250,7 +250,6 @@ namespace WebfrontCore.Controllers
ViewBag.Title = Localization["WEBFRONT_SEARCH_RESULTS_TITLE"]; ViewBag.Title = Localization["WEBFRONT_SEARCH_RESULTS_TITLE"];
ViewBag.ClientResourceRequest = request; ViewBag.ClientResourceRequest = request;
request.RequesterPermission = Client.Level;
var response = await _clientResourceHelper.QueryResource(request); var response = await _clientResourceHelper.QueryResource(request);
return request.Offset > 0 return request.Offset > 0
? PartialView("Find/_AdvancedFindList", response.Results) ? PartialView("Find/_AdvancedFindList", response.Results)

View File

@ -17,8 +17,6 @@ public class ClientResourceRequest : ClientPaginationRequest
public Reference.Game? GameName { get; set; } public Reference.Game? GameName { get; set; }
public bool IncludeGeolocationData { get; set; } = true; public bool IncludeGeolocationData { get; set; } = true;
public EFClient.Permission RequesterPermission { get; set; } = EFClient.Permission.User;
public bool HasData => !string.IsNullOrEmpty(ClientName) || !string.IsNullOrEmpty(ClientIp) || 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;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB