2025-08-01 00:30:05 +07:00
|
|
|
using lilos_stitcher;
|
2025-07-31 23:56:15 +07:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace LiloStitcher;
|
|
|
|
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route( "api/image" )]
|
2025-08-01 00:30:05 +07:00
|
|
|
public sealed class LiloController( lilos_stitcher.LiloStitcher stitcher ) : ControllerBase
|
2025-07-31 23:56:15 +07:00
|
|
|
{
|
2025-08-01 00:30:05 +07:00
|
|
|
[HttpPost]
|
|
|
|
|
[Route( "generate" )]
|
|
|
|
|
[Produces( "image/png" )]
|
|
|
|
|
public async Task<IActionResult> Generate( [FromBody] GenerateRequest payload, CancellationToken ct )
|
|
|
|
|
{
|
|
|
|
|
string path = await stitcher.CreateImageAsync( payload, ct );
|
|
|
|
|
return PhysicalFile(path, "image/png", enableRangeProcessing: false);
|
|
|
|
|
}
|
2025-07-31 23:56:15 +07:00
|
|
|
}
|