Extend managed macOS client toward feature parity
.NET port / test (macos-latest) (push) Canceled after 0s
.NET port / test (ubuntu-24.04) (push) Canceled after 0s
.NET port / test (windows-latest) (push) Canceled after 0s
.NET port / apple-client (push) Canceled after 0s
.NET port / cpp-conformance (push) Canceled after 0s

This commit is contained in:
2026-09-19 00:39:04 +02:00
parent 310c0f09dd
commit d0a72176ba
25 changed files with 1292 additions and 40 deletions
@@ -1,5 +1,6 @@
using VoiceCat.Core;
using VoiceCat.Crypto;
using VoiceCat.Server.Data;
using Voicecat.V1;
using static VoiceCat.Tests.ServerTests;
using static VoiceCat.Tests.MediaRelayTests;
@@ -77,4 +78,26 @@ public class ManagedClientTests
Assert.True(managed.TrySendEncodedVoice(local.Ssrc, 960, [4, 5, 6]));
Assert.Equal(new byte[] { 4, 5, 6 }, (await peer.ReceiveVoiceAsync()).Payload);
}
[Fact]
public async Task ManagedAdministrationHelpersRoundTripTypedResults()
{
await using var fixture = new ServerFixture();
using (var store = new AccountStore(Path.Combine(fixture.Directory, "voicecat.db")))
await store.CreateAccountAsync("Admin", "secret", true);
await using var admin = NewClient(fixture, "ManagedAdmin"); await Connect(admin, fixture);
Assert.True((await admin.AuthenticateUserAsync("Admin", "secret")).Ok);
await Event(admin, envelope => envelope.ServerState is not null);
Assert.True(admin.Permissions.IsAdmin);
Assert.True((await admin.CreateAccountAsync("managed-ui", "first")).Ok);
Assert.Contains(await admin.ListAccountsAsync(), account => account.Username == "managed-ui");
Assert.True((await admin.ResetPasswordAsync("managed-ui", "second")).Ok);
var room = new Voicecat.V1.Channel { Name = "Managed UI room", Audio = new()
{ SampleRate = 48000, BitrateBps = 64000, FrameMs = 20, Complexity = 10, Fec = true } };
Assert.True((await admin.CreateChannelAsync(room, "protected")).Ok);
Envelope created = await Event(admin, envelope => envelope.ChannelEvent?.Channel?.Name == room.Name);
Assert.True((await admin.DeleteChannelAsync(created.ChannelEvent.Channel.Id)).Ok);
Assert.True((await admin.DeleteAccountAsync("managed-ui")).Ok);
}
}
@@ -47,4 +47,31 @@ public sealed class ServerProfileTests
{
Assert.Throws<ArgumentException>(() => ServerProfile.Create("voice.example", 8384, ServerAuthentication.Account));
}
[Fact]
public void SwiftProfilesImportAndAreBackedUpOnManagedSave()
{
string directory = Path.Combine(Path.GetTempPath(), "voicecat-profile-" + Guid.NewGuid().ToString("N"));
string path = Path.Combine(directory, "servers.json");
Guid accountId = Guid.NewGuid();
try
{
Directory.CreateDirectory(directory);
File.WriteAllText(path, $$"""
[{"id":"{{accountId:D}}","host":"voice.example","port":8384,"authMode":"password","savedUsername":"talon","nickname":null,"keychainTag":"voicecat.server.legacy"}]
""");
var store = new ServerProfileStore(path);
ServerProfile profile = Assert.Single(store.Load());
Assert.Equal(ServerAuthentication.Account, profile.Authentication);
Assert.Equal("talon", profile.Username);
Assert.Equal("voicecat.server.legacy", profile.LegacyKeychainTag);
store.Save([profile]);
Assert.True(File.Exists(path + ".swift-backup.json"));
string managed = File.ReadAllText(path);
Assert.Contains("\"authentication\": \"Account\"", managed);
Assert.DoesNotContain("keychainTag", managed);
}
finally { if (Directory.Exists(directory)) Directory.Delete(directory, true); }
}
}