2018-03-06 02:22:19 -05:00
|
|
|
|
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;
|
2018-03-09 03:01:12 -05:00
|
|
|
|
Authorized = context.HttpContext.Connection.RemoteIpAddress.ToString() == "127.0.0.1" ||
|
|
|
|
|
Manager.AdministratorIPs.Contains(context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP());
|
|
|
|
|
ViewBag.Authorized = Authorized;
|
2018-03-13 17:30:22 -04:00
|
|
|
|
ViewBag.Url = Startup.Configuration["Web:Address"];
|
2018-03-18 22:25:11 -04:00
|
|
|
|
string inviteLink = Manager.GetApplicationSettings().Configuration().DiscordInviteCode;
|
2018-03-26 00:51:25 -04:00
|
|
|
|
if (inviteLink != null)
|
|
|
|
|
ViewBag.DiscordLink = inviteLink.Contains("https") ? inviteLink : $"https://discordapp.com/invite/{inviteLink}";
|
|
|
|
|
else
|
|
|
|
|
ViewBag.DiscorLink = "";
|
2018-03-06 02:22:19 -05:00
|
|
|
|
base.OnActionExecuting(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|