mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 13:47:04 -04:00
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:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
10
server/FSO.Server.Database/DA/AuthTickets/AuthTicket.cs
Executable file
10
server/FSO.Server.Database/DA/AuthTickets/AuthTicket.cs
Executable 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; }
|
||||
}
|
||||
}
|
10
server/FSO.Server.Database/DA/AuthTickets/IAuthTickets.cs
Executable file
10
server/FSO.Server.Database/DA/AuthTickets/IAuthTickets.cs
Executable 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);
|
||||
}
|
||||
}
|
33
server/FSO.Server.Database/DA/AuthTickets/SqlAuthTickets.cs
Executable file
33
server/FSO.Server.Database/DA/AuthTickets/SqlAuthTickets.cs
Executable 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 });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue