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>
|
||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||
<Version>2.2.6.2</Version>
|
||||
<Version>2.2.6.4</Version>
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Product>IW4MAdmin</Product>
|
||||
@ -31,8 +31,8 @@
|
||||
<PropertyGroup>
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
<TieredCompilation>true</TieredCompilation>
|
||||
<AssemblyVersion>2.2.6.3</AssemblyVersion>
|
||||
<FileVersion>2.2.6.3</FileVersion>
|
||||
<AssemblyVersion>2.2.6.4</AssemblyVersion>
|
||||
<FileVersion>2.2.6.4</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -573,7 +573,7 @@ namespace IW4MAdmin.Application
|
||||
|
||||
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"]))
|
||||
{
|
||||
|
@ -48,11 +48,7 @@ namespace IW4MAdmin.Plugins.ProfanityDeterment
|
||||
|
||||
if (containsObjectionalWord)
|
||||
{
|
||||
E.Origin.Kick(Settings.Configuration().ProfanityKickMessage, new EFClient()
|
||||
{
|
||||
ClientId = 1,
|
||||
CurrentServer = E.Owner
|
||||
});
|
||||
E.Origin.Kick(Settings.Configuration().ProfanityKickMessage, Utilities.IW4MAdminClient(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 static async Task<string> GetNextMap(Server s)
|
||||
{
|
||||
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();
|
||||
string mapRotation = (await s.GetDvarAsync<string>("sv_mapRotation")).Value?.ToLower() ?? "";
|
||||
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
|
||||
var currentMap = regexMatches.Where(m => m.Groups[3].ToString() == s.CurrentMap.Name);
|
||||
@ -1289,7 +1289,7 @@ namespace SharedLibraryCore.Commands
|
||||
// no maprotation at all
|
||||
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
|
||||
@ -1318,12 +1318,14 @@ namespace SharedLibraryCore.Commands
|
||||
regexMatches[regexMatches.IndexOf(currentMap.First()) + 1] :
|
||||
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 ?
|
||||
Utilities.GetLocalizedGametype(s.Gametype) :
|
||||
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)
|
||||
|
@ -412,6 +412,16 @@ namespace SharedLibraryCore.Database.Models
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
else if (Level == newPermission)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Level = newPermission;
|
||||
}
|
||||
|
||||
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
||||
return e;
|
||||
}
|
||||
|
@ -140,9 +140,14 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -12,12 +12,22 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
public IActionResult Edit()
|
||||
{
|
||||
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
return View("Index", Manager.GetApplicationSettings().Configuration());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
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)
|
||||
{
|
||||
var currentConfiguration = Manager.GetApplicationSettings().Configuration();
|
||||
@ -48,6 +58,11 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
public IActionResult GetNewListItem(string propertyName, int itemCount)
|
||||
{
|
||||
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
var configInfo = new ConfigurationInfo()
|
||||
{
|
||||
NewItemCount = itemCount,
|
||||
|
@ -1,6 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebfrontCore.ViewComponents
|
||||
@ -9,7 +14,15 @@ namespace WebfrontCore.ViewComponents
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
@model List<SharedLibraryCore.Dtos.ProfileMeta>
|
||||
@model IEnumerable<SharedLibraryCore.Dtos.ProfileMeta>
|
||||
@{
|
||||
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>
|
||||
}
|
||||
|
@ -57,7 +57,10 @@
|
||||
<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="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 asp-controller="Account" asp-action="LogoutAsync" class="dropdown-item bg-dark text-muted text-center text-lg-left">@loc["WEBFRONT_NAV_LOGOUT"]</a>
|
||||
</div>
|
||||
@ -76,6 +79,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- loading icon -->
|
||||
<div class="oi oi-loop-circular layout-loading-icon"></div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user