From bb42861a926e26bc1b8a8daf002cb4adaa2d8661 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Fri, 2 Aug 2019 18:04:34 -0500 Subject: [PATCH] finish color code support (I think) --- Application/Application.csproj | 1 + Application/Misc/Logger.cs | 4 +- .../LiveRadar/Controllers/RadarController.cs | 3 +- Plugins/LiveRadar/Plugin.cs | 2 +- Plugins/LiveRadar/Views/Radar/Index.cshtml | 3 +- Plugins/LiveRadar/Views/_ViewImports.cshtml | 1 + Plugins/Stats/Plugin.cs | 4 - .../Stats/Components/TopPlayers/_List.cshtml | 4 +- Plugins/Web/StatsWeb/Views/Stats/Index.cshtml | 4 +- .../Web/StatsWeb/Views/_ViewImports.cshtml | 1 + .../Configuration/ApplicationConfiguration.cs | 3 +- SharedLibraryCore/Database/DatabaseContext.cs | 2 + SharedLibraryCore/Database/Models/EFAlias.cs | 2 + ...2174908_AddSearchNameToEFAlias.Designer.cs | 704 ++++++++++++++++++ .../20190802174908_AddSearchNameToEFAlias.cs | 32 + .../DatabaseContextModelSnapshot.cs | 7 +- SharedLibraryCore/Server.cs | 24 +- SharedLibraryCore/Services/ClientService.cs | 28 +- SharedLibraryCore/Utilities.cs | 12 +- WebfrontCore/Controllers/AccountController.cs | 2 +- WebfrontCore/Controllers/BaseController.cs | 2 + WebfrontCore/Controllers/ClientController.cs | 12 +- .../Controllers/DynamicFileController.cs | 16 +- WebfrontCore/TagHelpers/ColorCode.cs | 41 + WebfrontCore/Views/Client/Find/Index.cshtml | 12 +- .../Views/Client/Privileged/Index.cshtml | 5 +- .../Views/Client/Profile/Index.cshtml | 6 +- WebfrontCore/Views/Console/Index.cshtml | 2 +- WebfrontCore/Views/Penalty/_Penalty.cshtml | 16 +- .../Views/Server/_ClientActivity.cshtml | 17 +- WebfrontCore/Views/Server/_Server.cshtml | 2 +- .../Components/Client/_RecentClients.cshtml | 4 +- .../Components/ProfileMetaList/_List.cshtml | 11 +- WebfrontCore/Views/_ViewImports.cshtml | 1 + WebfrontCore/wwwroot/css/main.scss | 70 ++ 35 files changed, 990 insertions(+), 70 deletions(-) create mode 100644 SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.Designer.cs create mode 100644 SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.cs create mode 100644 WebfrontCore/TagHelpers/ColorCode.cs diff --git a/Application/Application.csproj b/Application/Application.csproj index d2d3f06e1..8226d692e 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -25,6 +25,7 @@ + diff --git a/Application/Misc/Logger.cs b/Application/Misc/Logger.cs index c10a90fc4..ba4e3f324 100644 --- a/Application/Misc/Logger.cs +++ b/Application/Misc/Logger.cs @@ -73,13 +73,13 @@ namespace IW4MAdmin.Application { #if DEBUG // lets keep it simple and dispose of everything quickly as logging wont be that much (relatively) - Console.WriteLine(LogLine); + Console.WriteLine(LogLine.StripColors()); await File.AppendAllTextAsync(FileName, $"{LogLine}{Environment.NewLine}"); //Debug.WriteLine(msg); #else if (type == LogType.Error || type == LogType.Verbose) { - Console.WriteLine(LogLine); + Console.WriteLine(LogLine.StripColors()); } await File.AppendAllTextAsync(FileName, $"{LogLine}{Environment.NewLine}"); #endif diff --git a/Plugins/LiveRadar/Controllers/RadarController.cs b/Plugins/LiveRadar/Controllers/RadarController.cs index 5a98f764c..9cc302453 100644 --- a/Plugins/LiveRadar/Controllers/RadarController.cs +++ b/Plugins/LiveRadar/Controllers/RadarController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using SharedLibraryCore; using SharedLibraryCore.Dtos; using System.Linq; using WebfrontCore.Controllers; @@ -66,7 +67,7 @@ namespace LiveRadar.Web.Controllers if (client != null) { - radarUpdate.Name = client.Name; + radarUpdate.Name = client.Name.StripColors(); client.SetAdditionalProperty("LiveRadar", radarUpdate); } diff --git a/Plugins/LiveRadar/Plugin.cs b/Plugins/LiveRadar/Plugin.cs index ced690cb4..3389d7ddc 100644 --- a/Plugins/LiveRadar/Plugin.cs +++ b/Plugins/LiveRadar/Plugin.cs @@ -31,7 +31,7 @@ namespace LiveRadar if (client != null) { - radarUpdate.Name = client.Name; + radarUpdate.Name = client.Name.StripColors(); client.SetAdditionalProperty("LiveRadar", radarUpdate); } } diff --git a/Plugins/LiveRadar/Views/Radar/Index.cshtml b/Plugins/LiveRadar/Views/Radar/Index.cshtml index c4490e24c..b5baa13b9 100644 --- a/Plugins/LiveRadar/Views/Radar/Index.cshtml +++ b/Plugins/LiveRadar/Views/Radar/Index.cshtml @@ -17,7 +17,7 @@ @foreach (SharedLibraryCore.Dtos.ServerInfo server in ViewBag.Servers) { } @@ -173,7 +173,6 @@ context.canvas.height = width; context.canvas.width = context.canvas.height; - } stateInfo.imageScaler = (stateInfo.canvas.width() / 1024) diff --git a/Plugins/LiveRadar/Views/_ViewImports.cshtml b/Plugins/LiveRadar/Views/_ViewImports.cshtml index a757b413b..bd99e0be3 100644 --- a/Plugins/LiveRadar/Views/_ViewImports.cshtml +++ b/Plugins/LiveRadar/Views/_ViewImports.cshtml @@ -1 +1,2 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, WebfrontCore \ No newline at end of file diff --git a/Plugins/Stats/Plugin.cs b/Plugins/Stats/Plugin.cs index 897dd2d79..c44652e08 100644 --- a/Plugins/Stats/Plugin.cs +++ b/Plugins/Stats/Plugin.cs @@ -100,10 +100,6 @@ namespace IW4MAdmin.Plugins.Stats await Manager.AddStandardKill(E.Origin, E.Target); } - else - { - throw new Exception(); - } break; case GameEvent.EventType.Damage: if (!E.Owner.CustomCallback && !ShouldIgnoreEvent(E.Origin, E.Target)) diff --git a/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml b/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml index 39f4ae8eb..1df5f7b15 100644 --- a/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml +++ b/Plugins/Web/StatsWeb/Views/Stats/Components/TopPlayers/_List.cshtml @@ -51,7 +51,9 @@ } - @Html.ActionLink(stat.Name, "ProfileAsync", "Client", new { id = stat.ClientId }) + + + @stat.Performance @loc["PLUGINS_STATS_COMMANDS_PERFORMANCE"]
diff --git a/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml b/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml index 831c5a7d3..98fd9c3d8 100644 --- a/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml +++ b/Plugins/Web/StatsWeb/Views/Stats/Index.cshtml @@ -6,7 +6,9 @@ @foreach (var server in ViewBag.Servers) { } diff --git a/Plugins/Web/StatsWeb/Views/_ViewImports.cshtml b/Plugins/Web/StatsWeb/Views/_ViewImports.cshtml index a757b413b..c4696501a 100644 --- a/Plugins/Web/StatsWeb/Views/_ViewImports.cshtml +++ b/Plugins/Web/StatsWeb/Views/_ViewImports.cshtml @@ -1 +1,2 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, WebfrontCore diff --git a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs index e8e1b9fa9..629410d1a 100644 --- a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs +++ b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs @@ -78,7 +78,8 @@ namespace SharedLibraryCore.Configuration public int RConPollRate { get; set; } = 5000; [LocalizedDisplayName("WEBFRONT_CONFIGURATION_MAX_TB")] public TimeSpan MaximumTempBanTime { get; set; } = new TimeSpan(24 * 30, 0, 0); - + [LocalizedDisplayName("SETUP_ENABLE_COLOR_CODES")] + public bool EnableColorCodes { get; set; } [LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGE_PERIOD")] public int AutoMessagePeriod { get; set; } [LocalizedDisplayName("WEBFRONT_CONFIGURATION_AUTOMESSAGES")] diff --git a/SharedLibraryCore/Database/DatabaseContext.cs b/SharedLibraryCore/Database/DatabaseContext.cs index adbd0b04e..96ab2f9f9 100644 --- a/SharedLibraryCore/Database/DatabaseContext.cs +++ b/SharedLibraryCore/Database/DatabaseContext.cs @@ -157,6 +157,8 @@ namespace SharedLibraryCore.Database ent.HasIndex(a => a.IPAddress); ent.Property(a => a.Name).HasMaxLength(24); ent.HasIndex(a => a.Name); + ent.Property(_alias => _alias.SearchableName).HasMaxLength(24); + ent.HasIndex(_alias => _alias.SearchableName); }); modelBuilder.Entity(ent => diff --git a/SharedLibraryCore/Database/Models/EFAlias.cs b/SharedLibraryCore/Database/Models/EFAlias.cs index 15ca4e5a7..0cba62ac2 100644 --- a/SharedLibraryCore/Database/Models/EFAlias.cs +++ b/SharedLibraryCore/Database/Models/EFAlias.cs @@ -15,6 +15,8 @@ namespace SharedLibraryCore.Database.Models [Required] [MaxLength(24)] public string Name { get; set; } + [MaxLength(24)] + public string SearchableName { get; set; } [Required] public int? IPAddress { get; set; } [Required] diff --git a/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.Designer.cs b/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.Designer.cs new file mode 100644 index 000000000..c59a5bf1a --- /dev/null +++ b/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.Designer.cs @@ -0,0 +1,704 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SharedLibraryCore.Database; + +namespace SharedLibraryCore.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20190802174908_AddSearchNameToEFAlias")] + partial class AddSearchNameToEFAlias + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079"); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot", b => + { + b.Property("SnapshotId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ClientId"); + + b.Property("CurrentSessionLength"); + + b.Property("CurrentStrain"); + + b.Property("CurrentViewAngleId"); + + b.Property("Deaths"); + + b.Property("Distance"); + + b.Property("EloRating"); + + b.Property("HitDestinationId"); + + b.Property("HitLocation"); + + b.Property("HitOriginId"); + + b.Property("HitType"); + + b.Property("Hits"); + + b.Property("Kills"); + + b.Property("LastStrainAngleId"); + + b.Property("RecoilOffset"); + + b.Property("SessionAngleOffset"); + + b.Property("SessionSPM"); + + b.Property("SessionScore"); + + b.Property("StrainAngleBetween"); + + b.Property("TimeSinceLastEvent"); + + b.Property("WeaponId"); + + b.Property("When"); + + b.HasKey("SnapshotId"); + + b.HasIndex("ClientId"); + + b.HasIndex("CurrentViewAngleId"); + + b.HasIndex("HitDestinationId"); + + b.HasIndex("HitOriginId"); + + b.HasIndex("LastStrainAngleId"); + + b.ToTable("EFACSnapshot"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b => + { + b.Property("KillId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("AttackerId"); + + b.Property("Damage"); + + b.Property("DeathOriginVector3Id"); + + b.Property("DeathType"); + + b.Property("Fraction"); + + b.Property("HitLoc"); + + b.Property("IsKill"); + + b.Property("KillOriginVector3Id"); + + b.Property("Map"); + + b.Property("ServerId"); + + b.Property("VictimId"); + + b.Property("ViewAnglesVector3Id"); + + b.Property("VisibilityPercentage"); + + b.Property("Weapon"); + + b.Property("When"); + + b.HasKey("KillId"); + + b.HasIndex("AttackerId"); + + b.HasIndex("DeathOriginVector3Id"); + + b.HasIndex("KillOriginVector3Id"); + + b.HasIndex("ServerId"); + + b.HasIndex("VictimId"); + + b.HasIndex("ViewAnglesVector3Id"); + + b.ToTable("EFClientKills"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b => + { + b.Property("MessageId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ClientId"); + + b.Property("Message"); + + b.Property("ServerId"); + + b.Property("TimeSent"); + + b.HasKey("MessageId"); + + b.HasIndex("ClientId"); + + b.HasIndex("ServerId"); + + b.HasIndex("TimeSent"); + + b.ToTable("EFClientMessages"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b => + { + b.Property("RatingHistoryId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ClientId"); + + b.HasKey("RatingHistoryId"); + + b.HasIndex("ClientId"); + + b.ToTable("EFClientRatingHistory"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b => + { + b.Property("ClientId"); + + b.Property("ServerId"); + + b.Property("Active"); + + b.Property("AverageRecoilOffset"); + + b.Property("Deaths"); + + b.Property("EloRating"); + + b.Property("Kills"); + + b.Property("MaxStrain"); + + b.Property("RollingWeightedKDR"); + + b.Property("SPM"); + + b.Property("Skill"); + + b.Property("TimePlayed"); + + b.Property("VisionAverage"); + + b.HasKey("ClientId", "ServerId"); + + b.HasIndex("ServerId"); + + b.ToTable("EFClientStatistics"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b => + { + b.Property("HitLocationCountId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ClientId") + .HasColumnName("EFClientStatistics_ClientId"); + + b.Property("HitCount"); + + b.Property("HitOffsetAverage"); + + b.Property("Location"); + + b.Property("MaxAngleDistance"); + + b.Property("ServerId") + .HasColumnName("EFClientStatistics_ServerId"); + + b.HasKey("HitLocationCountId"); + + b.HasIndex("ServerId"); + + b.HasIndex("ClientId", "ServerId"); + + b.ToTable("EFHitLocationCounts"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ActivityAmount"); + + b.Property("Newest"); + + b.Property("Performance"); + + b.Property("Ranking"); + + b.Property("RatingHistoryId"); + + b.Property("ServerId"); + + b.Property("When"); + + b.HasKey("RatingId"); + + b.HasIndex("RatingHistoryId"); + + b.HasIndex("ServerId"); + + b.HasIndex("Performance", "Ranking", "When"); + + b.ToTable("EFRating"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServer", b => + { + b.Property("ServerId"); + + b.Property("Active"); + + b.Property("EndPoint"); + + b.Property("GameName"); + + b.Property("Port"); + + b.HasKey("ServerId"); + + b.ToTable("EFServers"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b => + { + b.Property("StatisticId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ServerId"); + + b.Property("TotalKills"); + + b.Property("TotalPlayTime"); + + b.HasKey("StatisticId"); + + b.HasIndex("ServerId"); + + b.ToTable("EFServerStatistics"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b => + { + b.Property("AliasId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("DateAdded"); + + b.Property("IPAddress"); + + b.Property("LinkId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(24); + + b.Property("SearchableName") + .HasMaxLength(24); + + b.HasKey("AliasId"); + + b.HasIndex("IPAddress"); + + b.HasIndex("LinkId"); + + b.HasIndex("Name"); + + b.HasIndex("SearchableName"); + + b.ToTable("EFAlias"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAliasLink", b => + { + b.Property("AliasLinkId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.HasKey("AliasLinkId"); + + b.ToTable("EFAliasLinks"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFChangeHistory", b => + { + b.Property("ChangeHistoryId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Comment") + .HasMaxLength(128); + + b.Property("CurrentValue"); + + b.Property("OriginEntityId"); + + b.Property("PreviousValue"); + + b.Property("TargetEntityId"); + + b.Property("TimeChanged"); + + b.Property("TypeOfChange"); + + b.HasKey("ChangeHistoryId"); + + b.ToTable("EFChangeHistory"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b => + { + b.Property("ClientId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("AliasLinkId"); + + b.Property("Connections"); + + b.Property("CurrentAliasId"); + + b.Property("FirstConnection"); + + b.Property("LastConnection"); + + b.Property("Level"); + + b.Property("Masked"); + + b.Property("NetworkId"); + + b.Property("Password"); + + b.Property("PasswordSalt"); + + b.Property("TotalConnectionTime"); + + b.HasKey("ClientId"); + + b.HasIndex("AliasLinkId"); + + b.HasIndex("CurrentAliasId"); + + b.HasIndex("NetworkId") + .IsUnique(); + + b.ToTable("EFClients"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFMeta", b => + { + b.Property("MetaId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ClientId"); + + b.Property("Created"); + + b.Property("Extra"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(32); + + b.Property("Updated"); + + b.Property("Value") + .IsRequired(); + + b.HasKey("MetaId"); + + b.HasIndex("ClientId"); + + b.HasIndex("Key"); + + b.ToTable("EFMeta"); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b => + { + b.Property("PenaltyId") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("AutomatedOffense"); + + b.Property("Expires"); + + b.Property("IsEvadedOffense"); + + b.Property("LinkId"); + + b.Property("OffenderId"); + + b.Property("Offense") + .IsRequired(); + + b.Property("PunisherId"); + + b.Property("Type"); + + b.Property("When"); + + b.HasKey("PenaltyId"); + + b.HasIndex("LinkId"); + + b.HasIndex("OffenderId"); + + b.HasIndex("PunisherId"); + + b.ToTable("EFPenalties"); + }); + + modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b => + { + b.Property("Vector3Id") + .ValueGeneratedOnAdd(); + + b.Property("EFACSnapshotSnapshotId"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Vector3Id"); + + b.HasIndex("EFACSnapshotSnapshotId"); + + b.ToTable("Vector3"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "CurrentViewAngle") + .WithMany() + .HasForeignKey("CurrentViewAngleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "HitDestination") + .WithMany() + .HasForeignKey("HitDestinationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "HitOrigin") + .WithMany() + .HasForeignKey("HitOriginId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "LastStrainAngle") + .WithMany() + .HasForeignKey("LastStrainAngleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientKill", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Attacker") + .WithMany() + .HasForeignKey("AttackerId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "DeathOrigin") + .WithMany() + .HasForeignKey("DeathOriginVector3Id"); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "KillOrigin") + .WithMany() + .HasForeignKey("KillOriginVector3Id"); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Helpers.Vector3", "ViewAngles") + .WithMany() + .HasForeignKey("ViewAnglesVector3Id"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientMessage", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFHitLocationCount", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientStatistics") + .WithMany("HitLocations") + .HasForeignKey("ClientId", "ServerId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFRating", b => + { + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFClientRatingHistory", "RatingHistory") + .WithMany("Ratings") + .HasForeignKey("RatingHistoryId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId"); + }); + + modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFServerStatistics", b => + { + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFServer", "Server") + .WithMany() + .HasForeignKey("ServerId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFAlias", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link") + .WithMany("Children") + .HasForeignKey("LinkId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFClient", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "AliasLink") + .WithMany() + .HasForeignKey("AliasLinkId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Database.Models.EFAlias", "CurrentAlias") + .WithMany() + .HasForeignKey("CurrentAliasId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFMeta", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Client") + .WithMany("Meta") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("SharedLibraryCore.Database.Models.EFPenalty", b => + { + b.HasOne("SharedLibraryCore.Database.Models.EFAliasLink", "Link") + .WithMany("ReceivedPenalties") + .HasForeignKey("LinkId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Offender") + .WithMany("ReceivedPenalties") + .HasForeignKey("OffenderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("SharedLibraryCore.Database.Models.EFClient", "Punisher") + .WithMany("AdministeredPenalties") + .HasForeignKey("PunisherId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("SharedLibraryCore.Helpers.Vector3", b => + { + b.HasOne("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot") + .WithMany("PredictedViewAngles") + .HasForeignKey("EFACSnapshotSnapshotId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.cs b/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.cs new file mode 100644 index 000000000..639559ed0 --- /dev/null +++ b/SharedLibraryCore/Migrations/20190802174908_AddSearchNameToEFAlias.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SharedLibraryCore.Migrations +{ + public partial class AddSearchNameToEFAlias : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SearchableName", + table: "EFAlias", + maxLength: 24, + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_EFAlias_SearchableName", + table: "EFAlias", + column: "SearchableName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_EFAlias_SearchableName", + table: "EFAlias"); + + migrationBuilder.DropColumn( + name: "SearchableName", + table: "EFAlias"); + } + } +} diff --git a/SharedLibraryCore/Migrations/DatabaseContextModelSnapshot.cs b/SharedLibraryCore/Migrations/DatabaseContextModelSnapshot.cs index 6dbba306d..97423ea7a 100644 --- a/SharedLibraryCore/Migrations/DatabaseContextModelSnapshot.cs +++ b/SharedLibraryCore/Migrations/DatabaseContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace SharedLibraryCore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079"); modelBuilder.Entity("IW4MAdmin.Plugins.Stats.Models.EFACSnapshot", b => { @@ -329,6 +329,9 @@ namespace SharedLibraryCore.Migrations .IsRequired() .HasMaxLength(24); + b.Property("SearchableName") + .HasMaxLength(24); + b.HasKey("AliasId"); b.HasIndex("IPAddress"); @@ -337,6 +340,8 @@ namespace SharedLibraryCore.Migrations b.HasIndex("Name"); + b.HasIndex("SearchableName"); + b.ToTable("EFAlias"); }); diff --git a/SharedLibraryCore/Server.cs b/SharedLibraryCore/Server.cs index 09b995194..2e37c8c13 100644 --- a/SharedLibraryCore/Server.cs +++ b/SharedLibraryCore/Server.cs @@ -119,7 +119,7 @@ namespace SharedLibraryCore /// Message to be sent to all players public GameEvent Broadcast(string message, EFClient sender = null) { - string formattedMessage = String.Format(RconParser.Configuration.CommandPrefixes.Say, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{message}"); + string formattedMessage = String.Format(RconParser.Configuration.CommandPrefixes.Say, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{message.FixIW4ForwardSlash()}"); #if DEBUG == true Logger.WriteVerbose(message.StripColors()); @@ -140,23 +140,23 @@ namespace SharedLibraryCore /// /// Send a message to a particular players /// - /// Message to send - /// EFClient to send message to - protected async Task Tell(String Message, EFClient Target) + /// Message to send + /// EFClient to send message to + protected async Task Tell(string message, EFClient target) { #if !DEBUG - string formattedMessage = String.Format(RconParser.Configuration.CommandPrefixes.Tell, Target.ClientNumber, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{Message}"); - if (Target.ClientNumber > -1 && Message.Length > 0 && Target.Level != EFClient.Permission.Console) + string formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell, target.ClientNumber, $"{(CustomSayEnabled ? $"{CustomSayName}: " : "")}{message.FixIW4ForwardSlash()}"); + if (target.ClientNumber > -1 && message.Length > 0 && target.Level != EFClient.Permission.Console) await this.ExecuteCommandAsync(formattedMessage); #else - Logger.WriteVerbose($"{Target.ClientNumber}->{Message.StripColors()}"); + Logger.WriteVerbose($"{target.ClientNumber}->{message.StripColors()}"); await Task.CompletedTask; #endif - if (Target.Level == EFClient.Permission.Console) + if (target.Level == EFClient.Permission.Console) { Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine(Message.StripColors()); + Console.WriteLine(message.StripColors()); Console.ForegroundColor = ConsoleColor.Gray; } @@ -167,12 +167,12 @@ namespace SharedLibraryCore } // it was a remote command so we need to add it to the command result queue - if (Target.ClientNumber < 0) + if (target.ClientNumber < 0) { CommandResult.Add(new CommandResponseInfo() { - Response = Message.StripColors(), - ClientId = Target.ClientId + Response = message.StripColors(), + ClientId = target.ClientId }); } } diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index 23a33acdf..77d0525dc 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -65,6 +65,7 @@ namespace SharedLibraryCore.Services client.CurrentAlias = new EFAlias() { Name = entity.Name, + SearchableName = entity.Name.StripColors().ToLower(), DateAdded = DateTime.UtcNow, IPAddress = entity.IPAddress, LinkId = linkId.Value @@ -79,6 +80,7 @@ namespace SharedLibraryCore.Services var alias = new EFAlias() { Name = entity.Name, + SearchableName = entity.Name.StripColors().ToLower(), DateAdded = DateTime.UtcNow, IPAddress = entity.IPAddress, Link = link @@ -194,6 +196,7 @@ namespace SharedLibraryCore.Services IPAddress = ip, LinkId = newAliasLink.AliasLinkId, Name = name, + SearchableName = name.StripColors().ToLower(), Active = true, }; @@ -422,6 +425,27 @@ namespace SharedLibraryCore.Services } } + public async Task GetClientForLogin(int clientId) + { + using (var ctx = new DatabaseContext(true)) + { + return await ctx.Clients + .Select(_client => new EFClient() + { + NetworkId = _client.NetworkId, + ClientId = _client.ClientId, + CurrentAlias = new EFAlias() + { + Name = _client.CurrentAlias.Name + }, + Password = _client.Password, + PasswordSalt = _client.PasswordSalt, + Level = _client.Level + }) + .FirstAsync(_client => _client.ClientId == clientId); + } + } + public async Task> GetPrivilegedClients(bool includeName = true) { using (var context = new DatabaseContext(disableTracking: true)) @@ -478,7 +502,7 @@ namespace SharedLibraryCore.Services // want to find them by name (wildcard) else { - iqLinkIds = iqLinkIds.Where(_alias => EF.Functions.Like(_alias.Name.ToLower(), $"%{identifier.ToLower()}%")); + iqLinkIds = iqLinkIds.Where(_alias => EF.Functions.Like((_alias.SearchableName ?? _alias.Name.ToLower()), $"%{identifier.ToLower()}%")); } var linkIds = await iqLinkIds @@ -489,7 +513,7 @@ namespace SharedLibraryCore.Services var iqClients = context.Clients .Where(_client => _client.Active); - + iqClients = iqClients.Where(_client => networkId == _client.NetworkId || linkIds.Contains(_client.AliasLinkId)); // we want to project our results diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index 1b898b60e..4568467f8 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -146,12 +146,16 @@ namespace SharedLibraryCore } str = Regex.Replace(str, @"(\^+((?![a-z]|[A-Z]).){0,1})+", ""); - string str2 = Regex.Match(str, @"(^\/+.*$)|(^.*\/+$)") - .Value - .Replace("/", " /"); - return str2.Length > 0 ? str2 : str; + return str; } + /// + /// returns a "fixed" string that prevents message truncation in IW4 (and probably other Q3 clients) + /// + /// + /// + public static string FixIW4ForwardSlash(this string str) => Regex.Match(str, @"(^\/+.*$)|(^.*\/+$)").Value.Replace("/", " /"); + /// /// Get the IW Engine color code corresponding to an admin level /// diff --git a/WebfrontCore/Controllers/AccountController.cs b/WebfrontCore/Controllers/AccountController.cs index 1dc816aae..876841ff2 100644 --- a/WebfrontCore/Controllers/AccountController.cs +++ b/WebfrontCore/Controllers/AccountController.cs @@ -25,7 +25,7 @@ namespace WebfrontCore.Controllers try { - var privilegedClient = await Manager.GetClientService().Get(clientId); + var privilegedClient = await Manager.GetClientService().GetClientForLogin(clientId); bool loginSuccess = false; #if DEBUG loginSuccess = clientId == 1; diff --git a/WebfrontCore/Controllers/BaseController.cs b/WebfrontCore/Controllers/BaseController.cs index 0b087339d..2691ff0cc 100644 --- a/WebfrontCore/Controllers/BaseController.cs +++ b/WebfrontCore/Controllers/BaseController.cs @@ -52,6 +52,7 @@ namespace WebfrontCore.Controllers ViewBag.Version = Manager.Version; ViewBag.IsFluid = false; + ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes; } public override void OnActionExecuting(ActionExecutingContext context) @@ -113,6 +114,7 @@ namespace WebfrontCore.Controllers ViewBag.Pages = Pages; ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex; ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin"; + ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes; base.OnActionExecuting(context); } diff --git a/WebfrontCore/Controllers/ClientController.cs b/WebfrontCore/Controllers/ClientController.cs index 842a03d6e..90eac9e8f 100644 --- a/WebfrontCore/Controllers/ClientController.cs +++ b/WebfrontCore/Controllers/ClientController.cs @@ -90,12 +90,13 @@ namespace WebfrontCore.Controllers clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.Sensitive)); - ViewBag.Title = clientDto.Name.Substring(clientDto.Name.Length - 1).ToLower()[0] == 's' ? - clientDto.Name + "'" : - clientDto.Name + "'s"; + string strippedName = clientDto.Name.StripColors(); + ViewBag.Title = strippedName.Substring(strippedName.Length - 1).ToLower()[0] == 's' ? + strippedName + "'" : + strippedName + "'s"; ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"]; - ViewBag.Description = $"Client information for {clientDto.Name}"; - ViewBag.Keywords = $"IW4MAdmin, client, profile, {clientDto.Name}"; + ViewBag.Description = $"Client information for {strippedName}"; + ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}"; return View("Profile/Index", clientDto); } @@ -130,7 +131,6 @@ namespace WebfrontCore.Controllers return View("Privileged/Index", adminsDict); } - public async Task FindAsync(string clientName) { if (string.IsNullOrWhiteSpace(clientName)) diff --git a/WebfrontCore/Controllers/DynamicFileController.cs b/WebfrontCore/Controllers/DynamicFileController.cs index c0425ef4f..1cf5b5896 100644 --- a/WebfrontCore/Controllers/DynamicFileController.cs +++ b/WebfrontCore/Controllers/DynamicFileController.cs @@ -16,16 +16,18 @@ namespace WebfrontCore.Controllers { if (fileName.EndsWith(".css")) { +#if DEBUG + string cssData = await System.IO.File.ReadAllTextAsync($"X:\\IW4MAdmin\\WebfrontCore\\wwwroot\\css\\{fileName}"); + cssData = await Manager.MiddlewareActionHandler.Execute(cssData, "custom_css_accent"); + return Content(cssData, "text/css"); +#endif if (!_fileCache.ContainsKey(fileName)) { -#if DEBUG - string path = $"X:\\IW4MAdmin\\WebfrontCore\\wwwroot\\css\\{fileName}"; -#else + string path = $"wwwroot\\css\\{fileName}"; -#endif - string cssData = await System.IO.File.ReadAllTextAsync(path); - cssData = await Manager.MiddlewareActionHandler.Execute(cssData, "custom_css_accent"); - _fileCache.Add(fileName, cssData); + string data = await System.IO.File.ReadAllTextAsync(path); + data = await Manager.MiddlewareActionHandler.Execute(data, "custom_css_accent"); + _fileCache.Add(fileName, data); } return Content(_fileCache[fileName], "text/css"); diff --git a/WebfrontCore/TagHelpers/ColorCode.cs b/WebfrontCore/TagHelpers/ColorCode.cs new file mode 100644 index 000000000..52da35df1 --- /dev/null +++ b/WebfrontCore/TagHelpers/ColorCode.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; +using SharedLibraryCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace WebfrontCore.TagHelpers +{ + [HtmlTargetElement("color-code")] + public class ColorCode : TagHelper + { + public string Value { get; set; } + public bool Allow { get; set; } = false; + + public override void Process(TagHelperContext context, TagHelperOutput output) + { + output.TagName = "ColorCode"; + output.TagMode = TagMode.StartTagAndEndTag; + + if (Allow) + { + string updated = Value; + + foreach (Match match in Regex.Matches(Value, @"\^([0-9]|\:)([^\^]*)")) + { + char colorCode = match.Groups[1].ToString().Last(); + updated = updated.Replace(match.Value, $"{match.Groups[2].ToString()}"); + } + + output.PreContent.SetHtmlContent(updated); + } + + else + { + output.PreContent.SetHtmlContent(Value.StripColors()); + } + } + } +} diff --git a/WebfrontCore/Views/Client/Find/Index.cshtml b/WebfrontCore/Views/Client/Find/Index.cshtml index dafd3fd39..45387ec54 100644 --- a/WebfrontCore/Views/Client/Find/Index.cshtml +++ b/WebfrontCore/Views/Client/Find/Index.cshtml @@ -15,7 +15,11 @@ @foreach (var client in Model) {
-
@Html.ActionLink(client.Name, "ProfileAsync", "Client", new { id = client.ClientId })
+
+ + + +
@client.Level
@client.LastConnectionText
@@ -32,7 +36,11 @@
@loc["WEBFRONT_SEARCH_LAST_CONNECTED"]
-
@Html.ActionLink(client.Name, "ProfileAsync", "Client", new { id = client.ClientId },new { @class = "link-inverse" } )
+
+ + + +
@client.Level
@client.LastConnectionText
diff --git a/WebfrontCore/Views/Client/Privileged/Index.cshtml b/WebfrontCore/Views/Client/Privileged/Index.cshtml index 2a3565d98..f29f32ce4 100644 --- a/WebfrontCore/Views/Client/Privileged/Index.cshtml +++ b/WebfrontCore/Views/Client/Privileged/Index.cshtml @@ -13,7 +13,10 @@
@foreach (var client in Model[key]) { - @Html.ActionLink(client.Name, "profileasync", "client", new { id = client.ClientId }, new { @class = "" })
+ + + +
}
} diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 6127e300b..e43e3d239 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -25,7 +25,7 @@
-
@Model.Name
+
@if (ViewBag.Authorized) {
@@ -40,7 +40,7 @@ } @foreach (string alias in Model.Aliases) { - @alias
+
} @foreach (string ip in Model.IPs) @@ -89,7 +89,7 @@ @foreach (var meta in metaColumn) {
- @meta.Value + @meta.Key
} diff --git a/WebfrontCore/Views/Console/Index.cshtml b/WebfrontCore/Views/Console/Index.cshtml index f832baac4..a1281199a 100644 --- a/WebfrontCore/Views/Console/Index.cshtml +++ b/WebfrontCore/Views/Console/Index.cshtml @@ -2,7 +2,7 @@
- @Html.DropDownList("Server", Model.Select(s => new SelectListItem() { Text = s.Name, Value = s.ID.ToString() }).ToList(), new { @class = "form-control bg-dark text-light", id = "console_server_select" }) + @Html.DropDownList("Server", Model.Select(s => new SelectListItem() { Text = SharedLibraryCore.Utilities.StripColors(s.Name), Value = s.ID.ToString() }).ToList(), new { @class = "form-control bg-dark text-light", id = "console_server_select" })
diff --git a/WebfrontCore/Views/Penalty/_Penalty.cshtml b/WebfrontCore/Views/Penalty/_Penalty.cshtml index 9c3b69b11..689b7fd25 100644 --- a/WebfrontCore/Views/Penalty/_Penalty.cshtml +++ b/WebfrontCore/Views/Penalty/_Penalty.cshtml @@ -8,7 +8,9 @@ @loc["WEBFRONT_PENALTY_TEMPLATE_NAME"] - @Html.ActionLink(Model.OffenderName, "ProfileAsync", "Client", new { id = Model.OffenderId }, new { @class = "link-inverse" }) + + + @@ -22,14 +24,14 @@ @loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"] - @($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}") + @loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"] - @Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel }) + @Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel }) @@ -51,16 +53,18 @@ - @Html.ActionLink(Model.OffenderName, "ProfileAsync", "Client", new { id = Model.OffenderId }, new { @class = "link-inverse" }) + + + @Model.PenaltyType - @($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}") + - @Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel }) + @Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + (int)Model.PunisherLevel }) @{ diff --git a/WebfrontCore/Views/Server/_ClientActivity.cshtml b/WebfrontCore/Views/Server/_ClientActivity.cshtml index 0101933db..5e8e355d0 100644 --- a/WebfrontCore/Views/Server/_ClientActivity.cshtml +++ b/WebfrontCore/Views/Server/_ClientActivity.cshtml @@ -41,7 +41,10 @@ continue; } string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].LevelInt}"; - @Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId }, new { @class = levelColorClass })
+ + + +
} }
@@ -54,7 +57,10 @@ continue; } string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].LevelInt}"; - @Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId }, new { @class = levelColorClass })
+ + + +
} }
@@ -86,7 +92,12 @@ } if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED") { - @Model.ChatHistory[i].Name — @Model.ChatHistory[i].Message.Substring(0, Math.Min(65, Model.ChatHistory[i].Message.Length))
+ + + + — + +
} } } diff --git a/WebfrontCore/Views/Server/_Server.cshtml b/WebfrontCore/Views/Server/_Server.cshtml index 38d451452..e2192de92 100644 --- a/WebfrontCore/Views/Server/_Server.cshtml +++ b/WebfrontCore/Views/Server/_Server.cshtml @@ -5,7 +5,7 @@
- @Model.Name + diff --git a/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml b/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml index fc4f2af5e..b5a6a0451 100644 --- a/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml +++ b/WebfrontCore/Views/Shared/Components/Client/_RecentClients.cshtml @@ -39,7 +39,9 @@ {
diff --git a/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml b/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml index 182a4d9fd..14f79a053 100644 --- a/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml +++ b/WebfrontCore/Views/Shared/Components/ProfileMetaList/_List.cshtml @@ -51,18 +51,17 @@ } @switch (meta.Type) - { - - case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage: - case SharedLibraryCore.Dtos.ProfileMeta.MetaType.QuickMessage: + { + case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage: + case SharedLibraryCore.Dtos.ProfileMeta.MetaType.QuickMessage:
> - @meta.Value +
break; case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ReceivedPenalty: case SharedLibraryCore.Dtos.ProfileMeta.MetaType.Penalized: -
@Html.Raw(formatPenalty(meta))
+
break; } } \ No newline at end of file diff --git a/WebfrontCore/Views/_ViewImports.cshtml b/WebfrontCore/Views/_ViewImports.cshtml index d2e8b7fbe..1d3cc13bc 100644 --- a/WebfrontCore/Views/_ViewImports.cshtml +++ b/WebfrontCore/Views/_ViewImports.cshtml @@ -1,2 +1,3 @@ @using WebfrontCore @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, WebfrontCore \ No newline at end of file diff --git a/WebfrontCore/wwwroot/css/main.scss b/WebfrontCore/wwwroot/css/main.scss index dfc64d5ba..d04b78dae 100644 --- a/WebfrontCore/wwwroot/css/main.scss +++ b/WebfrontCore/wwwroot/css/main.scss @@ -264,3 +264,73 @@ form *, select { background-size: contain; background-repeat: no-repeat } + +.text-color-code-0 { + color: $dark; +} + +.text-color-code-1 { + color: $red; +} + +.text-color-code-2 { + color: $green; +} + +.text-color-code-3 { + color: $yellow; +} + +.text-color-code-4 { + color: $blue; +} + +.text-color-code-5 { + color: $teal; +} + +.text-color-code-5 { + color: $purple; +} + +.text-color-code-7 { + color: $white; +} + +.text-color-code-8, .text-color-code-9 { + color: grey; +} + +.text-color-code-58 { + animation: color-change 60s infinite; +} + +@keyframes color-change { + 0% { + color: #ff0000; + } + + 16.66% { + color: #ffff00; + } + + 33.33% { + color: #00ff00; + } + + 50% { + color: #00ffff; + } + + 66.66% { + color: #0000ff; + } + + 83.33% { + color: #ff00ff; + } + + 100% { + color: #ff0000; + } +}