add documentation how to install server on ubuntu 20.04 and add server version stuff
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "6.0.6",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using MareSynchronosServer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -20,7 +19,10 @@ namespace MareSynchronosServer
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var context = services.GetRequiredService<MareDbContext>();
|
||||
context.Database.EnsureCreated();
|
||||
context.Database.Migrate();
|
||||
context.SaveChanges();
|
||||
|
||||
// clean up residuals
|
||||
var users = context.Users.Where(u => u.CharacterIdentification != null);
|
||||
foreach (var user in users)
|
||||
{
|
||||
@@ -37,6 +39,7 @@ namespace MareSynchronosServer
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.UseSystemd()
|
||||
.UseConsoleLifetime()
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user