Some minor fixes

This commit is contained in:
WolverinDEV
2021-02-15 19:13:54 +01:00
parent d06d350ded
commit 75b0a5beeb
3 changed files with 24 additions and 8 deletions
+1 -1
Submodule github updated: 7f89167600...d298d09439
+12
View File
@@ -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;
}
@@ -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 {