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