9e345752f2
update IW4 script commands gsc and plugin to give base example fix issue with new account alias linking (I think)
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using SharedLibraryCore;
|
|
using SharedLibraryCore.Interfaces;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace WebfrontCore.Controllers.API
|
|
{
|
|
[Route("api/gsc/[action]")]
|
|
public class GscApiController : BaseController
|
|
{
|
|
public GscApiController(IManager manager) : base(manager)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// grabs basic info about the client from IW4MAdmin
|
|
/// </summary>
|
|
/// <param name="networkId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("{networkId}")]
|
|
public IActionResult ClientInfo(string networkId)
|
|
{
|
|
var clientInfo = Manager.GetActiveClients()
|
|
.FirstOrDefault(c => c.NetworkId == networkId.ConvertGuidToLong());
|
|
|
|
if (clientInfo != null)
|
|
{
|
|
var sb = new StringBuilder();
|
|
sb.AppendLine($"admin={clientInfo.IsPrivileged()}");
|
|
sb.AppendLine($"level={(int)clientInfo.Level}");
|
|
sb.AppendLine($"levelstring={clientInfo.Level.ToLocalizedLevelName()}");
|
|
sb.AppendLine($"connections={clientInfo.Connections}");
|
|
sb.AppendLine($"authenticated={clientInfo.GetAdditionalProperty<bool>("IsLoggedIn") == true}");
|
|
|
|
return Content(sb.ToString());
|
|
}
|
|
|
|
return Content("");
|
|
}
|
|
}
|
|
}
|