88f31bc78c
prevent control characters from being used in name added MOD_HEAD_SHOT to hit location increment css fix for alias dropdown testing view angle analysis
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using IW4MAdmin;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
using SharedLibrary;
|
|
using SharedLibrary.Interfaces;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WebfrontCore.Controllers
|
|
{
|
|
public class BaseController : Controller
|
|
{
|
|
protected ApplicationManager Manager;
|
|
protected bool Authorized { 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());
|
|
ViewBag.Authorized = Authorized;
|
|
ViewBag.Url = Startup.Configuration["Web:Address"];
|
|
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
|
|
ViewBag.DiscordLink = inviteLink != null && inviteLink.Contains("http") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
|
|
base.OnActionExecuting(context);
|
|
}
|
|
}
|
|
}
|