mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-11 23:58:08 -05:00
ban/unban buttons added to profile
several css tweaks changed administratorIPs to PrivilegedClients added time step references to profile page
This commit is contained in:
@ -2,11 +2,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Interfaces;
|
||||
using System;
|
||||
using SharedLibrary.Database.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
@ -14,19 +11,36 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
protected ApplicationManager Manager;
|
||||
protected bool Authorized { get; private set; }
|
||||
protected EFClient User { get; private set; }
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
Manager = IW4MAdmin.Program.ServerManager;
|
||||
Authorized = context.HttpContext.Connection.RemoteIpAddress.ToString() == "127.0.0.1" ||
|
||||
Manager.AdministratorIPs.Contains(context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP());
|
||||
|
||||
User = new EFClient()
|
||||
{
|
||||
ClientId = -1
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
User.ClientId = Manager.PrivilegedClients[context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()];
|
||||
}
|
||||
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Authorized = context.HttpContext.Connection.RemoteIpAddress.ToString() == "127.0.0.1" ||
|
||||
User.ClientId >= 0;
|
||||
ViewBag.Authorized = Authorized;
|
||||
ViewBag.Url = Startup.Configuration["Web:Address"];
|
||||
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
|
||||
if (inviteLink != null)
|
||||
ViewBag.DiscordLink = inviteLink.Contains("https") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
|
||||
else
|
||||
ViewBag.DiscorLink = "";
|
||||
ViewBag.DiscordLink = "";
|
||||
base.OnActionExecuting(context);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user