Trying to fix boardcast to upstream
This commit is contained in:
@@ -131,7 +131,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// POST create new node (folder/note)
|
||||
group.MapPost("/", async (CreateNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapPost("/", async (CreateNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -188,7 +188,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
@@ -206,7 +206,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// PUT update node (rename/edit content)
|
||||
group.MapPut("/{uuid}", async (string uuid, UpdateNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapPut("/{uuid}", async (string uuid, UpdateNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -266,7 +266,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
@@ -282,7 +282,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// DELETE a node (soft delete)
|
||||
group.MapDelete("/{uuid}", async (string uuid, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapDelete("/{uuid}", async (string uuid, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -306,7 +306,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
@@ -338,7 +338,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// PUT update ACL entries
|
||||
group.MapPut("/{uuid}/acl", async (string uuid, List<AclEntryRequest> aclReqs, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapPut("/{uuid}/acl", async (string uuid, List<AclEntryRequest> aclReqs, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -435,7 +435,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
@@ -451,7 +451,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// POST Share a Node (generates k0 encrypted by k1 and saves in PendingShare)
|
||||
group.MapPost("/share", async (ShareNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapPost("/share", async (ShareNodeRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -522,7 +522,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
@@ -538,7 +538,7 @@ public static class NodeEndpoints
|
||||
});
|
||||
|
||||
// POST Accept a Share (decrypts E_k1(k0) using k1 and re-encrypts using recipient's masterKey)
|
||||
group.MapPost("/accept-share", async (AcceptShareRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient) =>
|
||||
group.MapPost("/accept-share", async (AcceptShareRequest req, HttpContext context, ServerDbContext db, CertificateManager certManager, PeerCache peerCache, HttpClient httpClient, IServiceProvider serviceProvider) =>
|
||||
{
|
||||
var username = AuthHelper.GetAuthenticatedUser(context, certManager);
|
||||
if (string.IsNullOrEmpty(username)) return Results.Unauthorized();
|
||||
@@ -609,7 +609,7 @@ public static class NodeEndpoints
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = context.RequestServices.CreateScope();
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var scopeDb = scope.ServiceProvider.GetRequiredService<ServerDbContext>();
|
||||
var rsaKeyManager = scope.ServiceProvider.GetRequiredService<RsaKeyManager>();
|
||||
var configuration = scope.ServiceProvider.GetRequiredService<IConfiguration>();
|
||||
|
||||
Reference in New Issue
Block a user