prevent starting if no servers can be connected to
fix nextmap issue on t6 fix bug with kicking client for profane name
This commit is contained in:
parent
b134cd4728
commit
02cad10d77
@ -6,7 +6,7 @@
|
|||||||
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.2.6.2</Version>
|
<Version>2.2.6.4</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<AssemblyVersion>2.2.6.3</AssemblyVersion>
|
<AssemblyVersion>2.2.6.4</AssemblyVersion>
|
||||||
<FileVersion>2.2.6.3</FileVersion>
|
<FileVersion>2.2.6.4</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -573,7 +573,7 @@ namespace IW4MAdmin.Application
|
|||||||
|
|
||||||
await Task.WhenAll(config.Servers.Select(c => Init(c)).ToArray());
|
await Task.WhenAll(config.Servers.Select(c => Init(c)).ToArray());
|
||||||
|
|
||||||
if (failedServers > 0 && successServers > 0)
|
if (successServers - failedServers <= 0)
|
||||||
{
|
{
|
||||||
if (!Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationIndex["MANAGER_START_WITH_ERRORS"]))
|
if (!Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationIndex["MANAGER_START_WITH_ERRORS"]))
|
||||||
{
|
{
|
||||||
|
@ -48,11 +48,7 @@ namespace IW4MAdmin.Plugins.ProfanityDeterment
|
|||||||
|
|
||||||
if (containsObjectionalWord)
|
if (containsObjectionalWord)
|
||||||
{
|
{
|
||||||
E.Origin.Kick(Settings.Configuration().ProfanityKickMessage, new EFClient()
|
E.Origin.Kick(Settings.Configuration().ProfanityKickMessage, Utilities.IW4MAdminClient(E.Owner));
|
||||||
{
|
|
||||||
ClientId = 1,
|
|
||||||
CurrentServer = E.Owner
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,8 +1278,8 @@ namespace SharedLibraryCore.Commands
|
|||||||
public CNextMap() : base("nextmap", Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_DESC"], "nm", EFClient.Permission.User, false) { }
|
public CNextMap() : base("nextmap", Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_DESC"], "nm", EFClient.Permission.User, false) { }
|
||||||
public static async Task<string> GetNextMap(Server s)
|
public static async Task<string> GetNextMap(Server s)
|
||||||
{
|
{
|
||||||
string mapRotation = (await s.GetDvarAsync<string>("sv_mapRotation")).Value.ToLower();
|
string mapRotation = (await s.GetDvarAsync<string>("sv_mapRotation")).Value?.ToLower() ?? "";
|
||||||
var regexMatches = Regex.Matches(mapRotation, @"(gametype +([a-z]{1,4}))? *map ([a-z|_]+)", RegexOptions.IgnoreCase).ToList();
|
var regexMatches = Regex.Matches(mapRotation, @"((?:gametype|exec) +(?:([a-z]{1,4})(?:.cfg)?))? *map ([a-z|_|\d]+)", RegexOptions.IgnoreCase).ToList();
|
||||||
|
|
||||||
// find the current map in the rotation
|
// find the current map in the rotation
|
||||||
var currentMap = regexMatches.Where(m => m.Groups[3].ToString() == s.CurrentMap.Name);
|
var currentMap = regexMatches.Where(m => m.Groups[3].ToString() == s.CurrentMap.Name);
|
||||||
@ -1289,7 +1289,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
// no maprotation at all
|
// no maprotation at all
|
||||||
if (regexMatches.Count() == 0)
|
if (regexMatches.Count() == 0)
|
||||||
{
|
{
|
||||||
return $"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_SUCCESS"].FormatExt(s.CurrentMap.Alias)}/{Utilities.GetLocalizedGametype(s.Gametype)}";
|
return Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_SUCCESS"].FormatExt(s.CurrentMap.Alias, Utilities.GetLocalizedGametype(s.Gametype));
|
||||||
}
|
}
|
||||||
|
|
||||||
// the current map is not in rotation
|
// the current map is not in rotation
|
||||||
@ -1318,12 +1318,14 @@ namespace SharedLibraryCore.Commands
|
|||||||
regexMatches[regexMatches.IndexOf(currentMap.First()) + 1] :
|
regexMatches[regexMatches.IndexOf(currentMap.First()) + 1] :
|
||||||
regexMatches.First();
|
regexMatches.First();
|
||||||
|
|
||||||
nextMap = s.Maps.FirstOrDefault(m => m.Name == nextMapMatch.Groups[3].ToString()) ?? nextMap;
|
string nextMapName = nextMapMatch.Groups[3].ToString();
|
||||||
|
|
||||||
|
nextMap = s.Maps.FirstOrDefault(m => m.Name == nextMapMatch.Groups[3].ToString()) ?? new Map() { Alias = nextMapName, Name = nextMapName };
|
||||||
string nextGametype = nextMapMatch.Groups[2].ToString().Length == 0 ?
|
string nextGametype = nextMapMatch.Groups[2].ToString().Length == 0 ?
|
||||||
Utilities.GetLocalizedGametype(s.Gametype) :
|
Utilities.GetLocalizedGametype(s.Gametype) :
|
||||||
Utilities.GetLocalizedGametype(nextMapMatch.Groups[2].ToString());
|
Utilities.GetLocalizedGametype(nextMapMatch.Groups[2].ToString());
|
||||||
|
|
||||||
return $"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_SUCCESS"]} ^5{nextMap.Alias}/{nextGametype}";
|
return Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_NEXTMAP_SUCCESS"].FormatExt(nextMap.Alias, nextGametype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
|
@ -412,6 +412,16 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (Level == newPermission)
|
||||||
|
{
|
||||||
|
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Level = newPermission;
|
||||||
|
}
|
||||||
|
|
||||||
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
@ -140,9 +140,14 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
public async Task<IActionResult> Meta(int id, int count, int offset, DateTime? startAt)
|
public async Task<IActionResult> Meta(int id, int count, int offset, DateTime? startAt)
|
||||||
{
|
{
|
||||||
var meta = await MetaService.GetRuntimeMeta(id, startAt == null ? offset : 0, count, startAt ?? DateTime.UtcNow);
|
IEnumerable<ProfileMeta> meta = await MetaService.GetRuntimeMeta(id, startAt == null ? offset : 0, count, startAt ?? DateTime.UtcNow);
|
||||||
|
|
||||||
if (meta.Count == 0)
|
if (!Authorized)
|
||||||
|
{
|
||||||
|
meta = meta.Where(_meta => !_meta.Sensitive);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meta.Count() == 0)
|
||||||
{
|
{
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,22 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
public IActionResult Edit()
|
public IActionResult Edit()
|
||||||
{
|
{
|
||||||
|
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
return View("Index", Manager.GetApplicationSettings().Configuration());
|
return View("Index", Manager.GetApplicationSettings().Configuration());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> Edit(ApplicationConfiguration newConfiguration, bool addNewServer = false, bool shouldSave = false)
|
public async Task<IActionResult> Edit(ApplicationConfiguration newConfiguration, bool addNewServer = false, bool shouldSave = false)
|
||||||
{
|
{
|
||||||
|
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldSave)
|
if (shouldSave)
|
||||||
{
|
{
|
||||||
var currentConfiguration = Manager.GetApplicationSettings().Configuration();
|
var currentConfiguration = Manager.GetApplicationSettings().Configuration();
|
||||||
@ -48,6 +58,11 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
public IActionResult GetNewListItem(string propertyName, int itemCount)
|
public IActionResult GetNewListItem(string propertyName, int itemCount)
|
||||||
{
|
{
|
||||||
|
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||||
|
{
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
var configInfo = new ConfigurationInfo()
|
var configInfo = new ConfigurationInfo()
|
||||||
{
|
{
|
||||||
NewItemCount = itemCount,
|
NewItemCount = itemCount,
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SharedLibraryCore.Database.Models;
|
||||||
|
using SharedLibraryCore.Dtos;
|
||||||
using SharedLibraryCore.Services;
|
using SharedLibraryCore.Services;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WebfrontCore.ViewComponents
|
namespace WebfrontCore.ViewComponents
|
||||||
@ -9,7 +14,15 @@ namespace WebfrontCore.ViewComponents
|
|||||||
{
|
{
|
||||||
public async Task<IViewComponentResult> InvokeAsync(int clientId, int count, int offset, DateTime? startAt)
|
public async Task<IViewComponentResult> InvokeAsync(int clientId, int count, int offset, DateTime? startAt)
|
||||||
{
|
{
|
||||||
var meta = await MetaService.GetRuntimeMeta(clientId, offset, count, startAt ?? DateTime.UtcNow);
|
var level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), UserClaimsPrincipal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Role)?.Value ?? "User");
|
||||||
|
|
||||||
|
IEnumerable<ProfileMeta> meta = await MetaService.GetRuntimeMeta(clientId, offset, count, startAt ?? DateTime.UtcNow);
|
||||||
|
|
||||||
|
if (level < EFClient.Permission.Trusted)
|
||||||
|
{
|
||||||
|
meta = meta.Where(_meta => !_meta.Sensitive);
|
||||||
|
}
|
||||||
|
|
||||||
return View("_List", meta);
|
return View("_List", meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@model List<SharedLibraryCore.Dtos.ProfileMeta>
|
@model IEnumerable<SharedLibraryCore.Dtos.ProfileMeta>
|
||||||
@{
|
@{
|
||||||
Layout = null;
|
Layout = null;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (Model.Count == 0)
|
@if (Model.Count() == 0)
|
||||||
{
|
{
|
||||||
<div class="p2 text-muted profile-event-timestep">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_NONE"]</div>
|
<div class="p2 text-muted profile-event-timestep">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_NONE"]</div>
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,10 @@
|
|||||||
<div class="dropdown-menu p-0" aria-labelledby="account_dropdown">
|
<div class="dropdown-menu p-0" aria-labelledby="account_dropdown">
|
||||||
<a asp-controller="Console" asp-action="Index" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_CONSOLE"]</a>
|
<a asp-controller="Console" asp-action="Index" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_CONSOLE"]</a>
|
||||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@ViewBag.User.ClientId" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_PROFILE"]</a>
|
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@ViewBag.User.ClientId" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_PROFILE"]</a>
|
||||||
<a asp-controller="Configuration" asp-action="Edit" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_EDIT_CONFIGURATION"]</a>
|
@if (ViewBag.User.Level == SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||||
|
{
|
||||||
|
<a asp-controller="Configuration" asp-action="Edit" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_EDIT_CONFIGURATION"]</a>
|
||||||
|
}
|
||||||
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
|
<a class="dropdown-item bg-dark text-muted text-center text-lg-left profile-action" href="#" data-action="GenerateLoginToken" title="@loc["WEBFRONT_ACTION_TOKEN"]">@loc["WEBFRONT_ACTION_TOKEN"]</a>
|
||||||
<a asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
|
<a asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
|
||||||
</div>
|
</div>
|
||||||
@ -76,6 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- loading icon -->
|
<!-- loading icon -->
|
||||||
<div class="oi oi-loop-circular layout-loading-icon"></div>
|
<div class="oi oi-loop-circular layout-loading-icon"></div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user