mirror of
https://github.com/yawaflua/SkinsApi.git
synced 2025-12-09 03:49:32 +02:00
Add ping controller and cleaning code
This commit is contained in:
15
Controllers/Default/PingController.cs
Normal file
15
Controllers/Default/PingController.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace SkinsApi.Controllers.Default
|
||||||
|
{
|
||||||
|
[Route("/ping")]
|
||||||
|
[ApiController]
|
||||||
|
public class PingController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Ping()
|
||||||
|
{
|
||||||
|
return Ok("Pong");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.RateLimiting;
|
|
||||||
using SkinsApi.Interfaces.Services;
|
using SkinsApi.Interfaces.Services;
|
||||||
|
|
||||||
namespace SkinsApi.Controllers.v1
|
namespace SkinsApi.Controllers.v1
|
||||||
@@ -50,7 +49,8 @@ namespace SkinsApi.Controllers.v1
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return File((await skinService.GetSkinStreamAsync(user)).GetBody(width), "image/png");
|
return File((await skinService.GetSkinStreamAsync(user)).GetBody(width), "image/png");
|
||||||
} catch(Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ using SkinsApi.Interfaces.SkinService;
|
|||||||
using SkinsApi.Models;
|
using SkinsApi.Models;
|
||||||
using SkinsApi.Models.SkinService;
|
using SkinsApi.Models.SkinService;
|
||||||
using SkinsApi.Sources;
|
using SkinsApi.Sources;
|
||||||
using System.Buffers.Text;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace SkinsApi.Services
|
namespace SkinsApi.Services
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.Formats;
|
|
||||||
using SixLabors.ImageSharp.Formats.Png;
|
using SixLabors.ImageSharp.Formats.Png;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
using SixLabors.ImageSharp.Processing;
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
|||||||
12
Startup.cs
12
Startup.cs
@@ -1,13 +1,9 @@
|
|||||||
using Microsoft.OpenApi.Models;
|
using AspNetCoreRateLimit;
|
||||||
using System.Net.Http.Headers;
|
using Microsoft.OpenApi.Models;
|
||||||
using System.Net;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using SkinsApi.Interfaces.Services;
|
using SkinsApi.Interfaces.Services;
|
||||||
using SkinsApi.Services;
|
using SkinsApi.Services;
|
||||||
using System.Threading.RateLimiting;
|
using System.Reflection;
|
||||||
using SixLabors.ImageSharp;
|
using System.Text.Json.Serialization;
|
||||||
using AspNetCoreRateLimit;
|
|
||||||
|
|
||||||
namespace SkinsApi
|
namespace SkinsApi
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user