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

Compare commits

..

No commits in common. "5ca12b1530ccf93f3b27ad97d9f3022874c945b7" and "ead8d901f3142eba1fa91a7da0be0d6a64e4b4a4" have entirely different histories.

3 changed files with 10 additions and 10 deletions

View File

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

View File

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

View File

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