added Ip logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-22 18:03:38 +10:00
parent 31ca387339
commit 6da7a84cab
9 changed files with 82 additions and 6 deletions

View File

@@ -12,10 +12,11 @@ namespace NeDvachAPI.Controllers
{
[HttpGet(Name = "GetPosts")]
public string Get([FromUri] string board, int thread)
{
{
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
List<Post> posts = DBchat.DbList(board, thread);
string postsJson = JsonSerializer.Serialize(posts);
Console.WriteLine("Запрошен список постов из борды " + board + " и треда# " + thread );
Console.WriteLine("С адреса " + ipAddress + " запрошен список постов из борды " + board + " и треда# " + thread);
return postsJson ;
}
}

View File

@@ -10,7 +10,8 @@ namespace NeDvachAPI.Controllers
[HttpPost(Name = "PostPosts")]
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
{
Console.WriteLine("Принят пост");
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
ReceivedPost.Ip = ipAddress;
DBchat.SendPost(ReceivedPost);
return new JsonResult("Posted Successfully!");
}