Removed NioTSO client and server

- NioTSO client isn't needed because we're using RayLib
- Added FreeSO's API server to handle most backend operations
This commit is contained in:
Tony Bark 2024-05-01 02:55:43 -04:00
parent f12ba1502b
commit 22191ce648
591 changed files with 53264 additions and 3362 deletions

View file

@ -0,0 +1,10 @@
namespace FSO.Server.Database.DA.AuthTickets
{
public class AuthTicket
{
public string ticket_id { get; set; }
public uint user_id { get; set; }
public uint date { get; set; }
public string ip { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace FSO.Server.Database.DA.AuthTickets
{
public interface IAuthTickets
{
void Create(AuthTicket ticket);
AuthTicket Get(string id);
void Delete(string id);
void Purge(uint time);
}
}

View file

@ -0,0 +1,33 @@
using System.Linq;
using Dapper;
namespace FSO.Server.Database.DA.AuthTickets
{
public class SqlAuthTickets : AbstractSqlDA, IAuthTickets
{
public SqlAuthTickets(ISqlContext context) : base(context)
{
}
public void Create(AuthTicket ticket)
{
Context.Connection.Execute("INSERT INTO fso_auth_tickets VALUES (@ticket_id, @user_id, @date, @ip)", ticket);
}
public void Delete(string id)
{
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id });
}
public AuthTicket Get(string id)
{
return
Context.Connection.Query<AuthTicket>("SELECT * FROM fso_auth_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id }).FirstOrDefault();
}
public void Purge(uint time)
{
Context.Connection.Execute("DELETE FROM fso_auth_tickets WHERE date < @time", new { time = time });
}
}
}