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

hide chat for password protected servers for issue #162

This commit is contained in:
RaidMax
2020-08-20 10:38:11 -05:00
parent 774d4a5d30
commit 2e0b1b3569
39 changed files with 1171 additions and 188 deletions

View File

@ -42,7 +42,8 @@ namespace WebfrontCore.Controllers
LevelInt = (int)p.Level
}).ToList(),
ChatHistory = s.ChatHistory.ToList(),
PlayerHistory = s.ClientHistory.ToArray()
PlayerHistory = s.ClientHistory.ToArray(),
IsPasswordProtected = !string.IsNullOrEmpty(s.GamePassword)
};
return PartialView("_ClientActivity", serverInfo);
}

View File

@ -5,31 +5,24 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Dtos.Meta.Responses;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Services;
using Stats.Dtos;
using Stats.Helpers;
using StatsWeb;
using StatsWeb.Dtos;
/*using Stats.Dtos;
using Stats.Helpers;
using StatsWeb;
using StatsWeb.Dtos;*/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Threading.Tasks;
using WebfrontCore.Controllers.API.Dtos;
using WebfrontCore.Controllers.API.Validation;
using WebfrontCore.Middleware;
@ -117,7 +110,7 @@ namespace WebfrontCore
#endif
services.AddSingleton(Program.Manager);
services.AddSingleton<IResourceQueryHelper<ChatSearchQuery, ChatSearchResult>, ChatResourceQueryHelper>();
services.AddSingleton<IResourceQueryHelper<ChatSearchQuery, MessageResponse>, ChatResourceQueryHelper>();
services.AddTransient<IValidator<FindClientRequest>, FindClientRequestValidator>();
services.AddSingleton<IResourceQueryHelper<FindClientRequest, FindClientResult>, ClientService>();
services.AddSingleton<IResourceQueryHelper<StatsInfoRequest, StatsInfoResult>, StatsResourceQueryHelper>();
@ -130,6 +123,7 @@ namespace WebfrontCore
services.AddSingleton(Program.ApplicationServiceProvider.GetService<SharedLibraryCore.Interfaces.ILogger>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IEnumerable<IManagerCommand>>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<IMetaService>());
services.AddSingleton(Program.ApplicationServiceProvider.GetService<ApplicationConfiguration>());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -1,9 +1,17 @@
@using SharedLibraryCore.Dtos.Meta.Responses;
@using SharedLibraryCore.Dtos.Meta.Responses
@model MessageResponse
<span class="client-message" data-serverid="@Model.ServerId" data-when="@Model.When.ToFileTimeUtc()">
<span class="oi oi-chevron-right text-white-50 align-middle client-message-prefix" title="@ViewBag.Localization["WEBFRONT_PROFILE_MESSAGE_CONTEXT"]" style="font-size: 0.75rem; margin-top: -0.256rem"></span>
<span class="text-muted">
<color-code value="@Model.Message" allow="@ViewBag.EnableColorCodes"></color-code>
<span class="text-muted @(Model.IsQuickMessage ? "font-weight-bold": "")">
@if (Model.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
}
else
{
<color-code value="@Model.Message" allow="@ViewBag.EnableColorCodes"></color-code>
}
</span>
</span>

View File

@ -15,6 +15,8 @@
continue;
}
string message = Model.ChatHistory[i].IsHidden && !ViewBag.Authorized ? Model.ChatHistory[i].HiddenMessage : Model.ChatHistory[i].Message;
if (Model.ChatHistory[i].Message == "CONNECTED")
{
<span class="text-light">
@ -36,7 +38,7 @@
</span>
<span>
&mdash;
<color-code value="@Model.ChatHistory[i].Message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
</span><br />
}
}
@ -114,6 +116,8 @@
continue;
}
string message = Model.ChatHistory[i].IsHidden && !ViewBag.Authorized ? Model.ChatHistory[i].HiddenMessage : Model.ChatHistory[i].Message;
if (Model.ChatHistory[i].Message == "CONNECTED")
{
<span class="text-light">
@ -135,7 +139,7 @@
</span>
<span>
&mdash;
<color-code value="@Model.ChatHistory[i].Message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
</span><br />
}
}

View File

@ -12,7 +12,7 @@ function initLoader(location, loaderId, count = 10, start = count, additional) {
loaderResponseId = loaderId;
loadCount = count;
loaderOffset = start;
additionalParams = additional;
additionalParams = additional ?? [];
setupListeners();
}