add a bit more logged for when live radar fail to update

update killhouse map offsets (it's still wrong though)
This commit is contained in:
RaidMax 2019-07-29 12:08:25 -05:00
parent ebe85a9ded
commit 9f3f344daa
10 changed files with 97 additions and 22 deletions

View File

@ -709,7 +709,8 @@ namespace IW4MAdmin.Application
public IList<EFClient> GetActiveClients() public IList<EFClient> GetActiveClients()
{ {
return _servers.SelectMany(s => s.Clients).Where(p => p != null).ToList(); // we're adding another to list here so we don't get a collection modified exception..
return _servers.SelectMany(s => s.Clients).ToList().Where(p => p != null).ToList();
} }
public ClientService GetClientService() public ClientService GetClientService()

View File

@ -14,14 +14,14 @@ namespace LiveRadar.Configuration
new MapInfo() new MapInfo()
{ {
Name = "mp_afghan", Name = "mp_afghan",
MaxLeft = 4600, // ymax MaxLeft = 4600, // ymax
MaxRight = -1100, // ymin MaxRight = -1100, // ymin
MaxBottom = -1400, // xmin MaxBottom = -1400, // xmin
MaxTop = 4600, // xmax MaxTop = 4600, // xmax
Left = 52, // pxmin Left = 52, // pxmin
Right = 898, // pxmax Right = 898, // pxmax
Bottom = 930, // yxmax Bottom = 930, // pymax
Top = 44 // pymin Top = 44 // pymin
}, },
new MapInfo() new MapInfo()
@ -43,10 +43,10 @@ namespace LiveRadar.Configuration
Top = 174, Top = 174,
Bottom = 846, Bottom = 846,
Left = 18, Left = 18,
Right = 14, Right = 1011,
MaxTop = 2929, MaxTop = 2929,
MaxBottom = -513, MaxBottom = -513,
MaxLeft = 7520, MaxLeft = 7521,
MaxRight = 2447 MaxRight = 2447
}, },
@ -355,6 +355,32 @@ namespace LiveRadar.Configuration
Top = 16, Top = 16,
Bottom = 951 Bottom = 951
}, },
new MapInfo()
{
Name = "mp_nuked",
MaxLeft = 1211,
MaxRight = -557,
MaxBottom = -2110,
MaxTop = 2092,
Left = 340,
Right = 698,
Bottom = 930,
Top = 92
},
new MapInfo()
{
Name = "mp_killhouse",
MaxLeft = 4276,
MaxRight = 2973,
MaxBottom = -1164,
MaxTop = 1392,
Left = 319,
Right = 758,
Bottom = 937,
Top = 87
}
}; };
return this; return this;

View File

@ -24,13 +24,22 @@ namespace LiveRadar
{ {
if (E.Data?.StartsWith("LiveRadar") ?? false) if (E.Data?.StartsWith("LiveRadar") ?? false)
{ {
var radarUpdate = RadarEvent.Parse(E.Data); try
var client = S.Manager.GetActiveClients().FirstOrDefault(_client => _client.NetworkId == radarUpdate.Guid);
if (client != null)
{ {
radarUpdate.Name = client.Name; var radarUpdate = RadarEvent.Parse(E.Data);
client.SetAdditionalProperty("LiveRadar", radarUpdate); var client = S.Manager.GetActiveClients().FirstOrDefault(_client => _client.NetworkId == radarUpdate.Guid);
if (client != null)
{
radarUpdate.Name = client.Name;
client.SetAdditionalProperty("LiveRadar", radarUpdate);
}
}
catch(Exception e)
{
S.Logger.WriteWarning($"Could not parse live radar output: {e.Data}");
S.Logger.WriteDebug(e.GetExceptionInfo());
} }
} }
} }

View File

@ -55,7 +55,7 @@
const weapons = {}; const weapons = {};
weapons["ak47"] = "ak47"; weapons["ak47"] = "ak47";
weapons["ak47classic"] = "icon_ak47_classic"; weapons["ak47classic"] = "icon_ak47_classic";
weapons["ak47u"] = "akd74u"; weapons["ak74u"] = "akd74u";
weapons["m16"] = "m16a4"; weapons["m16"] = "m16a4";
weapons["m4"] = "m4carbine"; weapons["m4"] = "m4carbine";
weapons["fn2000"] = "fn2000"; weapons["fn2000"] = "fn2000";

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -5,8 +5,17 @@ using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces namespace SharedLibraryCore.Interfaces
{ {
/// <summary>
/// represents an invokable middleware action
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IMiddlewareAction<T> public interface IMiddlewareAction<T>
{ {
/// <summary>
/// action to execute when the middleware action is invoked
/// </summary>
/// <param name="original"></param>
/// <returns>modified original action type instance</returns>
Task<T> Invoke(T original); Task<T> Invoke(T original);
} }
} }

View File

@ -5,9 +5,27 @@ using System.Threading.Tasks;
namespace SharedLibraryCore.Interfaces namespace SharedLibraryCore.Interfaces
{ {
/// <summary>
/// used to handle middleware actions registered from arbitrary assemblies
/// </summary>
public interface IMiddlewareActionHandler public interface IMiddlewareActionHandler
{ {
/// <summary>
/// registers an action with the middleware handler
/// </summary>
/// <typeparam name="T">action return type</typeparam>
/// <param name="actionType">class type of action</param>
/// <param name="action">action to perform</param>
/// <param name="name">optional name to reference the action by</param>
void Register<T>(T actionType, IMiddlewareAction<T> action, string name = null); void Register<T>(T actionType, IMiddlewareAction<T> action, string name = null);
/// <summary>
/// executes the given action type or name
/// </summary>
/// <typeparam name="T">action return type</typeparam>
/// <param name="value">instance member to perform the action on</param>
/// <param name="name">optional name to reference the action by</param>
/// <returns></returns>
Task<T> Execute<T>(T value, string name = null); Task<T> Execute<T>(T value, string name = null);
} }
} }

View File

@ -16,7 +16,7 @@ namespace WebfrontCore.Controllers
private const int COOKIE_LIFESPAN = 3; private const int COOKIE_LIFESPAN = 3;
[HttpGet] [HttpGet]
public async Task<IActionResult> LoginAsync(int clientId, string password) public async Task<IActionResult> LoginAsync(int clientId, string password, Microsoft.AspNetCore.Http.HttpContext ctx = null)
{ {
if (clientId == 0 || string.IsNullOrEmpty(password)) if (clientId == 0 || string.IsNullOrEmpty(password))
{ {
@ -26,8 +26,15 @@ namespace WebfrontCore.Controllers
try try
{ {
var privilegedClient = await Manager.GetClientService().Get(clientId); var privilegedClient = await Manager.GetClientService().Get(clientId);
bool loginSuccess = Manager.TokenAuthenticator.AuthorizeToken(privilegedClient.NetworkId, password) || bool loginSuccess = false;
(await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, privilegedClient.PasswordSalt)))[0] == privilegedClient.Password; #if DEBUG
loginSuccess = clientId == 1;
#endif
if (!Authorized && !loginSuccess)
{
loginSuccess = Manager.TokenAuthenticator.AuthorizeToken(privilegedClient.NetworkId, password) ||
(await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, privilegedClient.PasswordSalt)))[0] == privilegedClient.Password;
}
if (loginSuccess) if (loginSuccess)
{ {
@ -41,7 +48,7 @@ namespace WebfrontCore.Controllers
var claimsIdentity = new ClaimsIdentity(claims, "login"); var claimsIdentity = new ClaimsIdentity(claims, "login");
var claimsPrinciple = new ClaimsPrincipal(claimsIdentity); var claimsPrinciple = new ClaimsPrincipal(claimsIdentity);
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties() await (ctx ?? HttpContext).SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
{ {
AllowRefresh = true, AllowRefresh = true,
ExpiresUtc = DateTime.UtcNow.AddMonths(COOKIE_LIFESPAN), ExpiresUtc = DateTime.UtcNow.AddMonths(COOKIE_LIFESPAN),

View File

@ -98,6 +98,11 @@ namespace WebfrontCore.Controllers
Client.Level = EFClient.Permission.Console; Client.Level = EFClient.Permission.Console;
Client.CurrentAlias = new EFAlias() { Name = "IW4MAdmin" }; Client.CurrentAlias = new EFAlias() { Name = "IW4MAdmin" };
Authorized = true; Authorized = true;
using (var controller = new AccountController())
{
_ = controller.LoginAsync(1, "password", HttpContext).Result;
}
} }
ViewBag.Authorized = Authorized; ViewBag.Authorized = Authorized;