mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 06:20:34 +00:00
Misc code improvements
This commit is contained in:
@@ -111,10 +111,10 @@ internal static partial class NativeMethods {
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
#if NETFRAMEWORK
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern bool ShowWindow(nint hWnd, int nCmdShow);
|
||||
internal static extern void ShowWindow(nint hWnd, int nCmdShow);
|
||||
#else
|
||||
[LibraryImport("user32.dll")]
|
||||
internal static partial bool ShowWindow(nint hWnd, int nCmdShow);
|
||||
internal static partial void ShowWindow(nint hWnd, int nCmdShow);
|
||||
#endif
|
||||
|
||||
[Flags]
|
||||
|
||||
@@ -31,14 +31,14 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ArchiSteamFarm.IPC.Controllers.Api;
|
||||
|
||||
[Route("Api/IPC")]
|
||||
public sealed class IPCController : ArchiController {
|
||||
[Route("Api/IPC/Bans")]
|
||||
public sealed class IPCBansController : ArchiController {
|
||||
/// <summary>
|
||||
/// Clears the list of all IP addresses currently blocked by ASFs IPC module
|
||||
/// </summary>
|
||||
[HttpDelete("Bans")]
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)]
|
||||
public ActionResult<GenericResponse> BansDelete() {
|
||||
public ActionResult<GenericResponse> Delete() {
|
||||
ApiAuthenticationMiddleware.ClearFailedAuthorizations();
|
||||
|
||||
return Ok(new GenericResponse(true));
|
||||
@@ -47,10 +47,10 @@ public sealed class IPCController : ArchiController {
|
||||
/// <summary>
|
||||
/// Removes an IP address from the list of addresses currently blocked by ASFs IPC module
|
||||
/// </summary>
|
||||
[HttpDelete("Bans/{ipAddress:required}")]
|
||||
[HttpDelete("{ipAddress:required}")]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public ActionResult<GenericResponse> BansDeleteSpecific(string ipAddress) {
|
||||
public ActionResult<GenericResponse> DeleteSpecific(string ipAddress) {
|
||||
if (string.IsNullOrEmpty(ipAddress)) {
|
||||
throw new ArgumentNullException(nameof(ipAddress));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public sealed class IPCController : ArchiController {
|
||||
/// <summary>
|
||||
/// Gets all IP addresses currently blocked by ASFs IPC module
|
||||
/// </summary>
|
||||
[HttpGet("Bans")]
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(GenericResponse<ISet<string>>), (int) HttpStatusCode.OK)]
|
||||
public ActionResult<GenericResponse<ISet<string>>> BansGet() => Ok(new GenericResponse<ISet<string>>(ApiAuthenticationMiddleware.GetCurrentlyBannedIPs().Select(static ip => ip.ToString()).ToHashSet()));
|
||||
public ActionResult<GenericResponse<ISet<string>>> Get() => Ok(new GenericResponse<ISet<string>>(ApiAuthenticationMiddleware.GetCurrentlyBannedIPs().Select(static ip => ip.ToString()).ToHashSet()));
|
||||
}
|
||||
Reference in New Issue
Block a user