mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-30 00:38:38 +00:00
Fix all compiler warnings
This commit is contained in:
parent
ce5e327011
commit
b9a310ef90
9 changed files with 27 additions and 31 deletions
|
@ -73,7 +73,7 @@ public class GameServerStartup
|
||||||
async (context, next) =>
|
async (context, next) =>
|
||||||
{
|
{
|
||||||
// Client digest check.
|
// Client digest check.
|
||||||
if (!context.Request.Cookies.TryGetValue("MM_AUTH", out string authCookie)) authCookie = string.Empty;
|
if (!context.Request.Cookies.TryGetValue("MM_AUTH", out string? authCookie) || authCookie == null) authCookie = string.Empty;
|
||||||
string digestPath = context.Request.Path;
|
string digestPath = context.Request.Path;
|
||||||
Stream body = context.Request.Body;
|
Stream body = context.Request.Body;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
HttpUtility.HtmlDecode(comment.getComment(), messageWriter);
|
HttpUtility.HtmlDecode(comment.getComment(), messageWriter);
|
||||||
|
|
||||||
string decodedMessage = messageWriter.ToString();
|
string decodedMessage = messageWriter.ToString();
|
||||||
string url = Url.RouteUrl(ViewContext.RouteData.Values);
|
string? url = Url.RouteUrl(ViewContext.RouteData.Values);
|
||||||
|
if (url == null) continue;
|
||||||
|
|
||||||
int rating = comment.ThumbsUp - comment.ThumbsDown;
|
int rating = comment.ThumbsUp - comment.ThumbsDown;
|
||||||
|
|
||||||
|
|
|
@ -5,24 +5,17 @@
|
||||||
@model LBPUnion.ProjectLighthouse.Types.Levels.Slot
|
@model LBPUnion.ProjectLighthouse.Types.Levels.Slot
|
||||||
|
|
||||||
@{
|
@{
|
||||||
User user = (User)ViewData["User"];
|
User user = (User)ViewData["User"]!;
|
||||||
|
|
||||||
await using Database database = new();
|
await using Database database = new();
|
||||||
|
|
||||||
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
||||||
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
||||||
|
|
||||||
bool isQueued = false;
|
bool isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||||
bool isHearted = false;
|
bool isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
||||||
|
|
||||||
if (user != null)
|
string callbackUrl = (string)ViewData["CallbackUrl"]!;
|
||||||
{
|
|
||||||
isQueued = await database.QueuedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
|
||||||
|
|
||||||
isHearted = await database.HeartedLevels.FirstOrDefaultAsync(h => h.SlotId == Model.SlotId && h.UserId == user.UserId) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
string callbackUrl = (string)ViewData["CallbackUrl"];
|
|
||||||
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
bool showLink = (bool?)ViewData["ShowLink"] ?? false;
|
||||||
|
|
||||||
string iconHash = Model.IconHash;
|
string iconHash = Model.IconHash;
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
|
|
||||||
@if (Model.PageNumber != 0)
|
@if (Model.PageNumber != 0)
|
||||||
{
|
{
|
||||||
<a href="/photos/@(Model.PageNumber - 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
<a href="/photos/@(Model.PageNumber - 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
||||||
}
|
}
|
||||||
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
||||||
@if (Model.PageNumber < Model.PageAmount - 1)
|
@if (Model.PageNumber < Model.PageAmount - 1)
|
||||||
{
|
{
|
||||||
<a href="/photos/@(Model.PageNumber + 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
<a href="/photos/@(Model.PageNumber + 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@ public class RegisterForm : BaseLayout
|
||||||
public RegisterForm(Database database) : base(database)
|
public RegisterForm(Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public string Error { get; private set; }
|
public string? Error { get; private set; }
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
[SuppressMessage("ReSharper", "SpecifyStringComparison")]
|
[SuppressMessage("ReSharper", "SpecifyStringComparison")]
|
||||||
|
@ -54,7 +54,7 @@ public class RegisterForm : BaseLayout
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ServerConfiguration.Instance.Mail.MailEnabled &&
|
if (ServerConfiguration.Instance.Mail.MailEnabled &&
|
||||||
await this.Database.Users.FirstOrDefaultAsync(u => u.EmailAddress.ToLower() == emailAddress.ToLower()) != null)
|
await this.Database.Users.FirstOrDefaultAsync(u => u.EmailAddress != null && u.EmailAddress.ToLower() == emailAddress.ToLower()) != null)
|
||||||
{
|
{
|
||||||
this.Error = "The email address you've chosen is already taken.";
|
this.Error = "The email address you've chosen is already taken.";
|
||||||
return this.Page();
|
return this.Page();
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.ShowTitleInPage = false;
|
Model.ShowTitleInPage = false;
|
||||||
|
|
||||||
Model.Title = Model.Slot.Name;
|
Model.Title = Model.Slot?.Name ?? "";
|
||||||
Model.Description = Model.Slot.Description;
|
Model.Description = Model.Slot?.Description ?? "";
|
||||||
|
|
||||||
bool isMobile = this.Request.IsMobile();
|
bool isMobile = this.Request.IsMobile();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"User", Model.User
|
"User", Model.User
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"CallbackUrl", $"~/slot/{Model.Slot.SlotId}"
|
"CallbackUrl", $"~/slot/{Model.Slot?.SlotId}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ShowLink", false
|
"ShowLink", false
|
||||||
|
@ -37,14 +37,15 @@
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<div class="ui blue segment">
|
<div class="ui blue segment">
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
<p>@HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model.Slot.Description) ? "This level has no description." : Model.Slot.Description)</p>
|
<p>@HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model.Slot?.Description) ? "This level has no description." : Model.Slot.Description)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<div class="ui red segment">
|
<div class="ui red segment">
|
||||||
<h2>Tags</h2>
|
<h2>Tags</h2>
|
||||||
@{
|
@{
|
||||||
string[] authorLabels = Model.Slot.AuthorLabels.Split(",");
|
string[] authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? new string[]
|
||||||
|
{};
|
||||||
if (authorLabels.Length == 1) // ..?? ok c#
|
if (authorLabels.Length == 1) // ..?? ok c#
|
||||||
{
|
{
|
||||||
<p>This level has no tags.</p>
|
<p>This level has no tags.</p>
|
||||||
|
@ -86,13 +87,13 @@
|
||||||
@for(int i = 0; i < Model.Reviews.Count; i++)
|
@for(int i = 0; i < Model.Reviews.Count; i++)
|
||||||
{
|
{
|
||||||
Review review = Model.Reviews[i];
|
Review review = Model.Reviews[i];
|
||||||
string faceHash = review.Thumb switch {
|
string faceHash = (review.Thumb switch {
|
||||||
-1 => review.Reviewer?.BooHash,
|
-1 => review.Reviewer?.BooHash,
|
||||||
0 => review.Reviewer?.MehHash,
|
0 => review.Reviewer?.MehHash,
|
||||||
1 => review.Reviewer?.YayHash,
|
1 => review.Reviewer?.YayHash,
|
||||||
|
|
||||||
_ => throw new ArgumentOutOfRangeException(),
|
_ => throw new ArgumentOutOfRangeException(),
|
||||||
};
|
}) ?? "";
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(faceHash))
|
if (string.IsNullOrWhiteSpace(faceHash))
|
||||||
{
|
{
|
||||||
|
@ -168,7 +169,7 @@
|
||||||
<div class="ui yellow segment">
|
<div class="ui yellow segment">
|
||||||
<h2>Admin Options</h2>
|
<h2>Admin Options</h2>
|
||||||
|
|
||||||
@if (Model.Slot.TeamPick)
|
@if (Model.Slot?.TeamPick ?? false)
|
||||||
{
|
{
|
||||||
<a href="/admin/slot/@Model.Slot.SlotId/removeTeamPick">
|
<a href="/admin/slot/@Model.Slot.SlotId/removeTeamPick">
|
||||||
<div class="ui pink button">
|
<div class="ui pink button">
|
||||||
|
@ -179,7 +180,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a href="/admin/slot/@Model.Slot.SlotId/teamPick">
|
<a href="/admin/slot/@Model.Slot?.SlotId/teamPick">
|
||||||
<div class="ui pink button">
|
<div class="ui pink button">
|
||||||
<i class="ribbon icon"></i>
|
<i class="ribbon icon"></i>
|
||||||
<span>Team Pick</span>
|
<span>Team Pick</span>
|
||||||
|
@ -187,7 +188,7 @@
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
<a href="/admin/slot/@Model.Slot.SlotId/delete">
|
<a href="/admin/slot/@Model.Slot?.SlotId/delete">
|
||||||
<div class="ui red button">
|
<div class="ui red button">
|
||||||
<i class="trash icon"></i>
|
<i class="trash icon"></i>
|
||||||
<span>Delete</span>
|
<span>Delete</span>
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
|
|
||||||
@if (Model.PageNumber != 0)
|
@if (Model.PageNumber != 0)
|
||||||
{
|
{
|
||||||
<a href="/slots/@(Model.PageNumber - 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
<a href="/slots/@(Model.PageNumber - 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
||||||
}
|
}
|
||||||
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
||||||
@if (Model.PageNumber < Model.PageAmount - 1)
|
@if (Model.PageNumber < Model.PageAmount - 1)
|
||||||
{
|
{
|
||||||
<a href="/slots/@(Model.PageNumber + 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
<a href="/slots/@(Model.PageNumber + 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
||||||
}
|
}
|
|
@ -36,10 +36,10 @@
|
||||||
|
|
||||||
@if (Model.PageNumber != 0)
|
@if (Model.PageNumber != 0)
|
||||||
{
|
{
|
||||||
<a href="/users/@(Model.PageNumber - 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
<a href="/users/@(Model.PageNumber - 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
|
||||||
}
|
}
|
||||||
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
||||||
@if (Model.PageNumber < Model.PageAmount - 1)
|
@if (Model.PageNumber < Model.PageAmount - 1)
|
||||||
{
|
{
|
||||||
<a href="/users/@(Model.PageNumber + 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
<a href="/users/@(Model.PageNumber + 1)@(Model.SearchValue?.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
|
||||||
}
|
}
|
|
@ -44,6 +44,7 @@ public class DebugWarmupLifetime : IHostLifetime
|
||||||
ServerType.GameApi => ServerConfiguration.Instance.GameApiListenUrl,
|
ServerType.GameApi => ServerConfiguration.Instance.GameApiListenUrl,
|
||||||
ServerType.Website => ServerConfiguration.Instance.WebsiteListenUrl,
|
ServerType.Website => ServerConfiguration.Instance.WebsiteListenUrl,
|
||||||
ServerType.Api => ServerConfiguration.Instance.ApiListenUrl,
|
ServerType.Api => ServerConfiguration.Instance.ApiListenUrl,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(),
|
||||||
};
|
};
|
||||||
|
|
||||||
url = url.Replace("0.0.0.0", "127.0.0.1");
|
url = url.Replace("0.0.0.0", "127.0.0.1");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue