mirror of
https://github.com/CannedNet/CannedNet.git
synced 2026-10-25 23:18:54 -07:00
oops, didnt push everything 2/2 of prev commit
This commit is contained in:
@@ -1171,22 +1171,6 @@ public class APIController : ControllerBase
|
||||
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")]
|
||||
public async Task<IResult> GetCurrentChallenge()
|
||||
{
|
||||
@@ -1208,33 +1192,6 @@ public class APIController : ControllerBase
|
||||
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")]
|
||||
public async Task<IResult> 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;
|
||||
|
||||
@@ -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 };
|
||||
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
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IResult> Get() {
|
||||
public async Task<IResult> Get()
|
||||
{
|
||||
string json = await System.IO.File.ReadAllTextAsync("JSON/endpoints.json");
|
||||
return Results.Content(json, "application/json");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user