mirror of
https://github.com/yawaflua/oembed-tests.yawaflua.ru.git
synced 2025-12-13 17:06:25 +02:00
Add project files.
This commit is contained in:
25
Controllers/OembedController.cs
Normal file
25
Controllers/OembedController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace OembedTests.Controllers
|
||||
{
|
||||
[Route("/oembed")]
|
||||
[ApiController]
|
||||
public class OembedController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetOembed([FromQuery]string url, [FromQuery] string? format = "json")
|
||||
{
|
||||
var userName = url.Replace("https://oembed-test.yawaflua.ru/pay/", "");
|
||||
var response = $@"{{
|
||||
""version"": ""1.0"",
|
||||
""type"": ""link"",
|
||||
""provider_name"": ""SP-Donate"",
|
||||
""provider_url"": ""https://sp-donate.ru/"",
|
||||
""title"": ""Donate to {userName} right now!"",
|
||||
""thumbnail_url"": ""https://avatar.spworlds.ru/front/240/{userName}""
|
||||
}}";
|
||||
return Ok(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Controllers/WeatherForecastController.cs
Normal file
16
Controllers/WeatherForecastController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace OembedTests.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("pay")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
|
||||
[HttpGet("/{userName}")]
|
||||
public async Task<IActionResult> Get(string userName)
|
||||
{
|
||||
return Ok(userName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user