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;
|
client.CurrentServer = this;
|
||||||
|
|
||||||
Clients[client.ClientNumber] = client;
|
Clients[client.ClientNumber] = client;
|
||||||
|
|
||||||
client.State = ClientState.Connected;
|
|
||||||
#if DEBUG == true
|
#if DEBUG == true
|
||||||
Logger.WriteDebug($"End PreConnect for {client}");
|
Logger.WriteDebug($"End PreConnect for {client}");
|
||||||
#endif
|
#endif
|
||||||
@ -80,6 +78,7 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
Manager.GetEventHandler().AddEvent(e);
|
Manager.GetEventHandler().AddEvent(e);
|
||||||
await client.OnJoin(client.IPAddress);
|
await client.OnJoin(client.IPAddress);
|
||||||
|
client.State = ClientState.Connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -460,7 +459,7 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
private async Task OnClientUpdate(EFClient origin)
|
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)
|
if (client != null)
|
||||||
{
|
{
|
||||||
@ -468,7 +467,9 @@ namespace IW4MAdmin
|
|||||||
client.Score = origin.Score;
|
client.Score = origin.Score;
|
||||||
|
|
||||||
// update their IP if it hasn't been set yet
|
// 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);
|
await client.OnJoin(origin.IPAddress);
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,6 @@ namespace SharedLibraryCore.Dtos
|
|||||||
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
||||||
public long ID { get; set; }
|
public long ID { get; set; }
|
||||||
public bool Online { 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
|
// this happens when the link we found is different than the one we create before adding an IP
|
||||||
if (isAliasLinkUpdated)
|
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;
|
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
|
// the existing alias matches ip and name, so we can just ignore the temporary one
|
||||||
if (hasExactAliasMatch)
|
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;
|
var oldAlias = entity.CurrentAlias;
|
||||||
entity.CurrentAliasId = existingExactAlias.AliasId;
|
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||||
@ -169,8 +169,9 @@ namespace SharedLibraryCore.Services
|
|||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
|
|
||||||
// the alias is the same so we can just remove it
|
// 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);
|
context.Aliases.Remove(oldAlias);
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
@ -179,7 +180,7 @@ namespace SharedLibraryCore.Services
|
|||||||
// theres no exact match, but they've played before with the GUID or IP
|
// theres no exact match, but they've played before with the GUID or IP
|
||||||
else
|
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()
|
var newAlias = new EFAlias()
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -66,11 +66,16 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Client.ClientId = Convert.ToInt32(base.User.Claims.First(c => c.Type == ClaimTypes.Sid).Value);
|
int clientId = Convert.ToInt32(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid)?.Value ?? "-1");
|
||||||
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);
|
if (clientId > 0)
|
||||||
Client.CurrentAlias = new EFAlias() { Name = User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value };
|
{
|
||||||
Authorized = Client.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)
|
catch (InvalidOperationException)
|
||||||
|
@ -36,7 +36,7 @@ namespace WebfrontCore.Controllers
|
|||||||
LevelInt = (int)p.Level
|
LevelInt = (int)p.Level
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
ChatHistory = s.ChatHistory.ToList(),
|
ChatHistory = s.ChatHistory.ToList(),
|
||||||
PlayerHistory = s.ClientHistory.ToArray(),
|
PlayerHistory = s.ClientHistory.ToArray()
|
||||||
};
|
};
|
||||||
return PartialView("_ClientActivity", serverInfo);
|
return PartialView("_ClientActivity", serverInfo);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ namespace WebfrontCore.ViewComponents
|
|||||||
LevelInt = (int)p.Level
|
LevelInt = (int)p.Level
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
ChatHistory = s.ChatHistory.ToList(),
|
ChatHistory = s.ChatHistory.ToList(),
|
||||||
Online = !s.Throttled
|
Online = !s.Throttled,
|
||||||
|
ConnectProtocolUrl = s.EventParser.URLProtocolFormat.FormatExt(s.IP, s.GetPort())
|
||||||
}).ToList();
|
}).ToList();
|
||||||
return View("_List", serverInfo);
|
return View("_List", serverInfo);
|
||||||
}
|
}
|
||||||
|
@ -3,21 +3,21 @@
|
|||||||
Layout = null;
|
Layout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="row server-header" id="server_header_@Model.ID">
|
<div class="row server-header pt-1 pb-1 bg-primary " id="server_header_@Model.ID">
|
||||||
<div class="col-md-4 bg-primary text-center text-md-left">@Model.Name</div>
|
<div class="col-md-4 text-center text-md-left d-inline-flex justify-content-center justify-content-md-start">
|
||||||
<div class="text-center col-md-4 bg-primary">@Model.Map</div>
|
<span>@Model.Name</span>
|
||||||
<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>
|
<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>
|
||||||
|
|
||||||
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity pt-2 pb-2">
|
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity pt-2 pb-2">
|
||||||
<div class="col-4">
|
@await Html.PartialAsync("../Server/_ClientActivity", Model)
|
||||||
<div class="oi oi-play-circle h1"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-8">
|
|
||||||
@await Html.PartialAsync("../Server/_ClientActivity", Model)
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row server-history mb-4">
|
<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>
|
</div>
|
||||||
|
@ -6299,6 +6299,9 @@ a.nav-link {
|
|||||||
.border-bottom {
|
.border-bottom {
|
||||||
border-bottom: 1px solid #007ACC !important; }
|
border-bottom: 1px solid #007ACC !important; }
|
||||||
|
|
||||||
|
.server-history {
|
||||||
|
background-color: #191919; }
|
||||||
|
|
||||||
.border-top {
|
.border-top {
|
||||||
border-top: 1px solid #007ACC !important; }
|
border-top: 1px solid #007ACC !important; }
|
||||||
|
|
||||||
@ -6308,6 +6311,9 @@ a.nav-link {
|
|||||||
border: 1px solid #fd7e14;
|
border: 1px solid #fd7e14;
|
||||||
color: #fff; }
|
color: #fff; }
|
||||||
|
|
||||||
|
.server-join-button, .server-join-button:hover {
|
||||||
|
color: #fff !important; }
|
||||||
|
|
||||||
a.link-inverse {
|
a.link-inverse {
|
||||||
color: #007ACC; }
|
color: #007ACC; }
|
||||||
|
|
||||||
@ -6413,7 +6419,7 @@ form *, select {
|
|||||||
.client-rating-change-amount {
|
.client-rating-change-amount {
|
||||||
font-size: 1rem; }
|
font-size: 1rem; }
|
||||||
|
|
||||||
.client-message, .automated-penalty-info-detailed {
|
.client-message, .automated-penalty-info-detailed, .oi {
|
||||||
cursor: pointer; }
|
cursor: pointer; }
|
||||||
|
|
||||||
#footer_text {
|
#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;
|
$light: rgb(204, 204, 204) !default;
|
||||||
$dark: rgb(24, 24, 24) !default;
|
$dark: rgb(24, 24, 24) !default;
|
||||||
$body-bg: rgb(34,34,34) !default;
|
$body-bg: rgb(34,34,34) !default;
|
||||||
|
$big-dark: #191919;
|
||||||
$body-color: $white !default;
|
$body-color: $white !default;
|
||||||
$link-color: $white !default;
|
$link-color: $white !default;
|
||||||
$link-decoration: none !default;
|
$link-decoration: none !default;
|
||||||
@ -67,6 +68,10 @@ a.nav-link {
|
|||||||
border-bottom: 1px solid $primary !important;
|
border-bottom: 1px solid $primary !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-history {
|
||||||
|
background-color: $big-dark;
|
||||||
|
}
|
||||||
|
|
||||||
.border-top {
|
.border-top {
|
||||||
border-top: 1px solid $primary !important;
|
border-top: 1px solid $primary !important;
|
||||||
}
|
}
|
||||||
@ -78,6 +83,10 @@ a.nav-link {
|
|||||||
color: $white;
|
color: $white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-join-button, .server-join-button:hover {
|
||||||
|
color: $white !important;
|
||||||
|
}
|
||||||
|
|
||||||
a.link-inverse {
|
a.link-inverse {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
}
|
}
|
||||||
@ -216,7 +225,7 @@ form *, select {
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.client-message, .automated-penalty-info-detailed {
|
.client-message, .automated-penalty-info-detailed, .oi {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +286,6 @@ form *, select {
|
|||||||
border: 1px solid $orange;
|
border: 1px solid $orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide {
|
.hide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user