diff --git a/CannedNet/Services/Controllers/APIController.cs b/CannedNet/Services/Controllers/APIController.cs index 97a2bce..86d3ef3 100644 --- a/CannedNet/Services/Controllers/APIController.cs +++ b/CannedNet/Services/Controllers/APIController.cs @@ -1171,22 +1171,6 @@ public class APIController : ControllerBase return Results.Json(consumables); } - [HttpGet("storefronts/v4/balance/2")] - [Authorize] - public async Task GetStorefrontBalance(AppDbContext db) - { - if (!int.TryParse(User.Identity?.Name, out var id)) - return Results.Unauthorized(); - - var balance = await db.TokenBalances - .Where(s => s.Id == id) - .ToListAsync(); - - return Results.Json(balance); - } - - - [HttpGet("challenge/v2/getCurrent")] public async Task GetCurrentChallenge() { @@ -1208,33 +1192,6 @@ public class APIController : ControllerBase return Results.Json(items); } - [HttpGet("avatar/v2/gifts")] - [Authorize] - public async Task GetGifts(AppDbContext db) - { - try - { - if (!int.TryParse(User.Identity?.Name, out var id)) - return Results.Unauthorized(); - - var pendingGifts = await db.ReceivedGifts - .Where(rg => rg.ReceiverAccountId == id && !rg.IsConsumed) - .ToListAsync(); - - return Results.Json(pendingGifts); - } - catch (Exception ex) - { - return Results.Problem($"Error retrieving gifts: {ex.Message}"); - } - } - - [HttpGet("gamerewards/v1/pending")] - public async Task GetGameRewardsPending() - { - return Results.Content("[]", "application/json"); - } - [HttpGet("roomkeys/v1/mine")] public async Task GetRoomKeysMine() { @@ -1313,6 +1270,13 @@ public class APIController : ControllerBase return ids; } + [HttpGet("customAvatarItems/v1/isCreationEnabled")] + [HttpGet("customAvatarItems/v1/isRenderingEnabled")] + public IResult CustomAvatarItemsEnabled() + { + return Results.Ok(true); + } + private static readonly string ImagesDir; diff --git a/CannedNet/Services/Controllers/AdminController.cs b/CannedNet/Services/Controllers/AdminController.cs new file mode 100644 index 0000000..0502af0 --- /dev/null +++ b/CannedNet/Services/Controllers/AdminController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; + +namespace CannedNet.Services.Controllers; + +[ApiController, Route("admin")] +public class AdminController : ControllerBase +{ + [HttpGet] + public async Task GetRoot() + { + // TODO: allow getting admin panel from here + return Results.NoContent(); + } +} diff --git a/CannedNet/Services/Controllers/EconController.cs b/CannedNet/Services/Controllers/EconController.cs index cb67a66..7d688ff 100644 --- a/CannedNet/Services/Controllers/EconController.cs +++ b/CannedNet/Services/Controllers/EconController.cs @@ -330,4 +330,45 @@ public class EconController : ControllerBase var response = new { storefront.Id, storefront.Name, storefront.StorefrontType, storefront.NextUpdate, StoreItems = storeItems }; return Results.Ok(response); } + + [HttpGet("api/storefronts/v4/balance/2")] + [Authorize] + public async Task GetStorefrontBalance(AppDbContext db) + { + if (!int.TryParse(User.Identity?.Name, out var id)) + return Results.Unauthorized(); + + var balance = await db.TokenBalances + .Where(s => s.Id == id) + .ToListAsync(); + + return Results.Json(balance); + } + + [HttpGet("api/avatar/v2/gifts")] + [Authorize] + public async Task GetGifts(AppDbContext db) + { + try + { + if (!int.TryParse(User.Identity?.Name, out var id)) + return Results.Unauthorized(); + + var pendingGifts = await db.ReceivedGifts + .Where(rg => rg.ReceiverAccountId == id && !rg.IsConsumed) + .ToListAsync(); + + return Results.Json(pendingGifts); + } + catch (Exception ex) + { + return Results.Problem($"Error retrieving gifts: {ex.Message}"); + } + } + + [HttpGet("api/gamerewards/v1/pending")] + public async Task GetGameRewardsPending() + { + return Results.Content("[]", "application/json"); + } } diff --git a/CannedNet/Services/Controllers/NSController.cs b/CannedNet/Services/Controllers/NSController.cs index 5cba3e8..7ba3bb8 100644 --- a/CannedNet/Services/Controllers/NSController.cs +++ b/CannedNet/Services/Controllers/NSController.cs @@ -7,7 +7,8 @@ namespace CannedNet.Services.Controllers; public class NSController : ControllerBase { [HttpGet] - public async Task Get() { + public async Task Get() + { string json = await System.IO.File.ReadAllTextAsync("JSON/endpoints.json"); return Results.Content(json, "application/json"); }