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

2
github

@ -1 +1 @@
Subproject commit 7f89167600c72eadf1c31be0dad3b7563561699e Subproject commit d298d0943956fb47c95724ebe3e3104cca289f5f

View File

@ -54,6 +54,18 @@ class InputDeviceList extends AbstractDeviceList {
isDefault: device.input_default 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"); this.setState("healthy");
return this.cachedDevices; return this.cachedDevices;
} }

View File

@ -38,8 +38,6 @@ interface ErrorCodeListener {
class ErrorCommandHandler extends AbstractCommandHandler { class ErrorCommandHandler extends AbstractCommandHandler {
private readonly handle: ServerConnection; private readonly handle: ServerConnection;
private serverType: "teaspeak" | "teamspeak";
private errorCodeMapping: {[key: string]: ErrorCodeListener} = {}; private errorCodeMapping: {[key: string]: ErrorCodeListener} = {};
private errorCodeHistory: ErrorCodeListener[] = []; private errorCodeHistory: ErrorCodeListener[] = [];
@ -48,7 +46,6 @@ class ErrorCommandHandler extends AbstractCommandHandler {
constructor(handle: ServerConnection) { constructor(handle: ServerConnection) {
super(handle); super(handle);
this.handle = handle; this.handle = handle;
this.serverType = "teaspeak";
} }
generateReturnCode(command: string, callback: (result: CommandResult) => void, returnCode?: string) : string { generateReturnCode(command: string, callback: (result: CommandResult) => void, returnCode?: string) : string {
@ -117,14 +114,14 @@ class ErrorCommandHandler extends AbstractCommandHandler {
} else if(command.command == "initivexpand") { } else if(command.command == "initivexpand") {
if(command.arguments[0]["teaspeak"] == true) { if(command.arguments[0]["teaspeak"] == true) {
this.handle.handshake_handler().startHandshake(); this.handle.handshake_handler().startHandshake();
this.serverType = "teaspeak"; this.handle["serverType"] = "teaspeak";
} else { } else {
this.serverType = "teamspeak"; this.handle["serverType"] = "teamspeak";
} }
return true; return true;
} else if(command.command == "initivexpand2") { } else if(command.command == "initivexpand2") {
/* its TeamSpeak or TeaSpeak with experimental 3.1 and not up2date */ /* its TeamSpeak or TeaSpeak with experimental 3.1 and not up2date */
this.serverType = "teamspeak"; this.handle["serverType"] = "teamspeak";
} else if(command.command == "initserver") { } else if(command.command == "initserver") {
/* just if clientinit error did not fired (TeamSpeak) */ /* just if clientinit error did not fired (TeamSpeak) */
while(this.errorCodeHistory.length > 0) { while(this.errorCodeHistory.length > 0) {
@ -133,7 +130,7 @@ class ErrorCommandHandler extends AbstractCommandHandler {
clearTimeout(listener.timeout); clearTimeout(listener.timeout);
} }
if(this.serverType === "teaspeak") { if(this.handle.getServerType() === "teaspeak") {
this.handle.getRtcConnection().doInitialSetup(); this.handle.getRtcConnection().doInitialSetup();
} else { } else {
this.handle.getRtcConnection().setNotSupported(); this.handle.getRtcConnection().setNotSupported();
@ -197,6 +194,8 @@ export class ServerConnection extends AbstractServerConnection {
private remoteAddress: ServerAddress; private remoteAddress: ServerAddress;
private handshakeHandler: HandshakeHandler; private handshakeHandler: HandshakeHandler;
private serverType: "teaspeak" | "teamspeak";
constructor(props: ConnectionHandler) { constructor(props: ConnectionHandler) {
super(props); super(props);
@ -382,6 +381,11 @@ export class ServerConnection extends AbstractServerConnection {
getRtcConnection() : RTCConnection { getRtcConnection() : RTCConnection {
return this.rtcConnection; return this.rtcConnection;
} }
getServerType() : "teaspeak" | "teamspeak" | "unknown" {
return this.serverType;
}
} }
export class NativeConnectionCommandBoss extends AbstractCommandHandlerBoss { export class NativeConnectionCommandBoss extends AbstractCommandHandlerBoss {