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

+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);
}