add documentation how to install server on ubuntu 20.04 and add server version stuff
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using MareSynchronos.API;
|
||||
@@ -10,11 +11,12 @@ namespace MareSynchronosServer.Hubs
|
||||
{
|
||||
public class ConnectionHub : BaseHub<ConnectionHub>
|
||||
{
|
||||
private const int ServerVersion = 1;
|
||||
public ConnectionHub(MareDbContext mareDbContext, ILogger<ConnectionHub> logger) : base(mareDbContext, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<LoggedInUserDto> Heartbeat()
|
||||
public async Task<ConnectionDto> Heartbeat()
|
||||
{
|
||||
var userId = Context.User!.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
@@ -23,15 +25,16 @@ namespace MareSynchronosServer.Hubs
|
||||
{
|
||||
Logger.LogInformation("Connection from " + userId);
|
||||
var user = (await DbContext.Users.SingleAsync(u => u.UID == userId));
|
||||
return new LoggedInUserDto
|
||||
return new ConnectionDto
|
||||
{
|
||||
ServerVersion = ServerVersion,
|
||||
UID = userId,
|
||||
IsModerator = user.IsModerator,
|
||||
IsAdmin = user.IsAdmin
|
||||
};
|
||||
}
|
||||
|
||||
return new LoggedInUserDto();
|
||||
return new ConnectionDto();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user