Add support to show missing icon hashes

This commit is contained in:
jvyden 2022-01-22 22:09:52 -05:00
commit 823b1e1fa2
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
3 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,6 @@
@using LBPUnion.ProjectLighthouse @using LBPUnion.ProjectLighthouse
@using LBPUnion.ProjectLighthouse.Types @using LBPUnion.ProjectLighthouse.Types
@using LBPUnion.ProjectLighthouse.Types.Settings
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@model LBPUnion.ProjectLighthouse.Types.Levels.Slot @model LBPUnion.ProjectLighthouse.Types.Levels.Slot
@ -22,9 +23,12 @@
string callbackUrl = (string)ViewData["CallbackUrl"]; string callbackUrl = (string)ViewData["CallbackUrl"];
bool showLink = (bool?)ViewData["ShowLink"] ?? false; bool showLink = (bool?)ViewData["ShowLink"] ?? false;
string iconHash = Model.IconHash;
if (string.IsNullOrWhiteSpace(iconHash) || iconHash.StartsWith('g')) iconHash = ServerSettings.Instance.MissingIconHash;
} }
<div style="display: flex; width: 100%;"> <div style="display: flex; width: 100%;">
<div style="margin-right: 10px; background-image: url('/gameAssets/@Model.IconHash'); height: 100px; width: 100px; background-size: cover; background-position: center; border-radius: 100%;"> <div style="margin-right: 10px; background-image: url('/gameAssets/@iconHash'); height: 100px; width: 100px; background-size: cover; background-position: center; border-radius: 100%;">
</div> </div>
<div style="height: fit-content; vertical-align: center; align-self: center"> <div style="height: fit-content; vertical-align: center; align-self: center">
@if (showLink) @if (showLink)

View file

@ -12,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings;
[Serializable] [Serializable]
public class ServerSettings 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; private static FileSystemWatcher fileWatcher;
static ServerSettings() static ServerSettings()
{ {
@ -145,6 +145,8 @@ public class ServerSettings
public bool ConfigReloading { get; set; } = true; public bool ConfigReloading { get; set; } = true;
public string MissingIconHash { get; set; } = "";
#region Meta #region Meta
[NotNull] [NotNull]

View file

@ -33,6 +33,7 @@ public class User
if (string.IsNullOrWhiteSpace(avatarHash) || this.IconHash.StartsWith('g')) avatarHash = this.YayHash; if (string.IsNullOrWhiteSpace(avatarHash) || this.IconHash.StartsWith('g')) avatarHash = this.YayHash;
if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.MehHash; if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.MehHash;
if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.BooHash; if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = this.BooHash;
if (string.IsNullOrWhiteSpace(avatarHash)) avatarHash = ServerSettings.Instance.MissingIconHash;
return avatarHash; return avatarHash;
} }