diff --git a/Plugins/LiveRadar/LiveRadar.csproj b/Plugins/LiveRadar/LiveRadar.csproj index 800e5dc58..b42c8c1bf 100644 --- a/Plugins/LiveRadar/LiveRadar.csproj +++ b/Plugins/LiveRadar/LiveRadar.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2 @@ -6,21 +6,24 @@ true 0.1.0.0 Debug;Release;Prerelease + 7.1 false - - false - + + + + + diff --git a/Plugins/LiveRadar/Web/Views/LiveRadar/Index.cshtml b/Plugins/LiveRadar/Views/Radar/Index.cshtml similarity index 100% rename from Plugins/LiveRadar/Web/Views/LiveRadar/Index.cshtml rename to Plugins/LiveRadar/Views/Radar/Index.cshtml diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs index 8538d5e02..9c4ec1263 100644 --- a/SharedLibraryCore/Commands/NativeCommands.cs +++ b/SharedLibraryCore/Commands/NativeCommands.cs @@ -167,6 +167,7 @@ namespace SharedLibraryCore.Commands public override Task ExecuteAsync(GameEvent E) { E.Owner.Broadcast($"{(E.Owner.GameName == Server.Game.IW4 ? "^:" : "")}{E.Origin.Name} - ^6{E.Data}^7", E.Origin); + E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SAY_SUCCESS"]); return Task.CompletedTask; } } diff --git a/WebfrontCore/Controllers/ActionController.cs b/WebfrontCore/Controllers/ActionController.cs index 3cdd2c225..f0284aeba 100644 --- a/WebfrontCore/Controllers/ActionController.cs +++ b/WebfrontCore/Controllers/ActionController.cs @@ -203,5 +203,43 @@ namespace WebfrontCore.Controllers var state = Manager.TokenAuthenticator.GenerateNextToken(Client.NetworkId); return string.Format(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_GENERATETOKEN_SUCCESS"], state.Token, $"{state.RemainingTime} {Utilities.CurrentLocalization.LocalizationIndex["GLOBAL_MINUTES"]}", Client.ClientId); } + + public IActionResult ChatForm(long id) + { + var info = new ActionInfo() + { + ActionButtonLabel = Localization["WEBFRONT_ACTION_LABEL_SUBMIT_MESSAGE"], + Name = "Chat", + Inputs = new List + { + new InputInfo() + { + Name = "message", + Type = "text", + Label = Localization["WEBFRONT_ACTION_LABEL_MESSAGE"] + }, + new InputInfo() + { + Name = "id", + Value = id.ToString(), + Type = "hidden" + } + }, + Action = "ChatAsync" + }; + + return View("_ActionForm", info); + } + + public async Task ChatAsync(long id, string message) + { + var server = Manager.GetServers().First(_server => _server.EndPoint == id); + + return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new + { + serverId = server.EndPoint, + command = $"!say {message}" + })); + } } } diff --git a/WebfrontCore/Controllers/BaseController.cs b/WebfrontCore/Controllers/BaseController.cs index 9407c979b..820480bb4 100644 --- a/WebfrontCore/Controllers/BaseController.cs +++ b/WebfrontCore/Controllers/BaseController.cs @@ -72,7 +72,7 @@ namespace WebfrontCore.Controllers if (clientId > 0) { Client.ClientId = clientId; - Client.NetworkId = User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertGuidToLong(); + 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; diff --git a/WebfrontCore/Views/Action/_ActionForm.cshtml b/WebfrontCore/Views/Action/_ActionForm.cshtml index 5adc037e3..bd5db4dc4 100644 --- a/WebfrontCore/Views/Action/_ActionForm.cshtml +++ b/WebfrontCore/Views/Action/_ActionForm.cshtml @@ -5,41 +5,47 @@
@foreach (var input in Model.Inputs) { -
+ string inputType = input.Type ?? "text"; + string value = input.Value ?? ""; -
- @input.Label -
- @{ - string inputType = input.Type ?? "text"; - string value = input.Value ?? ""; + if (input.Type != "hidden") + { +
- if (inputType == "select") - { - - } - - else if (inputType == "checkbox") - { -
- +
+ @input.Label
- } - else - { - - } + @if (inputType == "select") + { + + } + + else if (inputType == "checkbox") + { +
+ +
+ } + + else + { + + } + +
+ } + else + { + } - -
} \ No newline at end of file diff --git a/WebfrontCore/Views/Server/_Server.cshtml b/WebfrontCore/Views/Server/_Server.cshtml index 1b242d818..162bab054 100644 --- a/WebfrontCore/Views/Server/_Server.cshtml +++ b/WebfrontCore/Views/Server/_Server.cshtml @@ -6,13 +6,25 @@
@Model.Name - + + @if (ViewBag.Authorized) + { + + }
+
@Model.Map
@Model.ClientCount/@Model.MaxClients
+ + @if (ViewBag.Authorized) + { +
+ +
+ }
diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj index 3ee12c27e..28208884c 100644 --- a/WebfrontCore/WebfrontCore.csproj +++ b/WebfrontCore/WebfrontCore.csproj @@ -80,7 +80,7 @@ all - runtime; build; native; contentfiles; analyzers + runtime; build; native; contentfiles; diff --git a/WebfrontCore/wwwroot/js/action.js b/WebfrontCore/wwwroot/js/action.js index 07fde586c..eb6c0b10d 100644 --- a/WebfrontCore/wwwroot/js/action.js +++ b/WebfrontCore/wwwroot/js/action.js @@ -32,7 +32,9 @@ $(document).ready(function () { */ $('.profile-action').click(function (e) { const actionType = $(this).data('action'); - $.get('/Action/' + actionType + 'Form') + const actionId = $(this).data('action-id'); + const actionIdKey = actionId == undefined ? '' : '?id=' + actionId; + $.get('/Action/' + actionType + 'Form' + actionIdKey) .done(function (response) { $('#actionModal .modal-message').fadeOut('fast'); $('#actionModal .modal-body-content').html(response); diff --git a/version.txt b/version.txt index 69214c0ef..3f0d081af 100644 --- a/version.txt +++ b/version.txt @@ -1,6 +1,11 @@ +Version 2.4: +-added "live radar" feature +-added chat message to server on server list view + Version 2.3: -added configuration option to ignore bots -updated anticheat slightly +-lots more Version 2.2: -upgraded projects to .NET 2.1