UApi work, nix test vm cleanup

This commit is contained in:
Rory&
2026-02-25 09:00:13 +01:00
parent ddfae45ed0
commit f90d9e098d
8 changed files with 96 additions and 15 deletions

View File

@@ -0,0 +1,84 @@
using System.Text.Json.Serialization;
using ArcaneLibs.Collections;
using Microsoft.AspNetCore.Mvc;
namespace Spacebar.UApi.Controllers.Applications;
[ApiController]
[Route("/api/v{_}/applications/{applicationId}/")]
public class ApplicationRpcController : ControllerBase {
private static LruCache<object> _rpcInfoCache = new(10000);
// [HttpGet]
// public async Task<object> GetApplicationRpcInfo(string applicationId) {
//
// }
[HttpGet("disclosures")]
public ApplicationDisclosures GetApplicationDisclosures(string applicationId) {
return new ApplicationDisclosures {
Disclosures = [],
AckedDisclosures = [],
AllAcked = true
};
}
[HttpPost("disclosures")]
public ApplicationDisclosures AckApplicationDisclosures(string applicationId) {
// TODO: type is wrong, normally only `disclosures` is returned
return new ApplicationDisclosures {
Disclosures = [],
AckedDisclosures = [],
AllAcked = true
};
}
}
public class ApplicationDisclosures {
[JsonPropertyName("disclosures")]
public List<ApplicationDisclosures.Type> Disclosures { get; set; }
[JsonPropertyName("acked_disclosures")]
public List<ApplicationDisclosures.Type> AckedDisclosures { get; set; }
[JsonPropertyName("all_acked")]
public bool AllAcked { get; set; }
public enum Type {
UnspecifiedDisclosure = 0,
IpLocation = 1,
DisplaysAdvertisements = 2,
PartnerSdkDataSharingMessage = 3
}
}
public class RpcApplicationInfo {
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("icon")]
public string Icon { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("summary")]
public string Summary { get; set; }
[JsonPropertyName("type")]
public ApplicationType? Type { get; set; } // what is this?
[JsonPropertyName("verify_key")]
public string VerifyKey { get; set; }
}
[Flags]
public enum ApplicationType {
DeprecatedGame,
Music,
TicketedEvents,
CreatorMonetization,
Game
}

View File

@@ -8,6 +8,7 @@ using Spacebar.Models.Generic;
namespace Spacebar.UApi.Controllers;
[Route("/api/v{_}/guilds/{guildId}/members/")]
[ApiController]
public class GuildMembersController(ILogger<GuildMembersController> logger, SpacebarDbContext db, SpacebarAspNetAuthenticationService authService) : ControllerBase {
/// <summary>
/// Get a guild member by ID

View File

@@ -112,6 +112,7 @@ app.Map("/", async context => {
foreach (var header in responseMessage.Headers) context.Response.Headers[header.Key] = header.Value.ToArray();
foreach (var header in responseMessage.Content.Headers) context.Response.Headers[header.Key] = header.Value.ToArray();
context.Response.Headers["X-SB-UApi-Status"] = "MISSING";
// await responseMessage.Content.CopyToAsync(context.Response.Body);
var txt = await responseMessage.Content.ReadAsStringAsync();

BIN
flake.lock generated

Binary file not shown.

View File

@@ -4,6 +4,11 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master"; # temp hack because unstable is frozen
flake-utils.url = "github:numtide/flake-utils";
pion-webrtc = {
url = "github:spacebarchat/pion-webrtc";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs =
@@ -11,6 +16,7 @@
self,
nixpkgs,
flake-utils,
pion-webrtc
}:
nixpkgs.lib.recursiveUpdate
(
@@ -35,6 +41,7 @@
packages = {
default = (pkgs.callPackage (import ./default.nix { inherit self rVersion; })) { };
nodeModules = (pkgs.callPackage ./node-modules.nix) { };
pion-sfu = pion-webrtc.packages.${system}.default;
};
containers = {

View File

@@ -1,7 +1,7 @@
{ pkgs, lib, ... }:
{ lib, ... }:
{
#perlless profile
# system.switch.enable = lib.mkForce false;
#system.switch.enable = lib.mkForce false;
# Remove perl from activation
#system.etc.overlay.enable = lib.mkForce true;

View File

@@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ pkgs, ... }:
{
services.postgresql = {

View File

@@ -1,6 +1,4 @@
{
nixpkgs,
modulesPath,
pkgs,
lib,
...
@@ -55,14 +53,4 @@
font = "${pkgs.cozette}/share/consolefonts/cozette6x13.psfu";
packages = with pkgs; [ cozette ];
};
system = {
#activatable = false;
copySystemConfiguration = false;
includeBuildDependencies = false;
disableInstallerTools = lib.mkForce true;
build = {
separateActivationScript = true;
};
};
}