Skip to content

Commit 27d15c6

Browse files
committed
updated gitgnore, fixed BossknuckleHand updated docker-compose and kingdoms.json and some ui improvements
1 parent 78b0b6c commit 27d15c6

File tree

11 files changed

+519
-239
lines changed

11 files changed

+519
-239
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ Desktop.ini
4646
/.idea/.idea.OdysseyWebServer/.idea/indexLayout.xml
4747
/.idea/.idea.OdysseyWebServer/.idea/projectSettingsUpdater.xml
4848
/.idea/.idea.OdysseyWebServer/.idea/vcs.xml
49+
/OdysseyWebServer/settings.json

OdysseyWebServer/Components/Pages/Authentication/Login.razor

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
<h3>Login</h3>
1616
</div>
1717
<div class="mb-3">
18-
<label>User Name</label>
18+
<label class="form-label">User Name</label>
1919
<InputText @bind-Value="Model.Username" placeholder="username" class="form-control"/>
2020
<ValidationMessage For="() => Model.Username"></ValidationMessage>
2121
</div>
2222
<div class="mb-3">
23-
<label>Password</label>
23+
<label class="form-label">Password</label>
2424
<InputText @bind-Value="Model.Password" placeholder="password" class="form-control"/>
2525
<ValidationMessage For="() => Model.Password"></ValidationMessage>
2626
</div>
@@ -39,16 +39,6 @@
3939
[SupplyParameterFromForm] public LoginViewModel Model { get; set; } = new();
4040
private string? _errorMessage;
4141

42-
private string? ReturnUrl { get; set; }
43-
44-
protected override void OnInitialized()
45-
{
46-
var uri = Navigation.Uri;
47-
var queryParams = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(new Uri(uri).Query);
48-
49-
ReturnUrl = queryParams.TryGetValue("ReturnUrl", out var returnUrl) ? returnUrl.ToString() : "/";
50-
}
51-
5242
private async Task Authenticate()
5343
{
5444
if (Model.Username != Configuration.UserName || Model.Password != Configuration.Password)
@@ -66,6 +56,6 @@
6656
var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
6757
var principal = new ClaimsPrincipal(identity);
6858
await HttpContext!.SignInAsync(principal);
69-
Navigation.NavigateTo(ReturnUrl ?? "/");
59+
Navigation.NavigateTo("/dashboard");
7060
}
7161
}

OdysseyWebServer/Components/Pages/ConsoleDisplay.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77

88
<PageTitle>Console - @Configuration.ServerName</PageTitle>
9-
<h3>Console</h3>
109

11-
<div class="console">
12-
<div class="console-output">
10+
<div>
11+
<h3>Console</h3>
12+
<div>
1313
@foreach (var line in _output)
1414
{
1515
<div>> @line</div>
@@ -19,9 +19,9 @@
1919
<div class="console-input-container">
2020
<input @bind="_inputText" @bind:event="oninput"
2121
@onkeydown="HandleKeyPress"
22-
class="m-2" placeholder="Enter a Command ..." />
22+
class="m-2" placeholder="Enter a Command ..."/>
2323

24-
<button @onclick="ClearConsole" class="btn-primary">Clear</button>
24+
<button @onclick="ClearConsole" class="btn btn-sm btn-outline-primary">Clear</button>
2525
</div>
2626
</div>
2727

OdysseyWebServer/Components/Pages/Dashboard.razor

Lines changed: 187 additions & 165 deletions
Large diffs are not rendered by default.

OdysseyWebServer/Components/Pages/MapDisplay.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020
</select>
2121

22-
<button @onclick="OnButtonClick" class="btn-primary">Send all to kingdom</button>
22+
<button @onclick="OnButtonClick" class="btn btn-sm btn-outline-primary">Send all to kingdom</button>
2323

2424
<label>
2525
<input type="checkbox" @bind="OriginalScale"/> Original Scale

OdysseyWebServer/Components/Pages/PlayerInfo.razor

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@page "/player/{PlayerId}"
2+
@page "/player"
23
@implements IDisposable
34
@using Microsoft.AspNetCore.Authorization
45
@using OdysseyWebServer.Helper
@@ -10,12 +11,28 @@
1011

1112
@if (_player == null)
1213
{
13-
<p>Loading Player Data</p>
14+
@if (string.IsNullOrEmpty(PlayerId))
15+
{
16+
<div>
17+
<label>Invalid Request. You need to specify a player</label>
18+
</div>
19+
}
20+
else
21+
{
22+
<div>
23+
<label>No Player Data was found yet for @PlayerId</label>
24+
<div class="row justify-content-center">
25+
<div class="col-1">
26+
<div class=" spinner-border ms-3"></div>
27+
</div>
28+
</div>
29+
</div>
30+
}
1431
}
1532
else
1633
{
1734
<div class="row">
18-
<div class="col-md-6 p-3 border">
35+
<div class="col-md-5 p-3">
1936
<h4>@_player.Name</h4>
2037
<p>
2138

@@ -51,40 +68,41 @@ else
5168
<br/>
5269
Is2D: @_player.Is2D
5370
</p>
54-
55-
<label>
56-
<input type="checkbox" @bind="Flip"/> Flip
57-
</label>
58-
</div>
59-
60-
<div class="col-md-6 p-3 border">
61-
<h4>Map</h4>
62-
<div style="height: 512px">
63-
<MapComponent @ref="_mapComponent" Kingdom="@_player.Kingdom"/>
64-
</div>
65-
</div>
66-
</div>
6771

68-
<div class="row">
69-
<div class="col-md-6 p-3 border">
70-
<h4>Capture</h4>
72+
<label>Capture: </label>
73+
<br/>
7174
@if (!string.IsNullOrEmpty(_player.Capture))
7275
{
73-
<img src="@($"images/capture/{_player.Capture}.png")" alt="@_player.Capture" width="100" height="100"/>
76+
<img src="@($"images/capture/{_player.Capture}.png")" alt="@_player.Capture" width="100" height="100"/>
77+
}
78+
else
79+
{
80+
<label>None</label>
7481
}
7582
</div>
76-
77-
<div class="col-md-6 p-3 border">
78-
<h4>Commands</h4>
79-
<div style="display: flex; align-items: center; gap: 10px;">
80-
<button @onclick="OnRejoin" class="btn-primary">Rejoin</button>
81-
<button @onclick="OnBan" class="btn-primary">Ban</button>
82-
<button @onclick="OnCrash" class="btn-primary">Crash</button>
83+
84+
<div class="col-md-7 p-3">
85+
<div class="btn-group">
86+
<button @onclick="OnRejoin" class="btn btn-outline-primary">Rejoin</button>
87+
<button @onclick="OnCrash" class="btn btn-outline-danger">Crash</button>
88+
<button @onclick="OnBan" class="btn btn-outline-danger">Ban</button>
89+
</div>
90+
<label class="ms-2">
91+
<input type="checkbox" @bind="Flip"/> Flip
92+
</label>
93+
<div class="mt-1" style="height: 512px">
94+
<MapComponent @ref="_mapComponent" Kingdom="@_player.Kingdom"/>
8395
</div>
8496
</div>
8597
</div>
8698

87-
<div class="text-center">@NotificationMessage</div>
99+
@if (!string.IsNullOrEmpty(NotificationMessage))
100+
{
101+
<div class="alert alert-info text-center">
102+
<strong>Server:</strong>
103+
@NotificationMessage
104+
</div>
105+
}
88106
}
89107

90108
@code {
@@ -169,7 +187,7 @@ else
169187
StateHasChanged();
170188

171189
_timeState++;
172-
await Task.Delay(3000);
190+
await Task.Delay(6000);
173191
_timeState--;
174192
if (_timeState > 0) return;
175193
NotificationMessage = null;

OdysseyWebServer/Components/Pages/PlayerList.razor

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@using Microsoft.AspNetCore.Authorization
44
@using OdysseyWebServer.Helper
55
@using OdysseyWebServer.ServerCommunication
6+
@inject NavigationManager Navigation
67
@rendermode InteractiveServer
78
@attribute [Authorize(Roles = "Administrator")]
89

@@ -16,31 +17,30 @@
1617
}
1718
else
1819
{
19-
<table class="table table-striped">
20-
<thead>
21-
<tr>
22-
<th>Name</th>
23-
<th>Cap</th>
24-
<th>Body</th>
25-
<th>Position</th>
26-
<th>Map</th>
27-
<th>Tagged</th>
28-
<th>Capture</th>
29-
<th>2D</th>
30-
<th>IPv4</th>
31-
</tr>
32-
</thead>
33-
<tbody>
34-
@foreach (var player in _players)
35-
{
20+
<div class="table-responsive">
21+
<table class="table table-striped table-hover table-responsive">
22+
<thead>
3623
<tr>
37-
<td><NavLink href="@($"/player/{player.ID}")">@player.Name</NavLink></td>
24+
<th>Name</th>
25+
<th>Cap</th>
26+
<th>Body</th>
27+
<th>Position</th>
28+
<th>Map</th>
29+
<th>Tagged</th>
30+
<th>Capture</th>
31+
<th>2D</th>
32+
<th>IPv4</th>
33+
</tr>
34+
</thead>
35+
<tbody>
36+
@foreach (var player in _players)
37+
{
38+
<tr @onclick="() => OnClickEntry(player.ID.ToString())">
39+
<td>@player.Name</td>
3840
<td><img src="@($"images/cap/{player.Costume.Cap}.png")" alt="@player.Costume.Cap" width="100" height="100"/></td>
3941
<td><img src="@($"images/body/{player.Costume.Body}.png")" alt="@player.Costume.Body" width="100" height="100"/></td>
4042
<td>
41-
Map Position: @Cache.GetMapPosition(player).ToString()
42-
<br/>
43-
World Position: @player.Position.ToString()
43+
@player.Position.ToString()
4444
</td>
4545
<td>
4646
@player.Kingdom
@@ -53,15 +53,16 @@ else
5353
<td>
5454
@if (!string.IsNullOrWhiteSpace(player.Capture))
5555
{
56-
<img src="@($"images/capture/{player.Capture}.png")" alt="@player.Capture" width="100" height="100"/>
56+
<img src="@($"images/capture/{player.Capture}.png")" alt="@player.Capture" width="100" height="100"/>
5757
}
5858
</td>
5959
<td>@player.Is2D</td>
6060
<td>@player.IPv4</td>
6161
</tr>
62-
}
63-
</tbody>
64-
</table>
62+
}
63+
</tbody>
64+
</table>
65+
</div>
6566
}
6667

6768
@code {
@@ -86,4 +87,9 @@ else
8687
{
8788
Cache.OnUpdatePlayers -= UpdatePlayers;
8889
}
90+
91+
private void OnClickEntry(string id)
92+
{
93+
Navigation.NavigateTo($"/player/{id}");
94+
}
8995
}

0 commit comments

Comments
 (0)