This commit is contained in:
parent
2d853eaa02
commit
cccd45caa7
@ -2,7 +2,6 @@
|
||||
using NeDvachAPI.BufferControllers;
|
||||
using NeDvachAPI.DBControllers;
|
||||
using NeDvachAPI.Models;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace NeDvachAPI.Controllers
|
||||
{
|
||||
@ -15,6 +14,11 @@ namespace NeDvachAPI.Controllers
|
||||
{
|
||||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
ReceivedPost.Ip = ipAddress;
|
||||
|
||||
if(ReceivedPost.Text.Length == 0)
|
||||
{
|
||||
return new JsonResult("Вы отправили пустое сообщение!");
|
||||
}
|
||||
try
|
||||
{
|
||||
DBchat.SendPost(ReceivedPost);
|
||||
|
@ -1,19 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace NeDvachAPI.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class TestPostingController : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public int Area([FromForm] int height , int altitude)
|
||||
{
|
||||
//DBchat.SendPost(ReceivedPost);
|
||||
Console.WriteLine("Received! " + height + " " + altitude );
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
}
|
15
BufferControllers/AccessController.cs
Normal file
15
BufferControllers/AccessController.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using NeDvachAPI.Models;
|
||||
using Npgsql;
|
||||
|
||||
namespace NeDvachAPI.DBControllers
|
||||
{
|
||||
public class BanList
|
||||
{
|
||||
public static string[] GetBanned()
|
||||
{
|
||||
string[] bannedIPs = new string[0];
|
||||
//
|
||||
return bannedIPs;
|
||||
}
|
||||
}
|
||||
}
|
@ -55,7 +55,6 @@ namespace NeDvachAPI.DBControllers
|
||||
public static List<Post> ThreadsList(string boardName)
|
||||
{
|
||||
List<Post> posts = new List<Post>();
|
||||
string received = "";
|
||||
string connString =
|
||||
string.Format(
|
||||
"Server={0}; User Id={1}; Database={2}; Port={3}; Password={4};SSLMode=Prefer",
|
||||
|
@ -5,7 +5,7 @@ namespace NeDvachAPI.Models
|
||||
public string Timestamp { get; set; }
|
||||
public int Id { get; set; }
|
||||
public string Text { get; set; }
|
||||
public string[] ImgURL { get; set; }
|
||||
public string[]? ImgURL { get; set; }
|
||||
public int Thread_Id { get; set; }
|
||||
public bool Is_OP { get; set; }
|
||||
public bool Is_Deleted { get; set; }
|
||||
|
@ -34,4 +34,5 @@ if (BufferFill.FillBuffer("b"))
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
else Console.WriteLine("Ошибка буферизации, проверьте доступность базы данных.");
|
||||
|
||||
|
Reference in New Issue
Block a user