🎨 Removed unused dependency injected services arguments in constructor
This commit is contained in:
parent
eadf25f389
commit
1baa3109bc
@ -1,7 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using DysonNetwork.Sphere.Auth;
|
using DysonNetwork.Sphere.Auth;
|
||||||
using DysonNetwork.Sphere.Permission;
|
using DysonNetwork.Sphere.Permission;
|
||||||
using DysonNetwork.Sphere.Storage;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@ -15,11 +14,9 @@ namespace DysonNetwork.Sphere.Account;
|
|||||||
[Route("/accounts")]
|
[Route("/accounts")]
|
||||||
public class AccountController(
|
public class AccountController(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
FileService fs,
|
|
||||||
AuthService auth,
|
AuthService auth,
|
||||||
AccountService accounts,
|
AccountService accounts,
|
||||||
AccountEventService events,
|
AccountEventService events
|
||||||
MagicSpellService spells
|
|
||||||
) : ControllerBase
|
) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet("{name}")]
|
[HttpGet("{name}")]
|
||||||
|
@ -10,7 +10,6 @@ namespace DysonNetwork.Sphere.Account;
|
|||||||
public class NotificationService(
|
public class NotificationService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
WebSocketService ws,
|
WebSocketService ws,
|
||||||
ILogger<NotificationService> logger,
|
|
||||||
IHttpClientFactory httpFactory,
|
IHttpClientFactory httpFactory,
|
||||||
IConfiguration config)
|
IConfiguration config)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ public class AuthService(AppDatabase db, IConfiguration config, IHttpClientFacto
|
|||||||
|
|
||||||
// 4) Combine base “maxSteps” (the number of enabled factors) with any accumulated risk score.
|
// 4) Combine base “maxSteps” (the number of enabled factors) with any accumulated risk score.
|
||||||
const int totalRiskScore = 3;
|
const int totalRiskScore = 3;
|
||||||
var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / 3);
|
var totalRequiredSteps = (int)Math.Round((float)maxSteps * riskScore / totalRiskScore);
|
||||||
// Clamp the steps
|
// Clamp the steps
|
||||||
totalRequiredSteps = Math.Max(Math.Min(totalRequiredSteps, maxSteps), 1);
|
totalRequiredSteps = Math.Max(Math.Min(totalRequiredSteps, maxSteps), 1);
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ public class ConnectionController(
|
|||||||
{
|
{
|
||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
catch (DbUpdateException ex)
|
catch (DbUpdateException)
|
||||||
{
|
{
|
||||||
return StatusCode(500, $"Failed to save {provider} connection. Please try again.");
|
return StatusCode(500, $"Failed to save {provider} connection. Please try again.");
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,15 @@ public class DiscordOidcService(
|
|||||||
return $"https://discord.com/api/oauth2/authorize?{queryString}";
|
return $"https://discord.com/api/oauth2/authorize?{queryString}";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<OidcDiscoveryDocument?> GetDiscoveryDocumentAsync()
|
protected override Task<OidcDiscoveryDocument?> GetDiscoveryDocumentAsync()
|
||||||
{
|
{
|
||||||
return new OidcDiscoveryDocument
|
return Task.FromResult(new OidcDiscoveryDocument
|
||||||
{
|
{
|
||||||
AuthorizationEndpoint = "https://discord.com/oauth2/authorize",
|
AuthorizationEndpoint = "https://discord.com/oauth2/authorize",
|
||||||
TokenEndpoint = "https://discord.com/api/oauth2/token",
|
TokenEndpoint = "https://discord.com/api/oauth2/token",
|
||||||
UserinfoEndpoint = "https://discord.com/api/users/@me",
|
UserinfoEndpoint = "https://discord.com/api/users/@me",
|
||||||
JwksUri = null
|
JwksUri = null
|
||||||
};
|
})!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<OidcUserInfo> ProcessCallbackAsync(OidcCallbackData callbackData)
|
public override async Task<OidcUserInfo> ProcessCallbackAsync(OidcCallbackData callbackData)
|
||||||
|
@ -16,7 +16,6 @@ namespace DysonNetwork.Sphere.Chat;
|
|||||||
[Route("/chat")]
|
[Route("/chat")]
|
||||||
public class ChatRoomController(
|
public class ChatRoomController(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
FileService fs,
|
|
||||||
FileReferenceService fileRefService,
|
FileReferenceService fileRefService,
|
||||||
ChatRoomService crs,
|
ChatRoomService crs,
|
||||||
RealmService rs,
|
RealmService rs,
|
||||||
|
@ -9,7 +9,6 @@ namespace DysonNetwork.Sphere.Chat;
|
|||||||
|
|
||||||
public class ChatService(
|
public class ChatService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
FileService fs,
|
|
||||||
FileReferenceService fileRefService,
|
FileReferenceService fileRefService,
|
||||||
IServiceScopeFactory scopeFactory,
|
IServiceScopeFactory scopeFactory,
|
||||||
IRealtimeService realtime,
|
IRealtimeService realtime,
|
||||||
|
@ -16,7 +16,6 @@ namespace DysonNetwork.Sphere.Publisher;
|
|||||||
public class PublisherController(
|
public class PublisherController(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
PublisherService ps,
|
PublisherService ps,
|
||||||
FileService fs,
|
|
||||||
FileReferenceService fileRefService,
|
FileReferenceService fileRefService,
|
||||||
ActionLogService als)
|
ActionLogService als)
|
||||||
: ControllerBase
|
: ControllerBase
|
||||||
|
@ -6,7 +6,7 @@ using NodaTime;
|
|||||||
|
|
||||||
namespace DysonNetwork.Sphere.Publisher;
|
namespace DysonNetwork.Sphere.Publisher;
|
||||||
|
|
||||||
public class PublisherService(AppDatabase db, FileService fs, FileReferenceService fileRefService, ICacheService cache)
|
public class PublisherService(AppDatabase db, FileReferenceService fileRefService, ICacheService cache)
|
||||||
{
|
{
|
||||||
private const string UserPublishersCacheKey = "accounts:{0}:publishers";
|
private const string UserPublishersCacheKey = "accounts:{0}:publishers";
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ namespace DysonNetwork.Sphere.Realm;
|
|||||||
public class RealmController(
|
public class RealmController(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
RealmService rs,
|
RealmService rs,
|
||||||
FileService fs,
|
|
||||||
FileReferenceService fileRefService,
|
FileReferenceService fileRefService,
|
||||||
RelationshipService rels,
|
RelationshipService rels,
|
||||||
ActionLogService als
|
ActionLogService als
|
||||||
|
@ -6,7 +6,6 @@ namespace DysonNetwork.Sphere.Storage;
|
|||||||
|
|
||||||
public class CloudFileUnusedRecyclingJob(
|
public class CloudFileUnusedRecyclingJob(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
FileService fs,
|
|
||||||
FileReferenceService fileRefService,
|
FileReferenceService fileRefService,
|
||||||
ILogger<CloudFileUnusedRecyclingJob> logger
|
ILogger<CloudFileUnusedRecyclingJob> logger
|
||||||
)
|
)
|
||||||
|
@ -6,8 +6,8 @@ namespace DysonNetwork.Sphere.Storage.Handlers;
|
|||||||
|
|
||||||
public class LastActiveInfo
|
public class LastActiveInfo
|
||||||
{
|
{
|
||||||
public Auth.Session Session { get; set; }
|
public Auth.Session Session { get; set; } = null!;
|
||||||
public Account.Account Account { get; set; }
|
public Account.Account Account { get; set; } = null!;
|
||||||
public Instant SeenAt { get; set; }
|
public Instant SeenAt { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user