fix misc webfront errors on first run after configuration
This commit is contained in:
parent
7fcb2202bd
commit
032753236b
@ -492,13 +492,17 @@ namespace IW4MAdmin.Application
|
|||||||
|
|
||||||
// this is because I want to store the command prefix in IW4MAdminSettings, but can't easily
|
// this is because I want to store the command prefix in IW4MAdminSettings, but can't easily
|
||||||
// inject it to all the places that need it
|
// inject it to all the places that need it
|
||||||
cmdConfig.CommandPrefix = _appConfig.CommandPrefix;
|
cmdConfig.CommandPrefix = _appConfig?.CommandPrefix ?? "!";
|
||||||
cmdConfig.BroadcastCommandPrefix = _appConfig.BroadcastCommandPrefix;
|
cmdConfig.BroadcastCommandPrefix = _appConfig?.BroadcastCommandPrefix ?? "@";
|
||||||
|
|
||||||
foreach (var cmd in commandsToAddToConfig)
|
foreach (var cmd in commandsToAddToConfig)
|
||||||
{
|
{
|
||||||
|
if (cmdConfig.Commands.ContainsKey(cmd.CommandConfigNameForType()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cmdConfig.Commands.Add(cmd.CommandConfigNameForType(),
|
cmdConfig.Commands.Add(cmd.CommandConfigNameForType(),
|
||||||
new CommandProperties()
|
new CommandProperties
|
||||||
{
|
{
|
||||||
Name = cmd.Name,
|
Name = cmd.Name,
|
||||||
Alias = cmd.Alias,
|
Alias = cmd.Alias,
|
||||||
|
@ -62,7 +62,7 @@ namespace SharedLibraryCore
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper property to provide the syntax of the command
|
/// Helper property to provide the syntax of the command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}";
|
public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix ?? "!"}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Alternate name for this command to be executed by
|
/// Alternate name for this command to be executed by
|
||||||
|
@ -114,7 +114,7 @@ namespace WebfrontCore.Controllers
|
|||||||
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
|
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
|
||||||
ViewBag.Description = $"Client information for {strippedName}";
|
ViewBag.Description = $"Client information for {strippedName}";
|
||||||
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
|
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
|
||||||
ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics;
|
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
|
||||||
|
|
||||||
return View("Profile/Index", clientDto);
|
return View("Profile/Index", clientDto);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using IW4MAdmin.Plugins.Stats;
|
using IW4MAdmin.Plugins.Stats;
|
||||||
using IW4MAdmin.Plugins.Stats.Config;
|
|
||||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
@ -33,11 +32,11 @@ namespace WebfrontCore.ViewComponents
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics;
|
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
|
||||||
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml",
|
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml",
|
||||||
_configurationHandler.Configuration().EnableAdvancedMetrics
|
ViewBag.UseNewStats
|
||||||
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)
|
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)
|
||||||
: await Plugin.Manager.GetTopStats(offset, count, serverId));
|
: await Plugin.Manager.GetTopStats(offset, count, serverId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user