feat: expose acceleration relay settings in admin console

This commit is contained in:
illusia committed 2026-09-10 15:25:47 +08:00
1 parent b82c4fe0af
commit 7782e9b327
9 files changed
+233 -19

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ const MAGIC = Buffer.from("WSAT");
const VERSION = 1;
const HEADER_SIZE = 34;
const MAX_PAYLOAD_SIZE = 60_000;
export const DEFAULT_ACCELERATION_RELAY_PORT = 39087;
const enum FrameType {
OPEN = 1,
+12 -1
View File
@@ -61,7 +61,12 @@ export function createWebServer(options: WebServerOptions): WebServer {
app.get("/api/public-config", (_request, response) => {
response.setHeader("Cache-Control", "no-store");
const acceleration = resolveAccelerationOptions(options.voiceBridgeOptions.acceleration);
response.json({ ...options.adminService.getPublicConfig(), accelerationAvailable: Boolean(acceleration) });
const accelerationName = resolveAccelerationName(options.voiceBridgeOptions.accelerationName);
response.json({
...options.adminService.getPublicConfig(),
accelerationAvailable: Boolean(acceleration),
accelerationName: acceleration ? (accelerationName || "中继加速") : "",
});
});
app.post("/api/join-ticket", async (request, response) => {
@@ -190,6 +195,12 @@ function resolveAccelerationOptions(
return typeof configured === "function" ? configured() : configured;
}
function resolveAccelerationName(
configured: VoiceBridgeOptions["accelerationName"],
): string | undefined {
return typeof configured === "function" ? configured() : configured;
}
function isRecord(value: unknown): value is Record<string, unknown> {
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
}
+1
View File
@@ -35,6 +35,7 @@ export interface VoiceBridgeOptions {
joinTickets: JoinTicketStore;
webRtc?: WebRtcAudioOptions | (() => WebRtcAudioOptions);
acceleration?: AccelerationRelayOptions | (() => AccelerationRelayOptions | undefined);
accelerationName?: string | (() => string | undefined);
}
export interface AdminSessionSummary {