Download rework (#22)
* rework server to send download ready back via signalr * adjust queue handling for removal * adjust api to main Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
@@ -63,5 +63,10 @@ namespace MareSynchronosServer.Hubs
|
||||
{
|
||||
throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
}
|
||||
|
||||
public Task Client_DownloadReady(Guid requestId)
|
||||
{
|
||||
throw new PlatformNotSupportedException("Calling clientside method on server not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,15 +83,6 @@ public partial class MareHub : Hub<IMareHub>, IMareHub
|
||||
};
|
||||
}
|
||||
|
||||
[Authorize(Policy = "Authenticated")]
|
||||
public async Task<ConnectionDto> Heartbeat(string characterIdentification)
|
||||
{
|
||||
return new ConnectionDto()
|
||||
{
|
||||
ServerVersion = IMareHub.ApiVersion,
|
||||
};
|
||||
}
|
||||
|
||||
[Authorize(Policy = "Authenticated")]
|
||||
public async Task<bool> CheckClientHealth()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ using MareSynchronosShared.Protos;
|
||||
using Grpc.Net.Client.Configuration;
|
||||
using MareSynchronosShared.Metrics;
|
||||
using MareSynchronosServer.Services;
|
||||
using MareSynchronosServer.Utils;
|
||||
using MareSynchronosServer.RequirementHandlers;
|
||||
using MareSynchronosShared.Utils;
|
||||
using MareSynchronosShared.Services;
|
||||
@@ -80,7 +79,6 @@ public class Startup
|
||||
|
||||
services.AddSingleton<ServerTokenGenerator>();
|
||||
services.AddSingleton<SystemInfoService>();
|
||||
services.AddSingleton<IUserIdProvider, IdBasedUserIdProvider>();
|
||||
services.AddHostedService(provider => provider.GetService<SystemInfoService>());
|
||||
// configure services based on main server status
|
||||
ConfigureServicesBasedOnShardType(services, mareConfig, isMainServer);
|
||||
@@ -94,6 +92,8 @@ public class Startup
|
||||
|
||||
private static void ConfigureSignalR(IServiceCollection services, IConfigurationSection mareConfig)
|
||||
{
|
||||
services.AddSingleton<IUserIdProvider, IdBasedUserIdProvider>();
|
||||
|
||||
var signalRServiceBuilder = services.AddSignalR(hubOptions =>
|
||||
{
|
||||
hubOptions.MaximumReceiveMessageSize = long.MaxValue;
|
||||
@@ -106,13 +106,7 @@ public class Startup
|
||||
|
||||
// configure redis for SignalR
|
||||
var redisConnection = mareConfig.GetValue(nameof(ServerConfiguration.RedisConnectionString), string.Empty);
|
||||
if (!string.IsNullOrEmpty(redisConnection))
|
||||
{
|
||||
signalRServiceBuilder.AddStackExchangeRedis(redisConnection, options =>
|
||||
{
|
||||
options.Configuration.ChannelPrefix = "MareSynchronos";
|
||||
});
|
||||
}
|
||||
signalRServiceBuilder.AddStackExchangeRedis(redisConnection, options => { });
|
||||
|
||||
var options = ConfigurationOptions.Parse(redisConnection);
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using MareSynchronosShared.Utils;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace MareSynchronosServer.Utils;
|
||||
|
||||
public class IdBasedUserIdProvider : IUserIdProvider
|
||||
{
|
||||
public string GetUserId(HubConnectionContext context)
|
||||
{
|
||||
return context.User!.Claims.SingleOrDefault(c => string.Equals(c.Type, MareClaimTypes.Uid, StringComparison.Ordinal))?.Value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user