oops, didnt push everything 2/2 of prev commit

This commit is contained in:
Lapis
2026-06-16 17:41:44 -04:00
parent 7bd4b6f838
commit a7b6f897c4
4 changed files with 64 additions and 44 deletions
@@ -1171,22 +1171,6 @@ public class APIController : ControllerBase
return Results.Json(consumables); return Results.Json(consumables);
} }
[HttpGet("storefronts/v4/balance/2")]
[Authorize]
public async Task<IResult> 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")] [HttpGet("challenge/v2/getCurrent")]
public async Task<IResult> GetCurrentChallenge() public async Task<IResult> GetCurrentChallenge()
{ {
@@ -1208,33 +1192,6 @@ public class APIController : ControllerBase
return Results.Json(items); return Results.Json(items);
} }
[HttpGet("avatar/v2/gifts")]
[Authorize]
public async Task<IResult> 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<IResult> GetGameRewardsPending()
{
return Results.Content("[]", "application/json");
}
[HttpGet("roomkeys/v1/mine")] [HttpGet("roomkeys/v1/mine")]
public async Task<IResult> GetRoomKeysMine() public async Task<IResult> GetRoomKeysMine()
{ {
@@ -1313,6 +1270,13 @@ public class APIController : ControllerBase
return ids; return ids;
} }
[HttpGet("customAvatarItems/v1/isCreationEnabled")]
[HttpGet("customAvatarItems/v1/isRenderingEnabled")]
public IResult CustomAvatarItemsEnabled()
{
return Results.Ok(true);
}
private static readonly string ImagesDir; private static readonly string ImagesDir;
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
namespace CannedNet.Services.Controllers;
[ApiController, Route("admin")]
public class AdminController : ControllerBase
{
[HttpGet]
public async Task<IResult> GetRoot()
{
// TODO: allow getting admin panel from here
return Results.NoContent();
}
}
@@ -330,4 +330,45 @@ public class EconController : ControllerBase
var response = new { storefront.Id, storefront.Name, storefront.StorefrontType, storefront.NextUpdate, StoreItems = storeItems }; var response = new { storefront.Id, storefront.Name, storefront.StorefrontType, storefront.NextUpdate, StoreItems = storeItems };
return Results.Ok(response); return Results.Ok(response);
} }
[HttpGet("api/storefronts/v4/balance/2")]
[Authorize]
public async Task<IResult> 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<IResult> 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<IResult> GetGameRewardsPending()
{
return Results.Content("[]", "application/json");
}
} }
@@ -7,7 +7,8 @@ namespace CannedNet.Services.Controllers;
public class NSController : ControllerBase public class NSController : ControllerBase
{ {
[HttpGet] [HttpGet]
public async Task<IResult> Get() { public async Task<IResult> Get()
{
string json = await System.IO.File.ReadAllTextAsync("JSON/endpoints.json"); string json = await System.IO.File.ReadAllTextAsync("JSON/endpoints.json");
return Results.Content(json, "application/json"); return Results.Content(json, "application/json");
} }