Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using LBPUnion.ProjectLighthouse.Configuration;
using LBPUnion.ProjectLighthouse.Database;
using LBPUnion.ProjectLighthouse.Filter;
using LBPUnion.ProjectLighthouse.Filter.Filters;
Expand Down Expand Up @@ -113,13 +114,15 @@ public async Task<IActionResult> GetPlayerCountsByPlatform()
}

/// <summary>
/// Gets a list of online players
/// Gets a list of online players
/// </summary>
/// <returns>An instance of PlayerListResponse</returns>
[HttpGet("players")]
[ProducesResponseType(typeof(PlayerListResponse), StatusCodes.Status200OK)]
public async Task<IActionResult> GetPlayerList()
{
if (!ServerConfiguration.Instance.WebsiteConfiguration.ShowOnlinePlayers) return this.NotFound();

List<PlayerListObject> players = await this.database.LastContacts.Where(l => TimeHelper.Timestamp - l.Timestamp < 300)
.Select(l => new PlayerListObject
{
Expand Down
17 changes: 10 additions & 7 deletions ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,18 @@
}

@{
int i = 0;
foreach (UserEntity user in Model.PlayersOnline)
if (ServerConfiguration.Instance.WebsiteConfiguration.ShowOnlinePlayers)
{
i++;
@await user.ToLink(Html, ViewData, language, timeZone, true)
@* whitespace has forced my hand *@
if (i != Model.PlayersOnline.Count)
int i = 0;
foreach (UserEntity user in Model.PlayersOnline)
{
<span>,</span>
i++;
@await user.ToLink(Html, ViewData, language, timeZone, true)
@* whitespace has forced my hand *@
if (i != Model.PlayersOnline.Count)
{
<span>,</span>
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ public class WebsiteConfiguration

public bool ConvertAssetsOnStartup { get; set; } = true;

/*
* Decides whether or not to display the Lighthouse Pride logo
* during the month of June if enabled.
*/
/// <summary>
/// Displays the Lighthouse Pride logo during the month of June.
/// </summary>
public bool PrideEventEnabled { get; set; } = true;

public bool ShowOnlinePlayers { get; set; } = true;
}
2 changes: 1 addition & 1 deletion ProjectLighthouse/Configuration/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ServerConfiguration : ConfigurationBase<ServerConfiguration>
// This is so Lighthouse can properly identify outdated configurations and update them with newer settings accordingly.
// If you are modifying anything here, this value MUST be incremented.
// Thanks for listening~
public override int ConfigVersion { get; set; } = 31;
public override int ConfigVersion { get; set; } = 32;

public override string ConfigName { get; set; } = "lighthouse.yml";
public string WebsiteListenUrl { get; set; } = "http://localhost:10060";
Expand Down
Loading