Switched to database scheme seperation from MoonCores SingleDb. Updated mooncore versions. Updating to correct Async naming

This commit is contained in:
2025-09-21 16:44:01 +00:00
parent 86bec7f2ee
commit 3e87d5c140
93 changed files with 587 additions and 1583 deletions

View File

@@ -26,7 +26,7 @@ public class ApiKeysController : Controller
[HttpGet]
[Authorize(Policy = "permissions:admin.apikeys.get")]
public async Task<ActionResult<ICountedData<ApiKeyResponse>>> Get(
public async Task<ActionResult<ICountedData<ApiKeyResponse>>> GetAsync(
[FromQuery] int startIndex,
[FromQuery] int count,
[FromQuery] string? orderBy,
@@ -81,7 +81,7 @@ public class ApiKeysController : Controller
[HttpGet("{id:int}")]
[Authorize(Policy = "permissions:admin.apikeys.get")]
public async Task<ActionResult<ApiKeyResponse>> GetSingle(int id)
public async Task<ActionResult<ApiKeyResponse>> GetSingleAsync(int id)
{
var apiKey = await ApiKeyRepository
.Get()
@@ -97,7 +97,7 @@ public class ApiKeysController : Controller
[HttpPost]
[Authorize(Policy = "permissions:admin.apikeys.create")]
public async Task<CreateApiKeyResponse> Create([FromBody] CreateApiKeyRequest request)
public async Task<CreateApiKeyResponse> CreateAsync([FromBody] CreateApiKeyRequest request)
{
var apiKey = ApiKeyMapper.ToApiKey(request);
@@ -117,7 +117,7 @@ public class ApiKeysController : Controller
[HttpPatch("{id:int}")]
[Authorize(Policy = "permissions:admin.apikeys.update")]
public async Task<ActionResult<ApiKeyResponse>> Update([FromRoute] int id, [FromBody] UpdateApiKeyRequest request)
public async Task<ActionResult<ApiKeyResponse>> UpdateAsync([FromRoute] int id, [FromBody] UpdateApiKeyRequest request)
{
var apiKey = await ApiKeyRepository
.Get()
@@ -135,7 +135,7 @@ public class ApiKeysController : Controller
[HttpDelete("{id:int}")]
[Authorize(Policy = "permissions:admin.apikeys.delete")]
public async Task<ActionResult> Delete([FromRoute] int id)
public async Task<ActionResult> DeleteAsync([FromRoute] int id)
{
var apiKey = await ApiKeyRepository
.Get()

View File

@@ -19,9 +19,9 @@ public class AdvancedController : Controller
[HttpGet("frontend")]
[Authorize(Policy = "permissions:admin.system.advanced.frontend")]
public async Task Frontend()
public async Task FrontendAsync()
{
var stream = await FrontendService.GenerateZip();
var stream = await FrontendService.GenerateZipAsync();
await Results.File(stream, fileDownloadName: "frontend.zip").ExecuteAsync(HttpContext);
}
}

View File

@@ -26,7 +26,7 @@ public class ThemesController : Controller
[HttpGet]
[Authorize(Policy = "permissions:admin.system.customisation.themes.read")]
public async Task<ActionResult<ICountedData<ThemeResponse>>> Get(
public async Task<ActionResult<ICountedData<ThemeResponse>>> GetAsync(
[FromQuery] int startIndex,
[FromQuery] int count,
[FromQuery] string? orderBy,
@@ -81,7 +81,7 @@ public class ThemesController : Controller
[HttpGet("{id:int}")]
[Authorize(Policy = "permissions:admin.system.customisation.themes.read")]
public async Task<ActionResult<ThemeResponse>> GetSingle([FromRoute] int id)
public async Task<ActionResult<ThemeResponse>> GetSingleAsync([FromRoute] int id)
{
var theme = await ThemeRepository
.Get()
@@ -97,7 +97,7 @@ public class ThemesController : Controller
[HttpPost]
[Authorize(Policy = "permissions:admin.system.customisation.themes.write")]
public async Task<ActionResult<ThemeResponse>> Create([FromBody] CreateThemeRequest request)
public async Task<ActionResult<ThemeResponse>> CreateAsync([FromBody] CreateThemeRequest request)
{
var theme = ThemeMapper.ToTheme(request);
@@ -108,7 +108,7 @@ public class ThemesController : Controller
[HttpPatch("{id:int}")]
[Authorize(Policy = "permissions:admin.system.customisation.themes.write")]
public async Task<ActionResult<ThemeResponse>> Update([FromRoute] int id, [FromBody] UpdateThemeRequest request)
public async Task<ActionResult<ThemeResponse>> UpdateAsync([FromRoute] int id, [FromBody] UpdateThemeRequest request)
{
var theme = await ThemeRepository
.Get()
@@ -141,7 +141,7 @@ public class ThemesController : Controller
[HttpDelete("{id:int}")]
[Authorize(Policy = "permissions:admin.system.customisation.themes.write")]
public async Task<ActionResult> Delete([FromRoute] int id)
public async Task<ActionResult> DeleteAsync([FromRoute] int id)
{
var theme = await ThemeRepository
.Get()

View File

@@ -21,7 +21,7 @@ public class DiagnoseController : Controller
}
[HttpPost]
public async Task<ActionResult> Diagnose([FromBody] GenerateDiagnoseRequest request)
public async Task<ActionResult> DiagnoseAsync([FromBody] GenerateDiagnoseRequest request)
{
var stream = await DiagnoseService.GenerateDiagnoseAsync(request.Providers);
@@ -29,7 +29,7 @@ public class DiagnoseController : Controller
}
[HttpGet("providers")]
public async Task<ActionResult<DiagnoseProvideResponse[]>> GetProviders()
public async Task<ActionResult<DiagnoseProvideResponse[]>> GetProvidersAsync()
{
return await DiagnoseService.GetProvidersAsync();
}

View File

@@ -23,7 +23,7 @@ public class CombineController : Controller
}
[HttpPost("combine")]
public async Task<IResult> Combine([FromBody] CombineRequest request)
public async Task<IResult> CombineAsync([FromBody] CombineRequest request)
{
// Validate file lenght
if (request.Files.Length < 2)

View File

@@ -19,7 +19,7 @@ public class CompressController : Controller
private const string BaseDirectory = "storage";
[HttpPost("compress")]
public async Task<IResult> Compress([FromBody] CompressRequest request)
public async Task<IResult> CompressAsync([FromBody] CompressRequest request)
{
// Validate item length
if (request.Items.Length == 0)
@@ -48,11 +48,11 @@ public class CompressController : Controller
switch (request.Format)
{
case "tar.gz":
await CompressTarGz(destinationPath, itemsPaths, rootPath);
await CompressTarGzAsync(destinationPath, itemsPaths, rootPath);
break;
case "zip":
await CompressZip(destinationPath, itemsPaths, rootPath);
await CompressZipAsync(destinationPath, itemsPaths, rootPath);
break;
default:
@@ -66,14 +66,14 @@ public class CompressController : Controller
#region Tar Gz
private async Task CompressTarGz(string destination, IEnumerable<string> items, string root)
private async Task CompressTarGzAsync(string destination, IEnumerable<string> items, string root)
{
await using var outStream = System.IO.File.Create(destination);
await using var gzoStream = new GZipOutputStream(outStream);
await using var tarStream = new TarOutputStream(gzoStream, Encoding.UTF8);
foreach (var item in items)
await CompressItemToTarGz(tarStream, item, root);
await CompressItemToTarGzAsync(tarStream, item, root);
await tarStream.FlushAsync();
await gzoStream.FlushAsync();
@@ -84,7 +84,7 @@ public class CompressController : Controller
outStream.Close();
}
private async Task CompressItemToTarGz(TarOutputStream tarOutputStream, string item, string root)
private async Task CompressItemToTarGzAsync(TarOutputStream tarOutputStream, string item, string root)
{
if (System.IO.File.Exists(item))
{
@@ -117,7 +117,7 @@ public class CompressController : Controller
if (Directory.Exists(item))
{
foreach (var fsEntry in Directory.EnumerateFileSystemEntries(item))
await CompressItemToTarGz(tarOutputStream, fsEntry, root);
await CompressItemToTarGzAsync(tarOutputStream, fsEntry, root);
}
}
@@ -125,13 +125,13 @@ public class CompressController : Controller
#region ZIP
private async Task CompressZip(string destination, IEnumerable<string> items, string root)
private async Task CompressZipAsync(string destination, IEnumerable<string> items, string root)
{
await using var outStream = System.IO.File.Create(destination);
await using var zipOutputStream = new ZipOutputStream(outStream);
foreach (var item in items)
await AddItemToZip(zipOutputStream, item, root);
await AddItemToZipAsync(zipOutputStream, item, root);
await zipOutputStream.FlushAsync();
await outStream.FlushAsync();
@@ -140,7 +140,7 @@ public class CompressController : Controller
outStream.Close();
}
private async Task AddItemToZip(ZipOutputStream outputStream, string item, string root)
private async Task AddItemToZipAsync(ZipOutputStream outputStream, string item, string root)
{
if (System.IO.File.Exists(item))
{
@@ -175,7 +175,7 @@ public class CompressController : Controller
if (Directory.Exists(item))
{
foreach (var subItem in Directory.EnumerateFileSystemEntries(item))
await AddItemToZip(outputStream, subItem, root);
await AddItemToZipAsync(outputStream, subItem, root);
}
}

View File

@@ -17,7 +17,7 @@ public class DecompressController : Controller
private const string BaseDirectory = "storage";
[HttpPost("decompress")]
public async Task Decompress([FromBody] DecompressRequest request)
public async Task DecompressAsync([FromBody] DecompressRequest request)
{
var path = Path.Combine(BaseDirectory, FilePathHelper.SanitizePath(request.Path));
var destination = Path.Combine(BaseDirectory, FilePathHelper.SanitizePath(request.Destination));
@@ -25,18 +25,18 @@ public class DecompressController : Controller
switch (request.Format)
{
case "tar.gz":
await DecompressTarGz(path, destination);
await DecompressTarGzAsync(path, destination);
break;
case "zip":
await DecompressZip(path, destination);
await DecompressZipAsync(path, destination);
break;
}
}
#region Tar Gz
private async Task DecompressTarGz(string path, string destination)
private async Task DecompressTarGzAsync(string path, string destination)
{
await using var fs = System.IO.File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
await using var gzipInputStream = new GZipInputStream(fs);
@@ -74,7 +74,7 @@ public class DecompressController : Controller
#region Zip
private async Task DecompressZip(string path, string destination)
private async Task DecompressZipAsync(string path, string destination)
{
await using var fs = System.IO.File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
await using var zipInputStream = new ZipInputStream(fs);

View File

@@ -25,7 +25,7 @@ public class DownloadUrlController : Controller
}
[HttpGet]
public async Task Get([FromQuery] string path)
public async Task GetAsync([FromQuery] string path)
{
var physicalPath = Path.Combine(BaseDirectory, FilePathHelper.SanitizePath(path));
var name = Path.GetFileName(physicalPath);
@@ -55,7 +55,7 @@ public class DownloadUrlController : Controller
await using var zipStream = new ZipOutputStream(Response.Body);
zipStream.IsStreamOwner = false;
await StreamFolderAsZip(zipStream, physicalPath, baseDirectory, HttpContext.RequestAborted);
await StreamFolderAsZipAsync(zipStream, physicalPath, baseDirectory, HttpContext.RequestAborted);
}
catch (ZipException)
{
@@ -68,7 +68,7 @@ public class DownloadUrlController : Controller
}
}
private async Task StreamFolderAsZip(
private async Task StreamFolderAsZipAsync(
ZipOutputStream zipStream,
string path, string rootPath,
CancellationToken cancellationToken
@@ -102,7 +102,7 @@ public class DownloadUrlController : Controller
if (HttpContext.RequestAborted.IsCancellationRequested)
return;
await StreamFolderAsZip(zipStream, directory, rootPath, cancellationToken);
await StreamFolderAsZipAsync(zipStream, directory, rootPath, cancellationToken);
}
}
@@ -110,7 +110,7 @@ public class DownloadUrlController : Controller
// Yes I know we can just create that url on the client as the exist validation is done on both endpoints,
// but we leave it here for future modifications. E.g. using a distributed file provider or smth like that
[HttpPost]
public Task<DownloadUrlResponse> Post([FromQuery] string path)
public Task<DownloadUrlResponse> PostAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalPath = Path.Combine(BaseDirectory, safePath);

View File

@@ -15,7 +15,7 @@ public class FilesController : Controller
private const string BaseDirectory = "storage";
[HttpPost("touch")]
public async Task CreateFile([FromQuery] string path)
public async Task CreateFileAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalPath = Path.Combine(BaseDirectory, safePath);
@@ -31,7 +31,7 @@ public class FilesController : Controller
}
[HttpPost("mkdir")]
public Task CreateFolder([FromQuery] string path)
public Task CreateFolderAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalPath = Path.Combine(BaseDirectory, safePath);
@@ -47,7 +47,7 @@ public class FilesController : Controller
}
[HttpGet("list")]
public Task<FileSystemEntryResponse[]> List([FromQuery] string path)
public Task<FileSystemEntryResponse[]> ListAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalPath = Path.Combine(BaseDirectory, safePath);
@@ -92,7 +92,7 @@ public class FilesController : Controller
}
[HttpPost("move")]
public Task Move([FromQuery] string oldPath, [FromQuery] string newPath)
public Task MoveAsync([FromQuery] string oldPath, [FromQuery] string newPath)
{
var oldSafePath = FilePathHelper.SanitizePath(oldPath);
var newSafePath = FilePathHelper.SanitizePath(newPath);
@@ -123,7 +123,7 @@ public class FilesController : Controller
}
[HttpDelete("delete")]
public Task Delete([FromQuery] string path)
public Task DeleteAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalDirPath = Path.Combine(BaseDirectory, safePath);
@@ -141,7 +141,7 @@ public class FilesController : Controller
}
[HttpPost("upload")]
public async Task<IResult> Upload([FromQuery] string path)
public async Task<IResult> UploadAsync([FromQuery] string path)
{
if (Request.Form.Files.Count != 1)
return Results.Problem("Only one file is allowed in the request", statusCode: 400);
@@ -179,7 +179,7 @@ public class FilesController : Controller
}
[HttpGet("download")]
public async Task Download([FromQuery] string path)
public async Task DownloadAsync([FromQuery] string path)
{
var safePath = FilePathHelper.SanitizePath(path);
var physicalPath = Path.Combine(BaseDirectory, safePath);

View File

@@ -18,7 +18,7 @@ public class HangfireController : Controller
}
[HttpGet("stats")]
public Task<HangfireStatsResponse> GetStats()
public Task<HangfireStatsResponse> GetStatsAsync()
{
var statistics = JobStorage.GetMonitoringApi().GetStatistics();

View File

@@ -18,21 +18,21 @@ public class SystemController : Controller
[HttpGet]
[Authorize(Policy = "permissions:admin.system.overview")]
public async Task<SystemOverviewResponse> GetOverview()
public async Task<SystemOverviewResponse> GetOverviewAsync()
{
return new()
{
Uptime = await ApplicationService.GetUptime(),
CpuUsage = await ApplicationService.GetCpuUsage(),
MemoryUsage = await ApplicationService.GetMemoryUsage(),
OperatingSystem = await ApplicationService.GetOsName()
Uptime = await ApplicationService.GetUptimeAsync(),
CpuUsage = await ApplicationService.GetCpuUsageAsync(),
MemoryUsage = await ApplicationService.GetMemoryUsageAsync(),
OperatingSystem = await ApplicationService.GetOsNameAsync()
};
}
[HttpPost("shutdown")]
[Authorize(Policy = "permissions:admin.system.shutdown")]
public async Task Shutdown()
public async Task ShutdownAsync()
{
await ApplicationService.Shutdown();
await ApplicationService.ShutdownAsync();
}
}

View File

@@ -27,7 +27,7 @@ public class UsersController : Controller
[HttpGet]
[Authorize(Policy = "permissions:admin.users.get")]
public async Task<ActionResult<ICountedData<UserResponse>>> Get(
public async Task<ActionResult<ICountedData<UserResponse>>> GetAsync(
[FromQuery] int startIndex,
[FromQuery] int count,
[FromQuery] string? orderBy,
@@ -83,7 +83,7 @@ public class UsersController : Controller
[HttpGet("{id}")]
[Authorize(Policy = "permissions:admin.users.get")]
public async Task<ActionResult<UserResponse>> GetSingle(int id)
public async Task<ActionResult<UserResponse>> GetSingleAsync(int id)
{
var user = await UserRepository
.Get()
@@ -98,7 +98,7 @@ public class UsersController : Controller
[HttpPost]
[Authorize(Policy = "permissions:admin.users.create")]
public async Task<ActionResult<UserResponse>> Create([FromBody] CreateUserRequest request)
public async Task<ActionResult<UserResponse>> CreateAsync([FromBody] CreateUserRequest request)
{
// Reformat values
request.Username = request.Username.ToLower().Trim();
@@ -128,7 +128,7 @@ public class UsersController : Controller
[HttpPatch("{id}")]
[Authorize(Policy = "permissions:admin.users.update")]
public async Task<ActionResult<UserResponse>> Update([FromRoute] int id, [FromBody] UpdateUserRequest request)
public async Task<ActionResult<UserResponse>> UpdateAsync([FromRoute] int id, [FromBody] UpdateUserRequest request)
{
var user = await UserRepository
.Get()
@@ -171,7 +171,7 @@ public class UsersController : Controller
[HttpDelete("{id}")]
[Authorize(Policy = "permissions:admin.users.delete")]
public async Task<ActionResult> Delete([FromRoute] int id, [FromQuery] bool force = false)
public async Task<ActionResult> DeleteAsync([FromRoute] int id, [FromQuery] bool force = false)
{
var user = await UserRepository
.Get()
@@ -184,13 +184,13 @@ public class UsersController : Controller
if (!force)
{
var validationResult = await deletionService.Validate(user);
var validationResult = await deletionService.ValidateAsync(user);
if (!validationResult.IsAllowed)
return Problem("Unable to delete user", statusCode: 400, title: validationResult.Reason);
}
await deletionService.Delete(user, force);
await deletionService.DeleteAsync(user, force);
return NoContent();
}
}

View File

@@ -30,7 +30,7 @@ public class AuthController : Controller
}
[HttpGet]
public async Task<AuthSchemeResponse[]> GetSchemes()
public async Task<AuthSchemeResponse[]> GetSchemesAsync()
{
var schemes = await SchemeProvider.GetAllSchemesAsync();
@@ -47,7 +47,7 @@ public class AuthController : Controller
}
[HttpGet("{identifier:alpha}")]
public async Task StartScheme([FromRoute] string identifier)
public async Task StartSchemeAsync([FromRoute] string identifier)
{
// Validate identifier against our enable list
var allowedSchemes = Configuration.Authentication.EnabledSchemes;
@@ -91,7 +91,7 @@ public class AuthController : Controller
[Authorize]
[HttpGet("check")]
public async Task<AuthClaimResponse[]> Check()
public async Task<AuthClaimResponse[]> CheckAsync()
{
var username = User.FindFirstValue(ClaimTypes.Name)!;
var id = User.FindFirstValue(ClaimTypes.NameIdentifier)!;
@@ -113,7 +113,7 @@ public class AuthController : Controller
foreach (var extension in Extensions)
{
claims.AddRange(
await extension.GetFrontendClaims(User)
await extension.GetFrontendClaimsAsync(User)
);
}
@@ -121,7 +121,7 @@ public class AuthController : Controller
}
[HttpGet("logout")]
public async Task Logout()
public async Task LogoutAsync()
{
await HttpContext.SignOutAsync();
await Results.Redirect("/").ExecuteAsync(HttpContext);

View File

@@ -18,13 +18,13 @@ public class FrontendController : Controller
}
[HttpGet("frontend.json")]
public async Task<FrontendConfiguration> GetConfiguration()
=> await FrontendService.GetConfiguration();
public async Task<FrontendConfiguration> GetConfigurationAsync()
=> await FrontendService.GetConfigurationAsync();
[HttpGet]
public async Task<IResult> Index()
public async Task<IResult> IndexAsync()
{
var content = await FrontendService.GenerateIndexHtml();
var content = await FrontendService.GenerateIndexHtmlAsync();
return Results.Text(content, "text/html", Encoding.UTF8);
}

View File

@@ -45,29 +45,29 @@ public class LocalAuthController : Controller
[HttpGet]
[HttpGet("login")]
public async Task<IResult> Login()
public async Task<ActionResult> LoginAsync()
{
var html = await ComponentHelper.RenderComponent<Login>(ServiceProvider);
var html = await ComponentHelper.RenderToHtmlAsync<Login>(ServiceProvider);
return Results.Content(html, "text/html");
return Content(html, "text/html");
}
[HttpGet("register")]
public async Task<IResult> Register()
public async Task<ActionResult> RegisterAsync()
{
var html = await ComponentHelper.RenderComponent<Register>(ServiceProvider);
var html = await ComponentHelper.RenderToHtmlAsync<Register>(ServiceProvider);
return Results.Content(html, "text/html");
return Content(html, "text/html");
}
[HttpPost]
[HttpPost("login")]
public async Task<IResult> Login([FromForm] string email, [FromForm] string password)
public async Task<ActionResult> LoginAsync([FromForm] string email, [FromForm] string password)
{
try
{
// Perform login
var user = await InternalLogin(email, password);
var user = await InternalLoginAsync(email, password);
// Login user
var options = Options.Get(LocalAuthConstants.AuthenticationScheme);
@@ -84,34 +84,34 @@ public class LocalAuthController : Controller
), new AuthenticationProperties());
// Redirect back to wasm app
return Results.Redirect("/");
return Redirect("/");
}
catch (Exception e)
{
string errorMessage;
if (e is HttpApiException apiException)
errorMessage = apiException.Title;
if (e is AggregateException aggregateException)
errorMessage = aggregateException.Message;
else
{
errorMessage = "An internal error occured";
Logger.LogError(e, "An unhandled error occured while logging in user");
}
var html = await ComponentHelper.RenderComponent<Login>(ServiceProvider,
var html = await ComponentHelper.RenderToHtmlAsync<Login>(ServiceProvider,
parameters => { parameters["ErrorMessage"] = errorMessage; });
return Results.Content(html, "text/html");
return Content(html, "text/html");
}
}
[HttpPost("register")]
public async Task<IResult> Register([FromForm] string email, [FromForm] string password, [FromForm] string username)
public async Task<ActionResult> RegisterAsync([FromForm] string email, [FromForm] string password, [FromForm] string username)
{
try
{
// Perform register
var user = await InternalRegister(username, email, password);
var user = await InternalRegisterAsync(username, email, password);
// Login user
var options = Options.Get(LocalAuthConstants.AuthenticationScheme);
@@ -128,37 +128,37 @@ public class LocalAuthController : Controller
), new AuthenticationProperties());
// Redirect back to wasm app
return Results.Redirect("/");
return Redirect("/");
}
catch (Exception e)
{
string errorMessage;
if (e is HttpApiException apiException)
errorMessage = apiException.Title;
if (e is AggregateException aggregateException)
errorMessage = aggregateException.Message;
else
{
errorMessage = "An internal error occured";
Logger.LogError(e, "An unhandled error occured while logging in user");
}
var html = await ComponentHelper.RenderComponent<Register>(ServiceProvider,
var html = await ComponentHelper.RenderToHtmlAsync<Register>(ServiceProvider,
parameters => { parameters["ErrorMessage"] = errorMessage; });
return Results.Content(html, "text/html");
return Content(html, "text/html");
}
}
private async Task<User> InternalRegister(string username, string email, string password)
private async Task<User> InternalRegisterAsync(string username, string email, string password)
{
email = email.ToLower();
username = username.ToLower();
if (await UserRepository.Get().AnyAsync(x => x.Username == username))
throw new HttpApiException("A account with that username already exists", 400);
throw new AggregateException("A account with that username already exists");
if (await UserRepository.Get().AnyAsync(x => x.Email == email))
throw new HttpApiException("A account with that email already exists", 400);
throw new AggregateException("A account with that email already exists");
string[] permissions = [];
@@ -185,7 +185,7 @@ public class LocalAuthController : Controller
return finalUser;
}
private async Task<User> InternalLogin(string email, string password)
private async Task<User> InternalLoginAsync(string email, string password)
{
email = email.ToLower();
@@ -194,10 +194,10 @@ public class LocalAuthController : Controller
.FirstOrDefaultAsync(x => x.Email == email);
if (user == null)
throw new HttpApiException("Invalid combination of email and password", 400);
throw new AggregateException("Invalid combination of email and password");
if (!HashHelper.Verify(password, user.Password))
throw new HttpApiException("Invalid combination of email and password", 400);
throw new AggregateException("Invalid combination of email and password");
return user;
}

View File

@@ -24,7 +24,7 @@ public class SwaggerController : Controller
[HttpGet]
[Authorize]
public async Task<ActionResult> Get()
public async Task<ActionResult> GetAsync()
{
if (!Configuration.Development.EnableApiDocs)
return BadRequest("Api docs are disabled");
@@ -32,7 +32,7 @@ public class SwaggerController : Controller
var options = new ApiDocsOptions();
var optionsJson = JsonSerializer.Serialize(options);
var html = await ComponentHelper.RenderComponent<SwaggerPage>(
var html = await ComponentHelper.RenderToHtmlAsync<SwaggerPage>(
ServiceProvider,
parameters =>
{