summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-02-25 09:00:13 +0100
committerRory& <root@rory.gay>2026-02-25 09:00:13 +0100
commitf90d9e098d68bfa3a4695dde2e75be5daa6b8981 (patch)
treed27798d8c2452deb1a89aeeb8f5cb334426008d7
parentTry to inherit permissions from everyoen role on creation (may be wrong) (diff)
downloadserver-ts-f90d9e098d68bfa3a4695dde2e75be5daa6b8981.tar.xz
UApi work, nix test vm cleanup
-rw-r--r--extra/admin-api/Spacebar.UApi/Controllers/Applications/ApplicationRpcController.cs84
-rw-r--r--extra/admin-api/Spacebar.UApi/Controllers/GuildMembersController.cs1
-rw-r--r--extra/admin-api/Spacebar.UApi/Program.cs1
-rw-r--r--flake.lock32
-rw-r--r--flake.nix7
-rw-r--r--nix/testVm/perlless.nix4
-rw-r--r--nix/testVm/postgres.nix2
-rw-r--r--nix/testVm/vm.nix12
8 files changed, 124 insertions, 19 deletions
diff --git a/extra/admin-api/Spacebar.UApi/Controllers/Applications/ApplicationRpcController.cs b/extra/admin-api/Spacebar.UApi/Controllers/Applications/ApplicationRpcController.cs
new file mode 100644

index 00000000..fdb020f4 --- /dev/null +++ b/extra/admin-api/Spacebar.UApi/Controllers/Applications/ApplicationRpcController.cs
@@ -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 +} \ No newline at end of file diff --git a/extra/admin-api/Spacebar.UApi/Controllers/GuildMembersController.cs b/extra/admin-api/Spacebar.UApi/Controllers/GuildMembersController.cs
index ac8c1d40..9f18624e 100644 --- a/extra/admin-api/Spacebar.UApi/Controllers/GuildMembersController.cs +++ b/extra/admin-api/Spacebar.UApi/Controllers/GuildMembersController.cs
@@ -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 diff --git a/extra/admin-api/Spacebar.UApi/Program.cs b/extra/admin-api/Spacebar.UApi/Program.cs
index 326d0a9c..f6ce9829 100644 --- a/extra/admin-api/Spacebar.UApi/Program.cs +++ b/extra/admin-api/Spacebar.UApi/Program.cs
@@ -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(); diff --git a/flake.lock b/flake.lock
index abb78335..7e174fe2 100644 --- a/flake.lock +++ b/flake.lock
@@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1771807909, - "narHash": "sha256-EIBJlDXxqYpmUDvZ/H13BZwRtMbaKqJYDbrYNGkKGfk=", + "lastModified": 1772001049, + "narHash": "sha256-W03sIIWi0tGCCVKjfuBwktvuKbXq10SwFDuhqQhoAm0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e2e54a67c07f3dcc70ffbb769dc5cb011a28fcc6", + "rev": "4e331cc3846f585943eb6f3eef9f00ace010e750", "type": "github" }, "original": { @@ -34,10 +34,34 @@ "type": "github" } }, + "pion-webrtc": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771973132, + "narHash": "sha256-u6yRmdUoleHzCTxG19O879hbqw3/N0PVVDsfVzZd2HM=", + "owner": "spacebarchat", + "repo": "pion-webrtc", + "rev": "afd11d2c7c8f571296b8e21f52cf341bd2f94160", + "type": "github" + }, + "original": { + "owner": "spacebarchat", + "repo": "pion-webrtc", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "pion-webrtc": "pion-webrtc" } }, "systems": { diff --git a/flake.nix b/flake.nix
index 59bae244..d5a4aa42 100644 --- a/flake.nix +++ b/flake.nix
@@ -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 = { diff --git a/nix/testVm/perlless.nix b/nix/testVm/perlless.nix
index 6d391569..669be83c 100644 --- a/nix/testVm/perlless.nix +++ b/nix/testVm/perlless.nix
@@ -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; diff --git a/nix/testVm/postgres.nix b/nix/testVm/postgres.nix
index 015f6d96..0190c275 100644 --- a/nix/testVm/postgres.nix +++ b/nix/testVm/postgres.nix
@@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { services.postgresql = { diff --git a/nix/testVm/vm.nix b/nix/testVm/vm.nix
index 8a282135..1c9d7add 100644 --- a/nix/testVm/vm.nix +++ b/nix/testVm/vm.nix
@@ -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; - }; - }; }