mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
move all the deployment setup into 2.4 pr (#85)
* don't run build commands in release
* fix test file
* Set up CI with Azure Pipelines
[skip ci]
* Include fonts and fix automessage hidden command
* more project changes
* migration from bower to libman
* more lib man changes
* project update for sneaky commands
* add missing canvas.js dep
update projects not to have stupid extra dlls
include in previous
* update pipeline file
* update post publish script and pipeline definition
* fix broken yaml
* move encoding conversion to seperate script
* remove extra uneeded rank icons
remove garbage language files being created
remove frontend lib when done
* fix publish script path
* grab localizations through powershell
* fix broken batch 🤷
* actually fixed
* only include runtime compilation in debug mode for webfront
* don't deploy un minified css
use full jquery version
* add step to download the scss for open iconic
change the font path
* update mkdir for iconic path
* don't include old iconic css
* correct font path for real now
* copy script plugins
* lots of changes for deployment
* build the projects
* use projectdir instead of solution dir
* nerf script commands plugin
fix live radar left over command
* actually kill script command post build
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* fix the font file copy (I think)
* maybe fix delete folder issue
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
* Update azure-pipelines.yml for Azure Pipelines
This commit is contained in:
@ -1,12 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Events;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebfrontCore.Controllers.API
|
||||
{
|
||||
public class ApiController : BaseController
|
||||
{
|
||||
public ApiController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
public IActionResult Index()
|
||||
{
|
||||
return Ok($"IW4MAdmin API");
|
||||
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
@ -11,6 +12,10 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class AccountController : BaseController
|
||||
{
|
||||
public AccountController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> LoginAsync(int clientId, string password)
|
||||
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using WebfrontCore.ViewModels;
|
||||
using static SharedLibraryCore.Database.Models.EFClient;
|
||||
|
||||
@ -12,6 +13,11 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ActionController : BaseController
|
||||
{
|
||||
public ActionController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IActionResult BanForm()
|
||||
{
|
||||
var info = new ActionInfo()
|
||||
|
@ -1,145 +0,0 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using WebfrontCore.ViewModels;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class BaseController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// life span in months
|
||||
/// </summary>
|
||||
private const int COOKIE_LIFESPAN = 3;
|
||||
|
||||
protected IManager Manager;
|
||||
protected readonly DatabaseContext Context;
|
||||
protected bool Authorized { get; set; }
|
||||
protected SharedLibraryCore.Localization.Index Localization { get; private set; }
|
||||
protected EFClient Client { get; private set; }
|
||||
private static readonly byte[] LocalHost = { 127, 0, 0, 1 };
|
||||
private static string SocialLink;
|
||||
private static string SocialTitle;
|
||||
protected List<Page> Pages;
|
||||
|
||||
public BaseController()
|
||||
{
|
||||
if (Manager == null)
|
||||
{
|
||||
Manager = Program.Manager;
|
||||
}
|
||||
|
||||
if (Localization == null)
|
||||
{
|
||||
Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||
}
|
||||
|
||||
if (Manager.GetApplicationSettings().Configuration().EnableSocialLink && SocialLink == null)
|
||||
{
|
||||
SocialLink = Manager.GetApplicationSettings().Configuration().SocialLinkAddress;
|
||||
SocialTitle = Manager.GetApplicationSettings().Configuration().SocialLinkTitle;
|
||||
}
|
||||
|
||||
Pages = Manager.GetPageList().Pages
|
||||
.Select(page => new Page
|
||||
{
|
||||
Name = page.Key,
|
||||
Location = page.Value
|
||||
}).ToList();
|
||||
|
||||
ViewBag.Version = Manager.Version;
|
||||
ViewBag.IsFluid = false;
|
||||
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
||||
}
|
||||
|
||||
protected async Task SignInAsync(ClaimsPrincipal claimsPrinciple)
|
||||
{
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
|
||||
{
|
||||
AllowRefresh = true,
|
||||
ExpiresUtc = DateTime.UtcNow.AddMonths(COOKIE_LIFESPAN),
|
||||
IsPersistent = true,
|
||||
IssuedUtc = DateTime.UtcNow
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
Client = Client ?? new EFClient()
|
||||
{
|
||||
ClientId = -1,
|
||||
Level = EFClient.Permission.User,
|
||||
CurrentAlias = new EFAlias() { Name = "Webfront Guest" }
|
||||
};
|
||||
|
||||
if (!HttpContext.Connection.RemoteIpAddress.GetAddressBytes().SequenceEqual(LocalHost))
|
||||
{
|
||||
try
|
||||
{
|
||||
int clientId = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid)?.Value ?? "-1");
|
||||
|
||||
if (clientId > 0)
|
||||
{
|
||||
Client.ClientId = clientId;
|
||||
Client.NetworkId = clientId == 1 ? 0 : User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertGuidToLong();
|
||||
Client.Level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), User.Claims.First(c => c.Type == ClaimTypes.Role).Value);
|
||||
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
||||
Authorized = Client.ClientId >= 0;
|
||||
}
|
||||
}
|
||||
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
// force the "banned" client to be signed out
|
||||
HttpContext.SignOutAsync().Wait(5000);
|
||||
}
|
||||
}
|
||||
|
||||
// give the local host full access
|
||||
else
|
||||
{
|
||||
Client.ClientId = 1;
|
||||
Client.Level = EFClient.Permission.Console;
|
||||
Client.CurrentAlias = new EFAlias() { Name = "IW4MAdmin" };
|
||||
Authorized = true;
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, Client.CurrentAlias.Name),
|
||||
new Claim(ClaimTypes.Role, Client.Level.ToString()),
|
||||
new Claim(ClaimTypes.Sid, Client.ClientId.ToString()),
|
||||
new Claim(ClaimTypes.PrimarySid, Client.NetworkId.ToString("X"))
|
||||
};
|
||||
var claimsIdentity = new ClaimsIdentity(claims, "login");
|
||||
SignInAsync(new ClaimsPrincipal(claimsIdentity)).Wait();
|
||||
}
|
||||
|
||||
ViewBag.Authorized = Authorized;
|
||||
ViewBag.Url = Manager.GetApplicationSettings().Configuration().WebfrontUrl;
|
||||
ViewBag.User = Client;
|
||||
ViewBag.SocialLink = SocialLink ?? "";
|
||||
ViewBag.SocialTitle = SocialTitle;
|
||||
ViewBag.Pages = Pages;
|
||||
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||
ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
|
||||
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
||||
|
||||
base.OnActionExecuting(context);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using SharedLibraryCore.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,6 +15,11 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ClientController : BaseController
|
||||
{
|
||||
public ClientController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<IActionResult> ProfileAsync(int id)
|
||||
{
|
||||
var client = await Manager.GetClientService().Get(id);
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebfrontCore.ViewModels;
|
||||
@ -10,6 +12,11 @@ namespace WebfrontCore.Controllers
|
||||
[Authorize]
|
||||
public class ConfigurationController : BaseController
|
||||
{
|
||||
public ConfigurationController(IManager manager) : base (manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IActionResult Edit()
|
||||
{
|
||||
if (Client.Level < SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||
|
@ -2,6 +2,7 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -10,6 +11,11 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ConsoleController : BaseController
|
||||
{
|
||||
public ConsoleController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
var activeServers = Manager.GetServers().Select(s => new ServerInfo()
|
||||
|
@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -12,6 +14,11 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
private static readonly IDictionary<string, string> _fileCache = new Dictionary<string, string>();
|
||||
|
||||
public DynamicFileController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Route("css/{fileName}")]
|
||||
public async Task<IActionResult> Css(string fileName)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -8,6 +10,11 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class HomeController : BaseController
|
||||
{
|
||||
public HomeController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
ViewBag.Description = "IW4MAdmin is a complete server administration tool for IW4x.";
|
||||
|
@ -2,20 +2,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Services;
|
||||
using System;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebfrontCore.ViewComponents;
|
||||
using static SharedLibraryCore.Database.Models.EFPenalty;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class PenaltyController : BaseController
|
||||
{
|
||||
public PenaltyController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IActionResult List(PenaltyType showOnly = PenaltyType.Any)
|
||||
{
|
||||
ViewBag.Description = "List of all the recent penalties (bans, kicks, warnings) on IW4MAdmin";
|
||||
|
@ -1,12 +1,18 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ServerController : BaseController
|
||||
{
|
||||
public ServerController(IManager manager) : base(manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ResponseCache(NoStore = true, Duration = 0)]
|
||||
public IActionResult ClientActivity(long id)
|
||||
|
Reference in New Issue
Block a user