1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

re-enable login to webfront with password

update cookie to last 3 months
add configuration option to limit # of rss feed items
prevent database tracking of bots if ignore bots requested
add last map and last server played to profile
This commit is contained in:
RaidMax
2019-02-22 19:06:51 -06:00
parent 5755775b85
commit 88c013be20
15 changed files with 864 additions and 27 deletions

View File

@ -7,6 +7,7 @@ using SharedLibraryCore.Commands;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Events;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Helpers;
@ -58,6 +59,7 @@ namespace IW4MAdmin.Application
readonly SemaphoreSlim ProcessingEvent = new SemaphoreSlim(1, 1);
readonly Dictionary<long, ILogger> Loggers = new Dictionary<long, ILogger>();
readonly ITokenAuthentication _authenticator;
private readonly MetaService _metaService;
private ApplicationManager()
{
@ -77,6 +79,7 @@ namespace IW4MAdmin.Application
OnServerEvent += OnGameEvent;
OnServerEvent += EventApi.OnGameEvent;
_authenticator = new TokenAuthentication();
_metaService = new MetaService();
}
private async void OnGameEvent(object sender, GameEventArgs args)
@ -384,6 +387,45 @@ namespace IW4MAdmin.Application
}
#endregion
#region META
async Task<List<ProfileMeta>> getLastMap(int clientId)
{
var meta = await _metaService.GetPersistentMeta("LastMapPlayed", new EFClient() { ClientId = clientId });
return meta == null ? new List<ProfileMeta>() : new List<ProfileMeta>()
{
new ProfileMeta()
{
Id = meta.MetaId,
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_LAST_MAP"],
Value = meta.Value,
Show = true
}
};
}
async Task<List<ProfileMeta>> getLastServer(int clientId)
{
var meta = await _metaService.GetPersistentMeta("LastServerPlayed", new EFClient() { ClientId = clientId });
return meta == null ? new List<ProfileMeta>() : new List<ProfileMeta>()
{
new ProfileMeta()
{
Id = meta.MetaId,
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_LAST_SERVER"],
Value = meta.Value,
Show = true
}
};
}
MetaService.AddRuntimeMeta(getLastMap);
MetaService.AddRuntimeMeta(getLastServer);
#endregion
#region INIT
async Task Init(ServerConfiguration Conf)
{