mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
persist client count history data across reboots and allow for configurable timespan
This commit is contained in:
@ -141,7 +141,15 @@ namespace SharedLibraryCore.Configuration
|
||||
[LocalizedDisplayName(("WEBFRONT_CONFIGURATION_ENABLE_PRIVILEGED_USER_PRIVACY"))]
|
||||
public bool EnablePrivilegedUserPrivacy { get; set; }
|
||||
|
||||
[ConfigurationIgnore]
|
||||
public bool EnableImplicitAccountLinking { get; set; } = false;
|
||||
|
||||
[ConfigurationIgnore]
|
||||
public TimeSpan MaxClientHistoryTime { get; set; } = TimeSpan.FromHours(12);
|
||||
|
||||
[ConfigurationIgnore]
|
||||
public TimeSpan ServerDataCollectionInterval { get; set; } = TimeSpan.FromMinutes(5);
|
||||
|
||||
public Dictionary<Permission, string> OverridePermissionLevelNames { get; set; } = Enum
|
||||
.GetValues(typeof(Permission))
|
||||
.Cast<Permission>()
|
||||
|
18
SharedLibraryCore/Dtos/ClientHistoryInfo.cs
Normal file
18
SharedLibraryCore/Dtos/ClientHistoryInfo.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
public class ClientHistoryInfo
|
||||
{
|
||||
public long ServerId { get; set; }
|
||||
public List<ClientCountSnapshot> ClientCounts { get; set; }
|
||||
}
|
||||
|
||||
public class ClientCountSnapshot
|
||||
{
|
||||
public DateTime Time { get; set; }
|
||||
public string TimeString => Time.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||
public int ClientCount { get; set; }
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace SharedLibraryCore.Dtos
|
||||
public List<ChatInfo> ChatHistory { get; set; }
|
||||
public List<PlayerInfo> Players { get; set; }
|
||||
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
||||
public List<ClientCountSnapshot> ClientCountHistory { get; set; }
|
||||
public long ID { get; set; }
|
||||
public bool Online { get; set; }
|
||||
public string ConnectProtocolUrl { get; set; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SharedLibraryCore.Dtos;
|
||||
|
||||
namespace SharedLibraryCore.Helpers
|
||||
{
|
||||
@ -31,5 +32,14 @@ namespace SharedLibraryCore.Helpers
|
||||
/// Used by CanvasJS as a point on the y axis
|
||||
/// </summary>
|
||||
public int y { get; }
|
||||
|
||||
public ClientCountSnapshot ToClientCountSnapshot()
|
||||
{
|
||||
return new ClientCountSnapshot
|
||||
{
|
||||
ClientCount = y,
|
||||
Time = When
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Helpers;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
@ -22,8 +25,16 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// Gets the total number of clients connected and total clients connected in the given time frame
|
||||
/// </summary>
|
||||
/// <param name="overPeriod">how far in the past to search</param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="token">CancellationToken</param>
|
||||
/// <returns></returns>
|
||||
Task<(int, int)> ClientCountsAsync(TimeSpan? overPeriod = null, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the client count and history over the given period
|
||||
/// </summary>
|
||||
/// <param name="overPeriod">how far in the past to search</param>
|
||||
/// <param name="token">CancellationToken</param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ClientHistoryInfo>> ClientHistoryAsync(TimeSpan? overPeriod = null, CancellationToken token = default);
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
|
||||
<Version>2021.8.27.1</Version>
|
||||
<Version>2021.8.29.1</Version>
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
@ -19,7 +19,7 @@
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Description>Shared Library for IW4MAdmin</Description>
|
||||
<PackageVersion>2021.8.27.1</PackageVersion>
|
||||
<PackageVersion>2021.8.29.1</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
|
||||
@ -44,7 +44,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.10" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.Data" Version="1.0.5" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.Data" Version="1.0.6" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
Reference in New Issue
Block a user