feat: make WebRTC media service self-contained

This commit is contained in:
illusia committed 2026-09-03 10:56:39 +08:00
1 parent d6c8ccb73f
commit c7def28a8f
14 files changed
+160 -121

No files matched your search

-6
View File
@@ -112,18 +112,12 @@ test("admin API requires the default password to be changed before administratio
siteName: "Changed",
welcomeText: "Open access",
webRtcEnabled: true,
webRtcPublicHost: "voice.example.com",
webRtcUdpStart: 40000,
webRtcUdpEnd: 40099,
},
});
assert.equal(saved.body.ok, true);
assert.equal(saved.body.settings.accessMode, "open");
assert.equal(saved.body.settings.hasPassword, false);
assert.equal(saved.body.settings.webRtcEnabled, true);
assert.equal(saved.body.settings.webRtcPublicHost, "voice.example.com");
assert.equal(saved.body.settings.webRtcUdpStart, 40000);
assert.equal(saved.body.settings.webRtcUdpEnd, 40099);
const invite = await request(origin, "/api/admin/invites", {
method: "POST",
+1 -4
View File
@@ -55,9 +55,6 @@ test("legacy config imports once, seeds the default admin, and allows password r
siteName: "Open WebSpeak",
welcomeText: "Public gateway",
webRtcEnabled: true,
webRtcPublicHost: "voice.example.com",
webRtcUdpStart: 40000,
webRtcUdpEnd: 40099,
});
const publicConfig = service.getPublicConfig();
assert.equal(publicConfig.target, "public.example.com:9987");
@@ -66,7 +63,7 @@ test("legacy config imports once, seeds the default admin, and allows password r
assert.equal(service.getAdminSettings().hasPassword, true);
assert.equal(service.getConnectionPolicy().serverPassword, "replacement-secret");
assert.equal(service.getAdminSettings().webRtcEnabled, true);
assert.deepEqual(service.getWebRtcAudioOptions(), { enabled: true, publicHost: "voice.example.com", icePortRange: [40000, 40099] });
assert.deepEqual(service.getWebRtcAudioOptions(), { enabled: true });
database.close();
});
+3 -8
View File
@@ -24,9 +24,6 @@ test("SQLite persistence initializes schema and stores the single admin/settings
tsPort: 9988,
tsPasswordEncrypted: "v1:ciphertext",
webRtcEnabled: true,
webRtcPublicHost: "voice.example.com",
webRtcUdpStart: 40000,
webRtcUdpEnd: 40099,
});
assert.equal(database.hasAdmin(), true);
assert.equal(database.getAdminCredential()?.hash, credential.hash);
@@ -42,9 +39,6 @@ test("SQLite persistence initializes schema and stores the single admin/settings
lastTestLatencyMs: null,
lastTestError: null,
webRtcEnabled: true,
webRtcPublicHost: "voice.example.com",
webRtcUdpStart: 40000,
webRtcUdpEnd: 40099,
updatedAt: database.getSettings().updatedAt,
});
assert.equal(database.recentAudit()[0]?.event, "ADMIN_INITIALIZED");
@@ -78,8 +72,9 @@ test("SQLite schema v1 upgrades to v3 with a migration copy", () => {
const upgraded = new WebSpeakDatabase(dbPath);
assert.equal(upgraded.schemaVersion, 3);
assert.equal(upgraded.getSettings().webRtcEnabled, false);
assert.equal(upgraded.getSettings().webRtcUdpStart, 40000);
assert.equal(upgraded.getSettings().webRtcUdpEnd, 40099);
assert.equal("webRtcPublicHost" in upgraded.getSettings(), false);
assert.equal("webRtcUdpStart" in upgraded.getSettings(), false);
assert.equal("webRtcUdpEnd" in upgraded.getSettings(), false);
assert.equal(upgraded.listManagedInvites().length, 0);
assert.equal(existsSync(`${dbPath}.schema-1.bak`), true);
upgraded.close();