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

+4 -14
View File
@@ -20,9 +20,6 @@ export interface PersistedSettings {
lastTestLatencyMs: number | null;
lastTestError: string | null;
webRtcEnabled: boolean;
webRtcPublicHost: string;
webRtcUdpStart: number;
webRtcUdpEnd: number;
updatedAt: string;
}
@@ -34,9 +31,6 @@ export interface SettingsUpdate {
tsPort: number;
tsPasswordEncrypted: string | null;
webRtcEnabled: boolean;
webRtcPublicHost: string;
webRtcUdpStart: number;
webRtcUdpEnd: number;
}
export interface ManagedInviteRecord {
@@ -153,9 +147,6 @@ export class WebSpeakDatabase {
lastTestLatencyMs: row.last_test_latency_ms,
lastTestError: row.last_test_error,
webRtcEnabled: row.webrtc_enabled === 1,
webRtcPublicHost: row.webrtc_public_host,
webRtcUdpStart: row.webrtc_udp_start,
webRtcUdpEnd: row.webrtc_udp_end,
updatedAt: row.updated_at,
};
}
@@ -370,6 +361,9 @@ export class WebSpeakDatabase {
if (version === 2) {
this.transaction(() => {
this.database.exec(`
-- The host and range columns are retained for v3 database compatibility.
-- WebSpeak no longer reads or exposes them; WebRTC now owns its media
-- endpoint and derives the public host from each browser connection.
ALTER TABLE settings ADD COLUMN webrtc_enabled INTEGER NOT NULL DEFAULT 0 CHECK (webrtc_enabled IN (0, 1));
ALTER TABLE settings ADD COLUMN webrtc_public_host TEXT NOT NULL DEFAULT '';
ALTER TABLE settings ADD COLUMN webrtc_udp_start INTEGER NOT NULL DEFAULT 40000 CHECK (webrtc_udp_start BETWEEN 1 AND 65535);
@@ -384,8 +378,7 @@ export class WebSpeakDatabase {
this.database.prepare(
`UPDATE settings SET
site_name = ?, welcome_text = ?, access_mode = ?, ts_host = ?, ts_port = ?,
ts_password_encrypted = ?, webrtc_enabled = ?, webrtc_public_host = ?,
webrtc_udp_start = ?, webrtc_udp_end = ?, updated_at = ?
ts_password_encrypted = ?, webrtc_enabled = ?, updated_at = ?
WHERE id = 1`,
).run(
settings.siteName,
@@ -395,9 +388,6 @@ export class WebSpeakDatabase {
settings.tsPort,
settings.tsPasswordEncrypted,
settings.webRtcEnabled ? 1 : 0,
settings.webRtcPublicHost,
settings.webRtcUdpStart,
settings.webRtcUdpEnd,
now,
);
}