From 75b0a5beeb314909327b60f4c2f73f0d1573c177 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 15 Feb 2021 19:13:54 +0100 Subject: [PATCH] Some minor fixes --- github | 2 +- modules/renderer/audio/InputDeviceList.ts | 12 ++++++++++++ .../renderer/connection/ServerConnection.ts | 18 +++++++++++------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/github b/github index 7f89167..d298d09 160000 --- a/github +++ b/github @@ -1 +1 @@ -Subproject commit 7f89167600c72eadf1c31be0dad3b7563561699e +Subproject commit d298d0943956fb47c95724ebe3e3104cca289f5f diff --git a/modules/renderer/audio/InputDeviceList.ts b/modules/renderer/audio/InputDeviceList.ts index f0b9701..ea7bfc1 100644 --- a/modules/renderer/audio/InputDeviceList.ts +++ b/modules/renderer/audio/InputDeviceList.ts @@ -54,6 +54,18 @@ class InputDeviceList extends AbstractDeviceList { isDefault: device.input_default } }); + + /* Fixup MMEs character limit of 31 by trying to resolve a name somewhere else */ + this.cachedDevices.forEach(device => { + if(device.driver !== "MME") { + return; + } + + const fallback = this.cachedDevices.find(fallbackDevice => fallbackDevice.name.substring(0, 31) === device.name && fallbackDevice.name.length > 31); + if(fallback) { + device.name = fallback.name; + } + }) this.setState("healthy"); return this.cachedDevices; } diff --git a/modules/renderer/connection/ServerConnection.ts b/modules/renderer/connection/ServerConnection.ts index 0b5968d..a081fe8 100644 --- a/modules/renderer/connection/ServerConnection.ts +++ b/modules/renderer/connection/ServerConnection.ts @@ -38,8 +38,6 @@ interface ErrorCodeListener { class ErrorCommandHandler extends AbstractCommandHandler { private readonly handle: ServerConnection; - private serverType: "teaspeak" | "teamspeak"; - private errorCodeMapping: {[key: string]: ErrorCodeListener} = {}; private errorCodeHistory: ErrorCodeListener[] = []; @@ -48,7 +46,6 @@ class ErrorCommandHandler extends AbstractCommandHandler { constructor(handle: ServerConnection) { super(handle); this.handle = handle; - this.serverType = "teaspeak"; } generateReturnCode(command: string, callback: (result: CommandResult) => void, returnCode?: string) : string { @@ -117,14 +114,14 @@ class ErrorCommandHandler extends AbstractCommandHandler { } else if(command.command == "initivexpand") { if(command.arguments[0]["teaspeak"] == true) { this.handle.handshake_handler().startHandshake(); - this.serverType = "teaspeak"; + this.handle["serverType"] = "teaspeak"; } else { - this.serverType = "teamspeak"; + this.handle["serverType"] = "teamspeak"; } return true; } else if(command.command == "initivexpand2") { /* its TeamSpeak or TeaSpeak with experimental 3.1 and not up2date */ - this.serverType = "teamspeak"; + this.handle["serverType"] = "teamspeak"; } else if(command.command == "initserver") { /* just if clientinit error did not fired (TeamSpeak) */ while(this.errorCodeHistory.length > 0) { @@ -133,7 +130,7 @@ class ErrorCommandHandler extends AbstractCommandHandler { clearTimeout(listener.timeout); } - if(this.serverType === "teaspeak") { + if(this.handle.getServerType() === "teaspeak") { this.handle.getRtcConnection().doInitialSetup(); } else { this.handle.getRtcConnection().setNotSupported(); @@ -197,6 +194,8 @@ export class ServerConnection extends AbstractServerConnection { private remoteAddress: ServerAddress; private handshakeHandler: HandshakeHandler; + private serverType: "teaspeak" | "teamspeak"; + constructor(props: ConnectionHandler) { super(props); @@ -382,6 +381,11 @@ export class ServerConnection extends AbstractServerConnection { getRtcConnection() : RTCConnection { return this.rtcConnection; } + + + getServerType() : "teaspeak" | "teamspeak" | "unknown" { + return this.serverType; + } } export class NativeConnectionCommandBoss extends AbstractCommandHandlerBoss {