mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
feat: customize and lock WebRTC media ports
This commit is contained in:
1 parent
767bdea018
commit
baa09ad38c
10 files changed
+161
-23
No files matched your search
@@ -333,6 +333,8 @@ function readSettingsInput(body: Record<string, unknown>): AdminSettingsInput {
|
||||
siteName: readString(body, "siteName", 80),
|
||||
welcomeText: readOptionalString(body, "welcomeText", 500),
|
||||
webRtcEnabled: body.webRtcEnabled === true,
|
||||
webRtcUdpStart: readOptionalInteger(body, "webRtcUdpStart"),
|
||||
webRtcUdpEnd: readOptionalInteger(body, "webRtcUdpEnd"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -350,6 +352,14 @@ function readString(body: Record<string, unknown>, key: string, max: number): st
|
||||
return body[key];
|
||||
}
|
||||
|
||||
function readOptionalInteger(body: Record<string, unknown>, key: string): number | undefined {
|
||||
if (body[key] === undefined) return undefined;
|
||||
if (typeof body[key] !== "number" || !Number.isSafeInteger(body[key])) {
|
||||
throw new AdminInputError("INVALID_REQUEST", `${key} is invalid`);
|
||||
}
|
||||
return body[key];
|
||||
}
|
||||
|
||||
function readOptionalString(body: Record<string, unknown>, key: string, max: number): string {
|
||||
return typeof body[key] === "string" ? body[key].slice(0, max) : "";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user