forked from SoDOff-Project/sodoff
add basic evnet logging and remove ambiguous ping controller
This commit is contained in:
parent
d3b7270dcd
commit
94ede223f3
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using sodoff.Model;
|
||||
using sodoff.Util;
|
||||
|
||||
namespace sodoff.Controllers.Common
|
||||
{
|
||||
@ -29,9 +30,14 @@ namespace sodoff.Controllers.Common
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("AnalyticsWebService.asmx/LogEvent")]
|
||||
public IActionResult LogEvent()
|
||||
public IActionResult LogEvent([FromForm] string eventXml)
|
||||
{
|
||||
// placeholder to prevent a ton of 404's
|
||||
DateTime now = DateTime.UtcNow;
|
||||
Schema.LogEvent? eventClass = XmlUtil.DeserializeXml<Schema.LogEvent>(eventXml);
|
||||
string eventToLog = $"Event Logged At {now.ToLocalTime()}\nUserID - {eventClass.UserID}\nEvent Category ID - {eventClass.EventCategoryID}\nEvent Type ID - {eventClass.EventTypeID}\nEvent Data - {eventClass.Data}";
|
||||
|
||||
Console.WriteLine(eventToLog);
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace sodoff.Controllers.Common
|
||||
{
|
||||
public class PingController : Controller
|
||||
{
|
||||
[HttpPost]
|
||||
[Route("PingWebService.asmx/GetPingPayload")]
|
||||
public IActionResult GetPingPayload()
|
||||
{
|
||||
return Ok("Pong!");
|
||||
}
|
||||
}
|
||||
}
|
28
src/Schema/LogEvent.cs
Normal file
28
src/Schema/LogEvent.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace sodoff.Schema;
|
||||
|
||||
[XmlRoot(ElementName = "LogEvent", Namespace = "")]
|
||||
[Serializable]
|
||||
public class LogEvent
|
||||
{
|
||||
[XmlElement(ElementName = "ApiKey")]
|
||||
public string ApiKey;
|
||||
|
||||
[XmlElement(ElementName = "ApiToken")]
|
||||
public string ApiToken;
|
||||
|
||||
[XmlElement(ElementName = "UserID")]
|
||||
public string UserID;
|
||||
|
||||
[XmlElement(ElementName = "EventTypeID")]
|
||||
public int EventTypeID;
|
||||
|
||||
[XmlElement(ElementName = "EventCategoryID")]
|
||||
public int EventCategoryID;
|
||||
|
||||
// Token: 0x040003CB RID: 971
|
||||
[XmlElement(ElementName = "Data")]
|
||||
public string Data;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user