diff --git a/extra/admin-api/.idea/.idea.SpacebarAdminAPI/.idea/indexLayout.xml b/extra/admin-api/.idea/.idea.SpacebarAdminAPI/.idea/indexLayout.xml index 0e04cc861..46a462190 100644 --- a/extra/admin-api/.idea/.idea.SpacebarAdminAPI/.idea/indexLayout.xml +++ b/extra/admin-api/.idea/.idea.SpacebarAdminAPI/.idea/indexLayout.xml @@ -2,6 +2,7 @@ + Models/db-patches ../../nix diff --git a/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs b/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs index f0aa08790..70fe581d0 100644 --- a/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs +++ b/extra/admin-api/Models/Spacebar.Models.Db/Models/User.cs @@ -89,7 +89,7 @@ public partial class User [Column("email", TypeName = "character varying")] public string? Email { get; set; } - [Column("flags")] + [Column("flags", TypeName = "character varying")] public ulong Flags { get; set; } [Column("public_flags")] diff --git a/extra/admin-api/Models/Spacebar.Models.Gateway/GuildSyncResponse.cs b/extra/admin-api/Models/Spacebar.Models.Gateway/GuildSyncResponse.cs new file mode 100644 index 000000000..566e6c83d --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Gateway/GuildSyncResponse.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; +using Spacebar.Models.Generic; + +namespace Spacebar.Models.Gateway; + +public class GuildSyncResponse { + [JsonPropertyName("id")] + public string GuildId { get; set; } + + [JsonPropertyName("presences")] + public List Presences { get; set; } + + [JsonPropertyName("members")] + public List Members { get; set; } +} \ No newline at end of file diff --git a/extra/admin-api/Models/Spacebar.Models.Gateway/PresenceResponse.cs b/extra/admin-api/Models/Spacebar.Models.Gateway/PresenceResponse.cs new file mode 100644 index 000000000..53d4cb248 --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Gateway/PresenceResponse.cs @@ -0,0 +1,49 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using Spacebar.Models.Generic; + +namespace Spacebar.Models.Gateway; + +public class PresenceResponse { + [JsonPropertyName("user")] + public required PartialUser User { get; set; } + + [JsonPropertyName("guild_id"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? GuildId { get; set; } + + [JsonPropertyName("status")] + public string Status { get; set; } = "unknown"; + + // TODO + [JsonPropertyName("activities")] + public List Activities { get; set; } + + // TODO + [JsonPropertyName("hidden_activities")] + public List HiddenActivities { get; set; } + + [JsonPropertyName("client_status")] + public ClientStatuses ClientStatus { get; set; } + + [JsonPropertyName("has_played_game")] + public bool? HasPlayedGame { get; set; } + + [SuppressMessage("ReSharper", "UnusedMember.Local")] + public class ClientStatuses { + [JsonPropertyName("desktop"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Desktop { get; set; } + + [JsonPropertyName("mobile"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Mobile { get; set; } + + [JsonPropertyName("web"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Web { get; set; } + + [JsonPropertyName("embedded"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Embedded { get; set; } + + [JsonPropertyName("vr"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Vr { get; set; } + } +} \ No newline at end of file diff --git a/extra/admin-api/Models/Spacebar.Models.Gateway/Spacebar.Models.Gateway.csproj b/extra/admin-api/Models/Spacebar.Models.Gateway/Spacebar.Models.Gateway.csproj new file mode 100644 index 000000000..b104e193c --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Gateway/Spacebar.Models.Gateway.csproj @@ -0,0 +1,14 @@ + + + + net10.0 + enable + enable + + + + + + + + diff --git a/extra/admin-api/Models/Spacebar.Models.Gateway/deps.json b/extra/admin-api/Models/Spacebar.Models.Gateway/deps.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Gateway/deps.json @@ -0,0 +1 @@ +[] diff --git a/extra/admin-api/Models/Spacebar.Models.Generic/Member.cs b/extra/admin-api/Models/Spacebar.Models.Generic/Member.cs new file mode 100644 index 000000000..23b849211 --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Generic/Member.cs @@ -0,0 +1,31 @@ +using System.Diagnostics; +using System.Text.Json.Serialization; + +namespace Spacebar.Models.Generic; + +[DebuggerDisplay("{User.Id} ({User.Username}#{User.Discriminator})")] +public class Member { + [JsonPropertyName("user")] + public required PartialUser User { get; set; } + + [JsonPropertyName("nick")] + public string? Nick { get; set; } + + [JsonPropertyName("avatar")] + public string? Avatar { get; set; } + + [JsonPropertyName("avatar_decoration_data")] + public object? AvatarDecorationData { get; set; } + + [JsonPropertyName("collectibles")] + public object? Collectibles { get; set; } + + [JsonPropertyName("display_name_styles")] + public object? DisplayNameStyles { get; set; } + + [JsonPropertyName("banner")] + public string? Banner { get; set; } + + [JsonPropertyName("bio")] + public string? Bio { get; set; } +} \ No newline at end of file diff --git a/extra/admin-api/Models/Spacebar.Models.Generic/Spacebar.Models.Generic.csproj b/extra/admin-api/Models/Spacebar.Models.Generic/Spacebar.Models.Generic.csproj new file mode 100644 index 000000000..237d66167 --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Generic/Spacebar.Models.Generic.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/extra/admin-api/Models/Spacebar.Models.Generic/User.cs b/extra/admin-api/Models/Spacebar.Models.Generic/User.cs new file mode 100644 index 000000000..c2a58760a --- /dev/null +++ b/extra/admin-api/Models/Spacebar.Models.Generic/User.cs @@ -0,0 +1,49 @@ +using System.Diagnostics; +using System.Text.Json.Serialization; + +namespace Spacebar.Models.Generic; + +[DebuggerDisplay("{Id} ({Username}#{Discriminator})")] +public class PartialUser { + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("username")] + public string Username { get; set; } + + [JsonPropertyName("discriminator")] + public string Discriminator { get; set; } + + [JsonPropertyName("global_name")] + public string? GlobalName { get; set; } + + [JsonPropertyName("avatar")] + public string? Avatar { get; set; } + + [JsonPropertyName("avatar_decoration_data")] + public object? AvatarDecorationData { get; set; } + + [JsonPropertyName("collectibles")] + public object? Collectibles { get; set; } + + [JsonPropertyName("display_name_styles")] + public object? DisplayNameStyles { get; set; } + + [JsonPropertyName("primary_guild")] + public object? PrimaryGuild { get; set; } + + [JsonPropertyName("bot")] + public bool? Bot { get; set; } + + [JsonPropertyName("system")] + public bool? System { get; set; } + + [JsonPropertyName("banner")] + public string? Banner { get; set; } + + [JsonPropertyName("accent_color")] + public int? AccentColor { get; set; } + + [JsonPropertyName("public_flags")] + public ulong? PublicFlags { get; set; } +} \ No newline at end of file diff --git a/extra/admin-api/Spacebar.GatewayOffload/Controllers/Op12Controller.cs b/extra/admin-api/Spacebar.GatewayOffload/Controllers/Op12Controller.cs index 2c417bf80..0b7b5c82f 100644 --- a/extra/admin-api/Spacebar.GatewayOffload/Controllers/Op12Controller.cs +++ b/extra/admin-api/Spacebar.GatewayOffload/Controllers/Op12Controller.cs @@ -1,14 +1,13 @@ -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Text.Json; -using System.Text.Json.Serialization; +using System.Text.Json.Nodes; using ArcaneLibs.Extensions; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Spacebar.Interop.Authentication.AspNetCore; using Spacebar.Interop.Replication.Abstractions; using Spacebar.Models.Db.Contexts; -using Spacebar.Models.Db.Models; +using Spacebar.Models.Gateway; +using Spacebar.Models.Generic; namespace Spacebar.GatewayOffload.Controllers; @@ -46,7 +45,7 @@ public class Op12Controller(ILogger logger, SpacebarAspNetAuthen !s.IsAdminSession && (s.Status != "offline" && s.Status != "invisible") && (memberCount < 1000 || s.LastSeen >= offlineTreshold))) .Where(x => x.IdNavigation.Sessions.Count > 0) // ignore members without sessions .ToListAsync(); - + var mappedPartialUsers = members.Select(x => x.IdNavigation).ToDictionary(x => x.Id, x => new PartialUser() { Id = x.Id, Discriminator = x.Discriminator, @@ -66,21 +65,22 @@ public class Op12Controller(ILogger logger, SpacebarAspNetAuthen var mappedMembers = members.ToDictionary(m => m.Id, m => new Member() { User = mappedPartialUsers[m.Id], AvatarDecorationData = m.AvatarDecorationData, - Avatar = m.Avatar, - Banner = m.Banner, + Avatar = string.IsNullOrWhiteSpace(m.Avatar) ? null : m.Avatar, + Banner = string.IsNullOrWhiteSpace(m.Banner) ? null : m.Banner, Collectibles = m.Collectibles, DisplayNameStyles = m.DisplayNameStyles, - Bio = m.Bio, - Nick = m.Nick + Bio = string.IsNullOrWhiteSpace(m.Bio) ? null : m.Bio, + Nick = string.IsNullOrWhiteSpace(m.Nick) ? null : m.Nick }); var presences = members.Select(x => x.IdNavigation).Where(x => x.Sessions.Count > 0).ToDictionary(x => x.Id, x => { var sortedSessions = x.Sessions.OrderByDescending(s => s.LastSeen).ToList(); return new PresenceResponse() { GuildId = guildId, User = mappedPartialUsers[x.Id], - Activities = x.Sessions.SelectMany(s => JsonSerializer.Deserialize(s.Activities)).ToList(), + Activities = x.Sessions.Where(s => s.Status is not ("offline" or "invisible" or "unknown")) + .SelectMany(s => JsonSerializer.Deserialize(s.Activities) ?? []).ToList(), Status = sortedSessions.FirstOrDefault(s => !string.IsNullOrWhiteSpace(s.Status))?.Status ?? "offline", - ClientStatus = JsonSerializer.Deserialize(sortedSessions.First(s => !string.IsNullOrWhiteSpace(s.ClientStatus)).ClientStatus) + ClientStatus = JsonSerializer.Deserialize(sortedSessions.First(s => !string.IsNullOrWhiteSpace(s.ClientStatus)).ClientStatus) ?? new() }; }).Where(x => x.Value.Activities.Count > 0).ToDictionary(); @@ -91,129 +91,4 @@ public class Op12Controller(ILogger logger, SpacebarAspNetAuthen }; return r; } -} - -public class GuildSyncResponse { - [JsonPropertyName("id")] - public string GuildId { get; set; } - - [JsonPropertyName("presences")] - public List Presences { get; set; } - - [JsonPropertyName("members")] - public List Members { get; set; } -} - -public class PresenceResponse { - [JsonPropertyName("user")] - public required PartialUser User { get; set; } - - [JsonPropertyName("guild_id"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? GuildId { get; set; } - - [JsonPropertyName("status")] - public string Status { get; set; } = "unknown"; - - [JsonPropertyName("activities")] - public List Activities { get; set; } - - [JsonPropertyName("hidden_activities")] - - public List HiddenActivities { get; set; } - - [JsonPropertyName("client_status")] - public ClientStatuses ClientStatus { get; set; } - - [JsonPropertyName("has_played_game")] - public bool? HasPlayedGame { get; set; } - - [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class ClientStatuses { - [JsonPropertyName("desktop"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Desktop { get; set; } - - [JsonPropertyName("mobile"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Mobile { get; set; } - - [JsonPropertyName("web"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Web { get; set; } - - [JsonPropertyName("embedded"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Embedded { get; set; } - - [JsonPropertyName("vr"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Vr { get; set; } - } -} - -[DebuggerDisplay("{Id} ({Username}#{Discriminator})")] -public class PartialUser { - [JsonPropertyName("id")] - public required string Id { get; set; } - - [JsonPropertyName("username")] - public string Username { get; set; } - - [JsonPropertyName("discriminator")] - public string Discriminator { get; set; } - - [JsonPropertyName("global_name")] - public string? GlobalName { get; set; } - - [JsonPropertyName("avatar")] - public string? Avatar { get; set; } - - [JsonPropertyName("avatar_decoration_data")] - public object? AvatarDecorationData { get; set; } - - [JsonPropertyName("collectibles")] - public object? Collectibles { get; set; } - - [JsonPropertyName("display_name_styles")] - public object? DisplayNameStyles { get; set; } - - [JsonPropertyName("primary_guild")] - public object? PrimaryGuild { get; set; } - - [JsonPropertyName("bot")] - public bool? Bot { get; set; } - - [JsonPropertyName("system")] - public bool? System { get; set; } - - [JsonPropertyName("banner")] - public string? Banner { get; set; } - - [JsonPropertyName("accent_color")] - public int? AccentColor { get; set; } - - [JsonPropertyName("public_flags")] - public ulong? PublicFlags { get; set; } -} - -[DebuggerDisplay("{User.Id} ({User.Username}#{User.Discriminator})")] -public class Member { - [JsonPropertyName("user")] - public required PartialUser User { get; set; } - - [JsonPropertyName("nick")] - public string? Nick { get; set; } - - [JsonPropertyName("avatar")] - public string? Avatar { get; set; } - - [JsonPropertyName("avatar_decoration_data")] - public object? AvatarDecorationData { get; set; } - - [JsonPropertyName("collectibles")] - public object? Collectibles { get; set; } - - [JsonPropertyName("display_name_styles")] - public object? DisplayNameStyles { get; set; } - - [JsonPropertyName("banner")] - public string? Banner { get; set; } - - [JsonPropertyName("bio")] - public string? Bio { get; set; } } \ No newline at end of file diff --git a/extra/admin-api/Spacebar.GatewayOffload/Program.cs b/extra/admin-api/Spacebar.GatewayOffload/Program.cs index 208302404..76e7797c4 100644 --- a/extra/admin-api/Spacebar.GatewayOffload/Program.cs +++ b/extra/admin-api/Spacebar.GatewayOffload/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddControllers(options => { options.MaxValidationDepth = null; // options.MaxIAsyncEnumerableBufferLimit = 1; }).AddJsonOptions(options => { - // options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; + options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; options.JsonSerializerOptions.WriteIndented = true; options.JsonSerializerOptions.MaxDepth = 100; // options.JsonSerializerOptions.DefaultBufferSize = ; diff --git a/extra/admin-api/Spacebar.GatewayOffload/Spacebar.GatewayOffload.csproj b/extra/admin-api/Spacebar.GatewayOffload/Spacebar.GatewayOffload.csproj index 56257a468..e6c22cd47 100644 --- a/extra/admin-api/Spacebar.GatewayOffload/Spacebar.GatewayOffload.csproj +++ b/extra/admin-api/Spacebar.GatewayOffload/Spacebar.GatewayOffload.csproj @@ -11,10 +11,12 @@ - + - - + + + + diff --git a/extra/admin-api/Spacebar.GatewayOffload/deps.json b/extra/admin-api/Spacebar.GatewayOffload/deps.json new file mode 100644 index 000000000..a2da77924 --- /dev/null +++ b/extra/admin-api/Spacebar.GatewayOffload/deps.json @@ -0,0 +1,197 @@ +[ + { + "pname": "ArcaneLibs", + "version": "1.0.1-preview.20260126-091403", + "hash": "sha256-CSmNE16nDi05qyDAcJR+8SqQQ2ReAeX0+/dRP3WpNsg=" + }, + { + "pname": "Humanizer.Core", + "version": "2.14.1", + "hash": "sha256-EXvojddPu+9JKgOG9NSQgUTfWq1RpOYw7adxDPKDJ6o=" + }, + { + "pname": "Microsoft.AspNetCore.OpenApi", + "version": "10.0.2", + "hash": "sha256-FU57fPXL4NUDRqi+rLresi4yKttv1KcAnLuEdPCyTos=" + }, + { + "pname": "Microsoft.Build.Framework", + "version": "17.11.31", + "hash": "sha256-YS4oASrmC5dmZrx5JPS7SfKmUpIJErlUpVDsU3VrfFE=" + }, + { + "pname": "Microsoft.Build.Framework", + "version": "18.0.2", + "hash": "sha256-fO31KAdDs2J0RUYD1ov9UB3ucsbALan7K0YdWW+yg7A=" + }, + { + "pname": "Microsoft.CodeAnalysis.Analyzers", + "version": "3.11.0", + "hash": "sha256-hQ2l6E6PO4m7i+ZsfFlEx+93UsLPo4IY3wDkNG11/Sw=" + }, + { + "pname": "Microsoft.CodeAnalysis.Common", + "version": "5.0.0", + "hash": "sha256-g4ALvBSNyHEmSb1l5TFtWW7zEkiRmhqLx4XWZu9sr2U=" + }, + { + "pname": "Microsoft.CodeAnalysis.CSharp", + "version": "5.0.0", + "hash": "sha256-ctBCkQGFpH/xT5rRE3xibu9YxPD108RuC4a4Z25koG8=" + }, + { + "pname": "Microsoft.CodeAnalysis.CSharp.Workspaces", + "version": "5.0.0", + "hash": "sha256-yWVcLt/f2CouOfFy966glGdtSFy+RcgrU1dd9UtlL/Q=" + }, + { + "pname": "Microsoft.CodeAnalysis.Workspaces.Common", + "version": "5.0.0", + "hash": "sha256-Bir5e1gEhgQQ6upQmVKQHAKLRfenAu60DAzNupNnZsQ=" + }, + { + "pname": "Microsoft.CodeAnalysis.Workspaces.MSBuild", + "version": "5.0.0", + "hash": "sha256-+58+iqTayTiE0pDaog1U8mjaDA8bNNDLA8gjCQZZudo=" + }, + { + "pname": "Microsoft.EntityFrameworkCore", + "version": "10.0.0", + "hash": "sha256-xfgrlxhtOkQwF5Q7j8gSm41URJiH8IuJ/T/Dh88++hE=" + }, + { + "pname": "Microsoft.EntityFrameworkCore", + "version": "10.0.2", + "hash": "sha256-FS6T8EnaWCMtj4PnZhh+oF8mcM44VlM3wkTSMlpte9A=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Abstractions", + "version": "10.0.0", + "hash": "sha256-UDgZbRQcGPaKsE53EH6bvJiv+Q4KSxAbnsVhTVFGG4Q=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Abstractions", + "version": "10.0.2", + "hash": "sha256-qkDfIJpcPO2kk4n5OE/13hI/0mUygpTofInn95XjRZI=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Analyzers", + "version": "10.0.0", + "hash": "sha256-7Q0jYJO50cqGI+u6gLpootbB8GZvgsgtg0F9FZI1jig=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Analyzers", + "version": "10.0.2", + "hash": "sha256-yOv78rgAACBz1zjitpcZbQQ3zx8huJongZTHkhN4PQ0=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Design", + "version": "10.0.2", + "hash": "sha256-bTShsGux0y/49PIIMb/4ZX3x5+rPacvT5/NcooNCI1Y=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Relational", + "version": "10.0.0", + "hash": "sha256-vOP2CE5YA551BlpbOuIy6RuAiAEPEpCVS1cEE33/zN4=" + }, + { + "pname": "Microsoft.EntityFrameworkCore.Relational", + "version": "10.0.2", + "hash": "sha256-Y4jPpoYhKizg5wF6QfkBX4sYlE2FU1bYhfoDN3xkhKM=" + }, + { + "pname": "Microsoft.Extensions.DependencyModel", + "version": "10.0.2", + "hash": "sha256-w/dGIjtZiGH+KW3969BPOdQpQEV+WB7RPTa2MK2DavE=" + }, + { + "pname": "Microsoft.IdentityModel.Abstractions", + "version": "8.15.0", + "hash": "sha256-LKTvERNUTMCEF7xs377tCMwOMRki93OS4kh6Yv0uXJ4=" + }, + { + "pname": "Microsoft.IdentityModel.JsonWebTokens", + "version": "8.15.0", + "hash": "sha256-LwzKiGjcnORvmQ9tim6lomXpfVlPpd/fE8FKTFWKlpM=" + }, + { + "pname": "Microsoft.IdentityModel.Logging", + "version": "8.15.0", + "hash": "sha256-mMXwsjGcrrmHR1mG7BLTKg/30mX+m93QVX17/ynOOd4=" + }, + { + "pname": "Microsoft.IdentityModel.Tokens", + "version": "8.15.0", + "hash": "sha256-7Lo/TsvqgNCEMyFssO3Om233521Pqgb9K9lUeHc5HMk=" + }, + { + "pname": "Microsoft.OpenApi", + "version": "2.0.0", + "hash": "sha256-8eiM3Mx4Hx1etx52RlczoHG2z9XIpWgu2LQtWSt086k=" + }, + { + "pname": "Microsoft.VisualStudio.SolutionPersistence", + "version": "1.0.52", + "hash": "sha256-KZGPtOXe6Hv8RrkcsgoLKTRyaCScIpQEa2NhNB3iOXw=" + }, + { + "pname": "Mono.TextTemplating", + "version": "3.0.0", + "hash": "sha256-VlgGDvgNZb7MeBbIZ4DE2Nn/j2aD9k6XqNHnASUSDr0=" + }, + { + "pname": "Newtonsoft.Json", + "version": "13.0.3", + "hash": "sha256-hy/BieY4qxBWVVsDqqOPaLy1QobiIapkbrESm6v2PHc=" + }, + { + "pname": "Npgsql", + "version": "10.0.0", + "hash": "sha256-UVKz9dH/rVCCbMyFdqA31RYpht1XgDRLIqUy0Dp9ACQ=" + }, + { + "pname": "Npgsql.EntityFrameworkCore.PostgreSQL", + "version": "10.0.0", + "hash": "sha256-XIJxnTMektQVP1qtslEIGbmBGrIQsvjQjCMRTs9UIbg=" + }, + { + "pname": "System.CodeDom", + "version": "6.0.0", + "hash": "sha256-uPetUFZyHfxjScu5x4agjk9pIhbCkt5rG4Axj25npcQ=" + }, + { + "pname": "System.Composition", + "version": "9.0.0", + "hash": "sha256-FehOkQ2u1p8mQ0/wn3cZ+24HjhTLdck8VZYWA1CcgbM=" + }, + { + "pname": "System.Composition.AttributedModel", + "version": "9.0.0", + "hash": "sha256-a7y7H6zj+kmYkllNHA402DoVfY9IaqC3Ooys8Vzl24M=" + }, + { + "pname": "System.Composition.Convention", + "version": "9.0.0", + "hash": "sha256-tw4vE5JRQ60ubTZBbxoMPhtjOQCC3XoDFUH7NHO7o8U=" + }, + { + "pname": "System.Composition.Hosting", + "version": "9.0.0", + "hash": "sha256-oOxU+DPEEfMCuNLgW6wSkZp0JY5gYt44FJNnWt+967s=" + }, + { + "pname": "System.Composition.Runtime", + "version": "9.0.0", + "hash": "sha256-AyIe+di1TqwUBbSJ/sJ8Q8tzsnTN+VBdJw4K8xZz43s=" + }, + { + "pname": "System.Composition.TypedParts", + "version": "9.0.0", + "hash": "sha256-F5fpTUs3Rr7yP/NyIzr+Xn5NdTXXp8rrjBnF9UBBUog=" + }, + { + "pname": "System.IdentityModel.Tokens.Jwt", + "version": "8.15.0", + "hash": "sha256-5O0wbGp0gWnukK+0mWBjMnP1bZc6N0xuNcO2qmFiUX8=" + } +] diff --git a/extra/admin-api/SpacebarAdminAPI.sln b/extra/admin-api/SpacebarAdminAPI.sln index a273842be..e28cf2abc 100644 --- a/extra/admin-api/SpacebarAdminAPI.sln +++ b/extra/admin-api/SpacebarAdminAPI.sln @@ -51,6 +51,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spacebar.GatewayOffload", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spacebar.Interop.Authentication.AspNetCore", "Interop\Spacebar.Interop.Authentication.AspNetCore\Spacebar.Interop.Authentication.AspNetCore.csproj", "{BB961FD8-61C2-4443-AB68-B8088CBC3D43}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spacebar.Models.Generic", "Models\Spacebar.Models.Generic\Spacebar.Models.Generic.csproj", "{58766A5F-BA91-41F1-8A09-44E96685E361}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spacebar.Models.Gateway", "Models\Spacebar.Models.Gateway\Spacebar.Models.Gateway.csproj", "{0057DA5E-3183-4A7A-B092-167137872FF8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -313,6 +317,30 @@ Global {BB961FD8-61C2-4443-AB68-B8088CBC3D43}.Release|x64.Build.0 = Release|Any CPU {BB961FD8-61C2-4443-AB68-B8088CBC3D43}.Release|x86.ActiveCfg = Release|Any CPU {BB961FD8-61C2-4443-AB68-B8088CBC3D43}.Release|x86.Build.0 = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|x64.ActiveCfg = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|x64.Build.0 = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|x86.ActiveCfg = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Debug|x86.Build.0 = Debug|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|Any CPU.Build.0 = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|x64.ActiveCfg = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|x64.Build.0 = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|x86.ActiveCfg = Release|Any CPU + {58766A5F-BA91-41F1-8A09-44E96685E361}.Release|x86.Build.0 = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|x64.ActiveCfg = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|x64.Build.0 = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|x86.ActiveCfg = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Debug|x86.Build.0 = Debug|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|Any CPU.Build.0 = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|x64.ActiveCfg = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|x64.Build.0 = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|x86.ActiveCfg = Release|Any CPU + {0057DA5E-3183-4A7A-B092-167137872FF8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -336,5 +364,7 @@ Global {95A8E8CC-53B2-4FC6-B41E-196BE5F96BB5} = {16DBEA54-D51A-4D91-84DF-C701B6B4786F} {8864E79A-2FF3-4B08-8AE9-F9D877CC69B3} = {16DBEA54-D51A-4D91-84DF-C701B6B4786F} {BB961FD8-61C2-4443-AB68-B8088CBC3D43} = {16DBEA54-D51A-4D91-84DF-C701B6B4786F} + {58766A5F-BA91-41F1-8A09-44E96685E361} = {259D1A9B-2927-4571-A366-68C3BB30C2B2} + {0057DA5E-3183-4A7A-B092-167137872FF8} = {259D1A9B-2927-4571-A366-68C3BB30C2B2} EndGlobalSection EndGlobal diff --git a/extra/admin-api/outputs.nix b/extra/admin-api/outputs.nix index a17363ec5..63f082499 100644 --- a/extra/admin-api/outputs.nix +++ b/extra/admin-api/outputs.nix @@ -127,6 +127,19 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems ( nugetDeps = Models/Spacebar.Models.Db/deps.json; srcRoot = Models/Spacebar.Models.Db; }; + Spacebar-Models-Gateway = makeNupkg { + name = "Spacebar.Models.Gateway"; + projectFile = "Spacebar.Models.Gateway.csproj"; + # nugetDeps = Models/Spacebar.Models.Gateway/deps.json; + srcRoot = Models/Spacebar.Models.Gateway; + projectReferences = [ proj.Spacebar-Models-Generic ]; + }; + Spacebar-Models-Generic = makeNupkg { + name = "Spacebar.Models.Generic"; + projectFile = "Spacebar.Models.Generic.csproj"; + # nugetDeps = Models/Spacebar.Models.Generic/deps.json; + srcRoot = Models/Spacebar.Models.Generic; + }; # Utilities Spacebar-CleanSettingsRows = makeNupkg { @@ -139,7 +152,8 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems ( }; Spacebar-Cdn-Fsck = makeNupkg { name = "Spacebar.Cdn.Fsck"; - projectFile = "Utilities/Spacebar.Cdn.Fsck/Spacebar.Cdn.Fsck.csproj"; + projectFile = "Spacebar.Cdn.Fsck.csproj"; + srcRoot = Utilities/Spacebar.Cdn.Fsck; nugetDeps = Utilities/Spacebar.Cdn.Fsck/deps.json; packNupkg = false; projectReferences = [ @@ -152,6 +166,8 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems ( Spacebar-AdminApi = makeNupkg { name = "Spacebar.AdminApi"; nugetDeps = Spacebar.AdminApi/deps.json; + projectFile = "Spacebar.AdminApi.csproj"; + srcRoot = ./Spacebar.AdminApi; packNupkg = false; projectReferences = [ proj.Spacebar-Interop-Authentication @@ -166,12 +182,29 @@ flake-utils.lib.eachSystem flake-utils.lib.allSystems ( Spacebar-Cdn = makeNupkg { name = "Spacebar.Cdn"; nugetDeps = Spacebar.Cdn/deps.json; + projectFile = "Spacebar.Cdn.csproj"; + srcRoot = ./Spacebar.Cdn; packNupkg = false; projectReferences = [ proj.Spacebar-Models-Db proj.Spacebar-Interop-Cdn-Abstractions ]; }; + Spacebar-GatewayOffload = makeNupkg { + name = "Spacebar.GatewayOffload"; + nugetDeps = Spacebar.GatewayOffload/deps.json; + projectFile = "Spacebar.GatewayOffload.csproj"; + srcRoot = ./Spacebar.GatewayOffload; + packNupkg = false; + projectReferences = [ + proj.Spacebar-Interop-Authentication + proj.Spacebar-Interop-Authentication-AspNetCore + proj.Spacebar-Interop-Replication-Abstractions + proj.Spacebar-Models-Db + proj.Spacebar-Models-Gateway + proj.Spacebar-Models-Generic + ]; + }; # Spacebar-AdminApi-TestClient = makeNupkg { # name = "Spacebar.AdminApi.TestClient"; # projectFile = "Utilities/Spacebar.AdminApi.TestClient/Spacebar.AdminApi.TestClient.csproj"; diff --git a/extra/admin-api/update-deps.cs b/extra/admin-api/update-deps.cs index 686ae2aed..bf0516f8a 100755 --- a/extra/admin-api/update-deps.cs +++ b/extra/admin-api/update-deps.cs @@ -7,18 +7,6 @@ using ArcaneLibs; using ArcaneLibs.Extensions; using System.Text.Json; -ProjectDef[] projects = [ - new("Spacebar-Models-AdminApi", "Models/Spacebar-Models-AdminApi"), - new("Spacebar-Models-Config", "Models/Spacebar-Models-Config"), - new("Spacebar-Models-Db", "Models/Spacebar-Models-Db"), - new("Spacebar-Interop-Replication-Abstractions", "Interop/Spacebar-Interop-Replication-Abstractions"), - new("Spacebar-Interop-Replication-RabbitMq", "Interop/Spacebar-Interop-Replication-RabbitMq"), - new("Spacebar-Interop-Replication-UnixSocket", "Interop/Spacebar-Interop-Replication-UnixSocket"), - new("Spacebar-CleanSettingsRows", "Utilities/Spacebar-CleanSettingsRows"), - new("Spacebar-AdminApi", "Spacebar-AdminApi"), - new("Spacebar-Cdn", "Spacebar-Cdn"), -]; - Console.WriteLine("==> Getting outputs..."); var outs = JsonSerializer.Deserialize(Util.GetCommandOutputSync("nix", $"eval --json .#packages.x86_64-linux --apply builtins.attrNames", silent: true, stderr: false)); if (args.Length > 0) { @@ -28,17 +16,6 @@ if (args.Length > 0) { Console.WriteLine($"==> Updating dependencies for {outs.Length} projects..."); - -// foreach (var proj in projects) { -// Console.WriteLine(ConsoleUtils.ColoredString($" ==> Updating {proj.NixName} ({proj.Path})", 0x80, 0x80, 0xff)); -// Console.Write(ConsoleUtils.ColoredString($" ==> Getting project files... ", 0x80, 0xff, 0xff)); -// var projectFiles = JsonSerializer.Deserialize(Util.GetCommandOutputSync("nix", $"eval --json .#packages.x86_64-linux.{proj.NixName}.dotnetProjectFiles", silent: true, stderr: false)); -// Console.WriteLine(ConsoleUtils.ColoredString($"{string.Join(", ", projectFiles)}", 0x80, 0xff, 0xff)); -// if (projectFiles.Length != 1) throw new Exception("Invalid project file count?"); -// // Util.RunCommandSync("nix", $"build .#{proj.NixName}.passthru.fetch-deps"); -// // await Task.Delay(250); -// } - foreach (var outp in outs) { Console.WriteLine(ConsoleUtils.ColoredString($" ==> Updating {outp}...", 0x80, 0x80, 0xff)); Console.Write(ConsoleUtils.ColoredString($" ==> Getting project root directory... ", 0x80, 0xff, 0xff)); @@ -64,8 +41,4 @@ foreach (var outp in outs) { // await Task.Delay(250); -} - - - -public record ProjectDef(string NixName, string Path); +} \ No newline at end of file