mirror of
https://github.com/yawaflua/SkinsApi.git
synced 2025-12-09 03:49:32 +02:00
add one more controller for legacy
This commit is contained in:
39
Controllers/v1/AnotherSkinsController.cs
Normal file
39
Controllers/v1/AnotherSkinsController.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SkinsApi.Interfaces.Services;
|
||||
|
||||
namespace SkinsApi.Controllers.v1
|
||||
{
|
||||
[Route("/skin/")]
|
||||
[ApiController]
|
||||
public class AnotherSkinsController ( ISkinService skinService) : ControllerBase
|
||||
{
|
||||
[HttpGet("{skin_type}/{width}/{user}")]
|
||||
[Produces("image/png")]
|
||||
[ProducesResponseType(200)]
|
||||
public async Task<IActionResult> GetSkin(string skin_type, int width, string user)
|
||||
{
|
||||
try
|
||||
{
|
||||
Stream stream;
|
||||
switch (skin_type)
|
||||
{
|
||||
case "face":
|
||||
stream = (await skinService.GetSkinStreamAsync(user)).GetFace(width);
|
||||
break;
|
||||
case "front":
|
||||
stream = (await skinService.GetSkinStreamAsync(user)).GetBody(width);
|
||||
break;
|
||||
default:
|
||||
stream = (await skinService.GetSkinStreamAsync(user)).GetFull(width);
|
||||
break;
|
||||
|
||||
}
|
||||
return File(stream, "image/png");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user