From 823b1e1fa27ca65e510e56b01aa2e5986ff2ff1d Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 22 Jan 2022 22:09:52 -0500 Subject: [PATCH] Add support to show missing icon hashes --- ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml | 6 +++++- ProjectLighthouse/Types/Settings/ServerSettings.cs | 4 +++- ProjectLighthouse/Types/User.cs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml b/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml index 7e928da1..27ecbc10 100644 --- a/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml +++ b/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml @@ -1,5 +1,6 @@ @using LBPUnion.ProjectLighthouse @using LBPUnion.ProjectLighthouse.Types +@using LBPUnion.ProjectLighthouse.Types.Settings @using Microsoft.EntityFrameworkCore @model LBPUnion.ProjectLighthouse.Types.Levels.Slot @@ -22,9 +23,12 @@ string callbackUrl = (string)ViewData["CallbackUrl"]; bool showLink = (bool?)ViewData["ShowLink"] ?? false; + + string iconHash = Model.IconHash; + if (string.IsNullOrWhiteSpace(iconHash) || iconHash.StartsWith('g')) iconHash = ServerSettings.Instance.MissingIconHash; }
-
+
@if (showLink) diff --git a/ProjectLighthouse/Types/Settings/ServerSettings.cs b/ProjectLighthouse/Types/Settings/ServerSettings.cs index 97ff5c2c..ad83f781 100644 --- a/ProjectLighthouse/Types/Settings/ServerSettings.cs +++ b/ProjectLighthouse/Types/Settings/ServerSettings.cs @@ -12,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings; [Serializable] public class ServerSettings { - public const int CurrentConfigVersion = 17; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE! + public const int CurrentConfigVersion = 18; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE! private static FileSystemWatcher fileWatcher; static ServerSettings() { @@ -145,6 +145,8 @@ public class ServerSettings public bool ConfigReloading { get; set; } = true; + public string MissingIconHash { get; set; } = ""; + #region Meta [NotNull] diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 4ffcca3d..42eae3ff 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -33,6 +33,7 @@ public class User if (string.IsNullOrWhiteSpace(avatarHash) || this.IconHash.StartsWith('g')) avatarHash = this.YayHash; if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.MehHash; if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.BooHash; + if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = ServerSettings.Instance.MissingIconHash; return avatarHash; }