fix live radar links
This commit is contained in:
parent
35b43e7438
commit
ed1032415e
@ -15,7 +15,8 @@ namespace LiveRadar.Web.Controllers
|
||||
private static LiveRadarConfiguration _config;
|
||||
private readonly IConfigurationHandler<LiveRadarConfiguration> _configurationHandler;
|
||||
|
||||
public RadarController(IManager manager, IConfigurationHandlerFactory configurationHandlerFactory) : base(manager)
|
||||
public RadarController(IManager manager, IConfigurationHandlerFactory configurationHandlerFactory) :
|
||||
base(manager)
|
||||
{
|
||||
_manager = manager;
|
||||
_configurationHandler =
|
||||
@ -23,7 +24,7 @@ namespace LiveRadar.Web.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Radar/{serverId}")]
|
||||
[Route("Radar/{serverId?}")]
|
||||
public IActionResult Index(string serverId = null)
|
||||
{
|
||||
var servers = _manager.GetServers()
|
||||
@ -44,9 +45,11 @@ namespace LiveRadar.Web.Controllers
|
||||
|
||||
[HttpGet]
|
||||
[Route("Radar/{serverId}/Map")]
|
||||
public async Task<IActionResult> Map(long? serverId = null)
|
||||
public async Task<IActionResult> Map(string serverId = null)
|
||||
{
|
||||
var server = serverId == null ? _manager.GetServers().FirstOrDefault() : _manager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId);
|
||||
var server = serverId == null
|
||||
? _manager.GetServers().FirstOrDefault()
|
||||
: _manager.GetServers().FirstOrDefault(server => server.ToString() == serverId);
|
||||
|
||||
if (server == null)
|
||||
{
|
||||
@ -59,7 +62,7 @@ namespace LiveRadar.Web.Controllers
|
||||
_config = _configurationHandler.Configuration() ?? new LiveRadarConfiguration();
|
||||
}
|
||||
|
||||
var map = _config.Maps.FirstOrDefault(_map => _map.Name == server.CurrentMap.Name);
|
||||
var map = _config.Maps.FirstOrDefault(map => map.Name == server.CurrentMap.Name);
|
||||
|
||||
if (map == null)
|
||||
{
|
||||
@ -74,27 +77,21 @@ namespace LiveRadar.Web.Controllers
|
||||
[HttpGet]
|
||||
[Route("Radar/{serverId}/Data")]
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Data(long? serverId = null)
|
||||
public IActionResult Data(string serverId = null)
|
||||
{
|
||||
var server = serverId == null ? _manager.GetServers()[0] : _manager.GetServers().First(_server => _server.EndPoint == serverId);
|
||||
var radarInfo = server.GetClientsAsList().Select(_client => _client.GetAdditionalProperty<RadarEvent>("LiveRadar")).ToList();
|
||||
return Json(radarInfo);
|
||||
var server = serverId == null
|
||||
? _manager.GetServers().FirstOrDefault()
|
||||
: _manager.GetServers().FirstOrDefault(server => server.ToString() == serverId);
|
||||
|
||||
if (server == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Radar/Update")]
|
||||
public IActionResult Update(string payload)
|
||||
{
|
||||
/*var radarUpdate = RadarEvent.Parse(payload);
|
||||
var client = _manager.GetActiveClients().FirstOrDefault(_client => _client.NetworkId == radarUpdate.Guid);
|
||||
var radarInfo = server.GetClientsAsList()
|
||||
.Select(client => client.GetAdditionalProperty<RadarEvent>("LiveRadar")).ToList();
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
radarUpdate.Name = client.Name.StripColors();
|
||||
client.SetAdditionalProperty("LiveRadar", radarUpdate);
|
||||
}*/
|
||||
|
||||
return Ok();
|
||||
return Json(radarInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace LiveRadar
|
||||
S.CustomCallback &&
|
||||
!addedPage)
|
||||
{
|
||||
E.Owner.Manager.GetPageList().Pages.Add(Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"], "/Radar/All");
|
||||
E.Owner.Manager.GetPageList().Pages.Add(Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"], "/Radar");
|
||||
addedPage = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user