1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

add configurable command and broadcast command prefix for issue #149

This commit is contained in:
RaidMax
2020-07-31 20:40:03 -05:00
parent fc20e78066
commit 51202e7f8b
27 changed files with 403 additions and 61 deletions

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -11,9 +11,11 @@ namespace WebfrontCore.Controllers
{
public class ConsoleController : BaseController
{
private readonly ApplicationConfiguration _appconfig;
public ConsoleController(IManager manager) : base(manager)
{
_appconfig = manager.GetApplicationSettings().Configuration();
}
public IActionResult Index()
@ -50,7 +52,8 @@ namespace WebfrontCore.Controllers
var remoteEvent = new GameEvent()
{
Type = GameEvent.EventType.Command,
Data = command,
Data = command.StartsWith(_appconfig.CommandPrefix) || command.StartsWith(_appconfig.BroadcastCommandPrefix) ?
command : $"{_appconfig.CommandPrefix}{command}",
Origin = client,
Owner = server,
IsRemote = true
@ -63,7 +66,7 @@ namespace WebfrontCore.Controllers
{
// wait for the event to process
var completedEvent = await remoteEvent.WaitAsync(Utilities.DefaultCommandTimeout, server.Manager.CancellationToken);
if (completedEvent.FailReason == GameEvent.EventFailReason.Timeout)
{
response = new[]