start add of join button (still need to grab the external IP address)
finish up fixes for alias stuff
This commit is contained in:
parent
8667532d24
commit
dd82a5e3fa
@ -66,8 +66,6 @@ namespace IW4MAdmin
|
||||
client.CurrentServer = this;
|
||||
|
||||
Clients[client.ClientNumber] = client;
|
||||
|
||||
client.State = ClientState.Connected;
|
||||
#if DEBUG == true
|
||||
Logger.WriteDebug($"End PreConnect for {client}");
|
||||
#endif
|
||||
@ -80,6 +78,7 @@ namespace IW4MAdmin
|
||||
|
||||
Manager.GetEventHandler().AddEvent(e);
|
||||
await client.OnJoin(client.IPAddress);
|
||||
client.State = ClientState.Connected;
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
@ -460,7 +459,7 @@ namespace IW4MAdmin
|
||||
|
||||
private async Task OnClientUpdate(EFClient origin)
|
||||
{
|
||||
var client = Clients.FirstOrDefault(_client => _client.Equals(origin));
|
||||
var client = GetClientsAsList().FirstOrDefault(_client => _client.Equals(origin));
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
@ -468,7 +467,9 @@ namespace IW4MAdmin
|
||||
client.Score = origin.Score;
|
||||
|
||||
// update their IP if it hasn't been set yet
|
||||
if (client.IPAddress == null && !client.IsBot)
|
||||
if (client.IPAddress == null &&
|
||||
!client.IsBot &&
|
||||
client.State == ClientState.Connected)
|
||||
{
|
||||
await client.OnJoin(origin.IPAddress);
|
||||
}
|
||||
|
@ -19,5 +19,6 @@ namespace SharedLibraryCore.Dtos
|
||||
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
||||
public long ID { get; set; }
|
||||
public bool Online { get; set; }
|
||||
public string ConnectProtocolUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ namespace SharedLibraryCore.Services
|
||||
// this happens when the link we found is different than the one we create before adding an IP
|
||||
if (isAliasLinkUpdated)
|
||||
{
|
||||
entity.CurrentServer.Logger.WriteDebug($"found a link for {entity} so we are updating link from {entity.AliasLink.AliasLinkId} to {newAliasLink.AliasLinkId}");
|
||||
entity.CurrentServer.Logger.WriteDebug($"[updatealias] found a link for {entity} so we are updating link from {entity.AliasLink.AliasLinkId} to {newAliasLink.AliasLinkId}");
|
||||
|
||||
var oldAliasLink = entity.AliasLink;
|
||||
|
||||
@ -161,7 +161,7 @@ namespace SharedLibraryCore.Services
|
||||
// the existing alias matches ip and name, so we can just ignore the temporary one
|
||||
if (hasExactAliasMatch)
|
||||
{
|
||||
entity.CurrentServer.Logger.WriteDebug($"{entity} has exact alias match");
|
||||
entity.CurrentServer.Logger.WriteDebug($"[updatealias] {entity} has exact alias match");
|
||||
|
||||
var oldAlias = entity.CurrentAlias;
|
||||
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||
@ -169,8 +169,9 @@ namespace SharedLibraryCore.Services
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
// the alias is the same so we can just remove it
|
||||
if (oldAlias.AliasId != existingExactAlias.AliasId)
|
||||
if (oldAlias.AliasId != existingExactAlias.AliasId && oldAlias.AliasId > 0)
|
||||
{
|
||||
entity.CurrentServer.Logger.WriteDebug($"[updatealias] {entity} has exact alias match, so we're going to try to remove aliasId {oldAlias.AliasId} with linkId {oldAlias.AliasId}");
|
||||
context.Aliases.Remove(oldAlias);
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
@ -179,7 +180,7 @@ namespace SharedLibraryCore.Services
|
||||
// theres no exact match, but they've played before with the GUID or IP
|
||||
else
|
||||
{
|
||||
entity.CurrentServer.Logger.WriteDebug($"Connecting player is using a new alias {entity}");
|
||||
entity.CurrentServer.Logger.WriteDebug($"[updatealias] {entity} is using a new alias");
|
||||
|
||||
var newAlias = new EFAlias()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
@ -66,11 +66,16 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Client.ClientId = Convert.ToInt32(base.User.Claims.First(c => c.Type == ClaimTypes.Sid).Value);
|
||||
Client.NetworkId = User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertLong();
|
||||
Client.Level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), User.Claims.First(c => c.Type == ClaimTypes.Role).Value);
|
||||
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
||||
Authorized = Client.ClientId >= 0;
|
||||
int clientId = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid)?.Value ?? "-1");
|
||||
|
||||
if (clientId > 0)
|
||||
{
|
||||
Client.ClientId = clientId;
|
||||
Client.NetworkId = User.Claims.First(_claim => _claim.Type == ClaimTypes.PrimarySid).Value.ConvertLong();
|
||||
Client.Level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), User.Claims.First(c => c.Type == ClaimTypes.Role).Value);
|
||||
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
||||
Authorized = Client.ClientId >= 0;
|
||||
}
|
||||
}
|
||||
|
||||
catch (InvalidOperationException)
|
||||
|
@ -36,7 +36,7 @@ namespace WebfrontCore.Controllers
|
||||
LevelInt = (int)p.Level
|
||||
}).ToList(),
|
||||
ChatHistory = s.ChatHistory.ToList(),
|
||||
PlayerHistory = s.ClientHistory.ToArray(),
|
||||
PlayerHistory = s.ClientHistory.ToArray()
|
||||
};
|
||||
return PartialView("_ClientActivity", serverInfo);
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ namespace WebfrontCore.ViewComponents
|
||||
LevelInt = (int)p.Level
|
||||
}).ToList(),
|
||||
ChatHistory = s.ChatHistory.ToList(),
|
||||
Online = !s.Throttled
|
||||
Online = !s.Throttled,
|
||||
ConnectProtocolUrl = s.EventParser.URLProtocolFormat.FormatExt(s.IP, s.GetPort())
|
||||
}).ToList();
|
||||
return View("_List", serverInfo);
|
||||
}
|
||||
|
@ -3,21 +3,21 @@
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="row server-header" id="server_header_@Model.ID">
|
||||
<div class="col-md-4 bg-primary text-center text-md-left">@Model.Name</div>
|
||||
<div class="text-center col-md-4 bg-primary">@Model.Map</div>
|
||||
<div class="text-center text-md-right col-md-4 bg-primary"><span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@Model.MaxClients</span></div>
|
||||
<div class="row server-header pt-1 pb-1 bg-primary " id="server_header_@Model.ID">
|
||||
<div class="col-md-4 text-center text-md-left d-inline-flex justify-content-center justify-content-md-start">
|
||||
<span>@Model.Name</span>
|
||||
<a href="@Model.ConnectProtocolUrl" class="ml-2 align-self-center d-none d-md-flex server-join-button" title="@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
|
||||
<span class="oi oi-play-circle"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-center col-md-4">@Model.Map</div>
|
||||
<div class="text-center text-md-right col-md-4"><span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@Model.MaxClients</span></div>
|
||||
</div>
|
||||
|
||||
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity pt-2 pb-2">
|
||||
<div class="col-4">
|
||||
<div class="oi oi-play-circle h1"></div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
@await Html.PartialAsync("../Server/_ClientActivity", Model)
|
||||
</div>
|
||||
@await Html.PartialAsync("../Server/_ClientActivity", Model)
|
||||
</div>
|
||||
|
||||
<div class="row server-history mb-4">
|
||||
<div class="server-history-row col-md-12" id="server_history_@Model.ID" data-serverid="@Model.ID" data-clienthistory='@Html.Raw(Json.Serialize(Model.PlayerHistory))' data-online="@Model.Online"></div>
|
||||
<div class="server-history-row" id="server_history_@Model.ID" data-serverid="@Model.ID" data-clienthistory='@Html.Raw(Json.Serialize(Model.PlayerHistory))' data-online="@Model.Online"></div>
|
||||
</div>
|
||||
|
@ -6299,6 +6299,9 @@ a.nav-link {
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #007ACC !important; }
|
||||
|
||||
.server-history {
|
||||
background-color: #191919; }
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #007ACC !important; }
|
||||
|
||||
@ -6308,6 +6311,9 @@ a.nav-link {
|
||||
border: 1px solid #fd7e14;
|
||||
color: #fff; }
|
||||
|
||||
.server-join-button, .server-join-button:hover {
|
||||
color: #fff !important; }
|
||||
|
||||
a.link-inverse {
|
||||
color: #007ACC; }
|
||||
|
||||
@ -6413,7 +6419,7 @@ form *, select {
|
||||
.client-rating-change-amount {
|
||||
font-size: 1rem; }
|
||||
|
||||
.client-message, .automated-penalty-info-detailed {
|
||||
.client-message, .automated-penalty-info-detailed, .oi {
|
||||
cursor: pointer; }
|
||||
|
||||
#footer_text {
|
||||
|
15
WebfrontCore/wwwroot/css/bootstrap-custom.scss
vendored
15
WebfrontCore/wwwroot/css/bootstrap-custom.scss
vendored
@ -8,6 +8,7 @@ $secondary: $orange !default;
|
||||
$light: rgb(204, 204, 204) !default;
|
||||
$dark: rgb(24, 24, 24) !default;
|
||||
$body-bg: rgb(34,34,34) !default;
|
||||
$big-dark: #191919;
|
||||
$body-color: $white !default;
|
||||
$link-color: $white !default;
|
||||
$link-decoration: none !default;
|
||||
@ -67,6 +68,10 @@ a.nav-link {
|
||||
border-bottom: 1px solid $primary !important;
|
||||
}
|
||||
|
||||
.server-history {
|
||||
background-color: $big-dark;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid $primary !important;
|
||||
}
|
||||
@ -78,6 +83,10 @@ a.nav-link {
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.server-join-button, .server-join-button:hover {
|
||||
color: $white !important;
|
||||
}
|
||||
|
||||
a.link-inverse {
|
||||
color: $primary;
|
||||
}
|
||||
@ -216,7 +225,7 @@ form *, select {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.client-message, .automated-penalty-info-detailed {
|
||||
.client-message, .automated-penalty-info-detailed, .oi {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -277,6 +286,6 @@ form *, select {
|
||||
border: 1px solid $orange;
|
||||
}
|
||||
|
||||
.hide {
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user