abstracting rcon parsing and event parsing
changed Event to GameEvent finally fixed the stats NaN check ip for bans consolidated console, profile, and logout into dropdown make sure game is iw4 before using :^ in say fix pm not showing from name if in web console show time left of temban on profile
This commit is contained in:
@ -29,8 +29,6 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
if (HttpContext.Connection.RemoteIpAddress.ToString() != "127.0.0.1")
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
User.ClientId = Convert.ToInt32(base.User.Claims.First(c => c.Type == ClaimTypes.Sid).Value);
|
||||
|
@ -34,10 +34,16 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
ClientId = User.ClientId,
|
||||
Level = User.Level,
|
||||
CurrentServer = server
|
||||
CurrentServer = server,
|
||||
CurrentAlias = new Alias() { Name = User.Name }
|
||||
};
|
||||
var remoteEvent = new GameEvent()
|
||||
{
|
||||
Type = GameEvent.EventType.Say,
|
||||
Data = command,
|
||||
Origin = client,
|
||||
Owner = server
|
||||
};
|
||||
|
||||
var remoteEvent = new Event(Event.GType.Say, command, client, null, server);
|
||||
|
||||
await server.ExecuteEvent(remoteEvent);
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebfrontCore.ViewComponents
|
||||
@ -12,22 +13,6 @@ namespace WebfrontCore.ViewComponents
|
||||
{
|
||||
public async Task<IViewComponentResult> InvokeAsync(int offset)
|
||||
{
|
||||
int ip = HttpContext.Connection.RemoteIpAddress
|
||||
.ToString().ConvertToIP();
|
||||
|
||||
bool authed = false;
|
||||
|
||||
try
|
||||
{
|
||||
// var a = IW4MAdmin.ApplicationManager.GetInstance()
|
||||
//.PrivilegedClients[HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()];
|
||||
}
|
||||
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(15, offset);
|
||||
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
||||
{
|
||||
@ -40,10 +25,11 @@ namespace WebfrontCore.ViewComponents
|
||||
Type = p.Type.ToString(),
|
||||
TimePunished = Utilities.GetTimePassed(p.When, false),
|
||||
TimeRemaining = DateTime.UtcNow > p.Expires ? "" : Utilities.TimeSpanText(p.Expires - DateTime.UtcNow),
|
||||
Sensitive = p.Type == SharedLibraryCore.Objects.Penalty.PenaltyType.Flag
|
||||
Sensitive = p.Type == Penalty.PenaltyType.Flag
|
||||
});
|
||||
|
||||
penaltiesDto = authed ? penaltiesDto.ToList() : penaltiesDto.Where(p => !p.Sensitive).ToList();
|
||||
bool authorized = User.Identity.IsAuthenticated;
|
||||
penaltiesDto = authorized ? penaltiesDto.ToList() : penaltiesDto.Where(p => !p.Sensitive).ToList();
|
||||
|
||||
return View("_List", penaltiesDto);
|
||||
}
|
||||
|
@ -33,15 +33,36 @@
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Penalties", "List", "Penalty", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Admins", "PrivilegedAsync", "Client", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Console", "Index", "Console", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li class="nav-item text-center text-md-left"></li>
|
||||
@if (!string.IsNullOrEmpty(ViewBag.DiscordLink))
|
||||
{
|
||||
<li class="nav-item text-center text-md-left"><a href="@ViewBag.DiscordLink" class="nav-link" target="_blank">Discord</a></li>
|
||||
}
|
||||
@if (ViewBag.Authorized)
|
||||
{
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("Logout", "LogoutAsync", "Account", new { area = "" }, new { @class = "nav-link" })</li>
|
||||
<li class="nav-item text-center text-md-left">@Html.ActionLink("", "ProfileAsync", "Client", new { id = ViewBag.User.ClientId }, new { @class = "nav-link oi oi-person oi-fix-navbar w-100", title = "Client Profile" })</li>
|
||||
<li class="nav-link dropdown text-center text-md-left p-0">
|
||||
<a href="#" class="nav-link oi oi-person dropdown-toggle oi-fix-navbar w-100" id="account_dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
|
||||
|
||||
<div class="dropdown-menu p-0" aria-labelledby="account_dropdown">
|
||||
@Html.ActionLink("Console", "Index", "Console", new { area = "" }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-md-left",
|
||||
title = "Web Console"
|
||||
})
|
||||
@Html.ActionLink("Profile", "ProfileAsync", "Client", new { id = ViewBag.User.ClientId }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-md-left",
|
||||
title = "Client Profile",
|
||||
})
|
||||
@Html.ActionLink("Logout", "LogoutAsync", "Account", new { area = "" }, new
|
||||
{
|
||||
@class = "dropdown-item bg-dark text-muted text-center text-md-left",
|
||||
title = "Logout of account"
|
||||
})
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item text-center text-md-left"></li>
|
||||
<li class="nav-item text-center text-md-left"></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -57,7 +78,7 @@
|
||||
</nav>
|
||||
</header>
|
||||
<!-- loading icon -->
|
||||
<div class="oi oi-loop-circular layout-loading-icon"></div>
|
||||
<div class="oi oi-loop-circular layout-loading-icon"></div>
|
||||
|
||||
<!-- Main Modal -->
|
||||
<div class="modal fade" id="mainModal" tabindex="-1" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
|
||||
|
@ -134,4 +134,9 @@ form * {
|
||||
.form-control:focus {
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
border-bottom: 1px solid $secondary;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ function loadMorePenalties() {
|
||||
offset += 15;
|
||||
}
|
||||
|
||||
if ($('#penalty_table').length == 1) {
|
||||
if ($('#penalty_table').length === 1) {
|
||||
/*
|
||||
https://stackoverflow.com/questions/19731730/jquery-js-detect-users-scroll-attempt-without-any-window-overflow-to-scroll
|
||||
*/
|
||||
|
@ -168,7 +168,10 @@ function loadMeta(meta) {
|
||||
// it's a penalty
|
||||
if (meta.class.includes("Penalty")) {
|
||||
if (meta.value.punisherId !== clientInfo.clientId) {
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)}</span> by <span class="text-highlight"> <a class="link-inverse" href="${meta.value.punisherId}">${meta.value.punisherName}</a></span > for <span style="color: white; ">${meta.value.offense}</span></div>`;
|
||||
const timeRemaining = meta.value.type == 'TempBan' && meta.value.timeRemaining.length > 0 ?
|
||||
`(${meta.value.timeRemaining} remaining)` :
|
||||
'';
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)}</span> by <span class="text-highlight"> <a class="link-inverse" href="${meta.value.punisherId}">${meta.value.punisherName}</a></span > for <span style="color: white; ">${meta.value.offense}</span><span class="text-muted"> ${timeRemaining}</span></div>`;
|
||||
}
|
||||
else {
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)} </span> <span class="text-highlight"><a class="link-inverse" href="${meta.value.offenderId}"> ${meta.value.offenderName}</a></span > for <span style="color: white; ">${meta.value.offense}</span></div>`;
|
||||
|
Reference in New Issue
Block a user