mirror of
https://github.com/yawaflua/PL_JusticeBot.git
synced 2025-12-10 04:19:31 +02:00
hotfix v2
This commit is contained in:
@@ -6,11 +6,11 @@ using System.Text.Json.Nodes;
|
|||||||
namespace DiscordApp.Controllers
|
namespace DiscordApp.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]/")]
|
[Route("[controller]")]
|
||||||
public class redirects : ControllerBase
|
public class redirects : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
[HttpGet("redirects/{uri}")]
|
[HttpGet("/redirects/{uri}")]
|
||||||
public IActionResult Get(string uri)
|
public IActionResult Get(string uri)
|
||||||
{
|
{
|
||||||
var data = Startup.appDbContext.Redirects.First(k => k.Id == uri);
|
var data = Startup.appDbContext.Redirects.First(k => k.Id == uri);
|
||||||
@@ -19,7 +19,7 @@ namespace DiscordApp.Controllers
|
|||||||
return Redirect(data.url);
|
return Redirect(data.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("addOnMap")]
|
[HttpPost("/addOnMap")]
|
||||||
public ActionResult Create(string bodyContent)
|
public ActionResult Create(string bodyContent)
|
||||||
{
|
{
|
||||||
JsonNode jsonBodyContent = JsonNode.Parse(bodyContent);
|
JsonNode jsonBodyContent = JsonNode.Parse(bodyContent);
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
Amount = 16,
|
Amount = 16,
|
||||||
Data = $"user:{Context.User.Id};channel:{Context.Channel.Id};",
|
Data = $"user:{Context.User.Id};channel:{Context.Channel.Id};",
|
||||||
RedirectUrl = Context.Interaction.GetOriginalResponseAsync().Result.GetJumpUrl(),
|
RedirectUrl = Context.Interaction.GetOriginalResponseAsync().Result.GetJumpUrl(),
|
||||||
WebHookUrl = "https://api.yawaflua.ru/addOnMap/"
|
WebHookUrl = "https://discord.yawaflua.ru/addOnMap/"
|
||||||
};
|
};
|
||||||
var uri = await Startup.sp.InitPayment(paymentData);
|
var uri = await Startup.sp.InitPayment(paymentData);
|
||||||
var redirectUri = Guid.NewGuid().ToString();
|
var redirectUri = Guid.NewGuid().ToString();
|
||||||
var redirectTable = new Redirects() { Id = redirectUri , url = uri};
|
var redirectTable = new Redirects() { Id = redirectUri , url = uri};
|
||||||
Startup.appDbContext.Redirects.Add(redirectTable);
|
Startup.appDbContext.Redirects.Add(redirectTable);
|
||||||
Startup.appDbContext.SaveChanges();
|
Startup.appDbContext.SaveChanges();
|
||||||
await FollowupAsync("Нажмите на кнопку ниже для оплаты", components: new ComponentBuilder().WithButton("Оплатить", url: $"https://api.yawaflua.ru/redirects/{redirectUri}", style: ButtonStyle.Link).Build());//, ephemeral: true);
|
await FollowupAsync("Нажмите на кнопку ниже для оплаты", components: new ComponentBuilder().WithButton("Оплатить", url: $"https://discord.yawaflua.ru/redirects/{redirectUri}", style: ButtonStyle.Link).Build());//, ephemeral: true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace DiscordApp
|
|||||||
}
|
}
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors(k => { k.AllowAnyHeader(); k.AllowAnyMethod(); k.AllowAnyOrigin(); });
|
app.UseCors(k => { k.AllowAnyHeader(); k.AllowAnyMethod(); k.AllowAnyOrigin(); k.WithMethods("POST", "GET"); });
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
|
|||||||
Reference in New Issue
Block a user