1
1
mirror of https://github.com/CyberL1/MyMcRealms.git synced 2025-04-02 14:08:36 -04:00

Compare commits

...

3 Commits

Author SHA1 Message Date
5ca12b1530 fix: id -> wId 2024-05-22 07:40:30 +02:00
4a34048841 fix: /subscriptions 2024-05-22 07:00:26 +02:00
f48ded5ceb fix: realm owner checking 2024-05-22 06:56:14 +02:00
3 changed files with 10 additions and 10 deletions

View File

@ -8,9 +8,9 @@ namespace Minecraft_Realms_Emulator.Controllers
[RequireMinecraftCookie]
public class SubscriptionsController : ControllerBase
{
[HttpGet("{id}")]
[HttpGet("{wId}")]
[CheckRealmOwner]
public ActionResult<string> GetSubscription(int id)
public ActionResult<string> GetSubscription(int wId)
{
return BadRequest("No subscription for you :(");
}

View File

@ -147,18 +147,18 @@ namespace MyMcRealms.Controllers
[HttpPost("{wId}/reset")]
[CheckRealmOwner]
public ActionResult<string> ChangeSlot(int id)
public ActionResult<string> ChangeSlot(int wId)
{
return BadRequest("lol nice try");
}
[HttpPut("{id}/open")]
[HttpPut("{wId}/open")]
[CheckRealmOwner]
public async Task<ActionResult<bool>> Open(int id)
public async Task<ActionResult<bool>> Open(int wId)
{
var _api = new MyMcAPI.Wrapper(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
var world = (await _api.GetAllServers()).Servers[id];
var world = (await _api.GetAllServers()).Servers[wId];
var api = new MyMcAPI.Wrapper(world.OwnersToken);
if (world == null) return NotFound("World not found");
@ -168,13 +168,13 @@ namespace MyMcRealms.Controllers
return Ok(true);
}
[HttpPut("{id}/close")]
[HttpPut("{wId}/close")]
[CheckRealmOwner]
public async Task<ActionResult<bool>> Close(int id)
public async Task<ActionResult<bool>> Close(int wId)
{
var _api = new MyMcAPI.Wrapper(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
var world = (await _api.GetAllServers()).Servers[id];
var world = (await _api.GetAllServers()).Servers[wId];
var api = new MyMcAPI.Wrapper(world.OwnersToken);
if (world == null) return NotFound("World not found");

View File

@ -36,7 +36,7 @@ namespace Minecraft_Realms_Emulator.Middlewares
return;
}
if (!attribute.IsRealmOwner(playerUUID, server.Ops[0].Uuid))
if (!attribute.IsRealmOwner(playerUUID, server.Ops[0].Uuid.Replace("-", "")))
{
httpContext.Response.StatusCode = 403;
await httpContext.Response.WriteAsync("You don't own this world");