Skip to content

Commit

Permalink
fix: fixes remove all tokens console command
Browse files Browse the repository at this point in the history
  • Loading branch information
ndorin committed Sep 16, 2024
1 parent cee8e8e commit ba9cbb2
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void AddConsoleCommands()
CrestronConsole.AddNewConsoleCommand(GenerateClientTokenFromConsole, "MobileAddUiClient", "Adds a client and generates a token. ? for more help", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(RemoveToken, "MobileRemoveUiClient", "Removes a client. ? for more help", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand((s) => PrintClientInfo(), "MobileGetClientInfo", "Displays the current client info", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(RemoveAllTokens, "MobileRemoveAllUiClients", "Removes all clients", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(RemoveAllTokens, "MobileRemoveAllClients", "Removes all clients", ConsoleAccessLevelEnum.AccessOperator);
}


Expand Down Expand Up @@ -802,7 +802,13 @@ private void RemoveAllTokens(string s)
{
if (s == "?" || string.IsNullOrEmpty(s))
{
CrestronConsole.ConsoleCommandResponse(@"Removes all clients from the server");
CrestronConsole.ConsoleCommandResponse(@"Removes all clients from the server. To execute add 'confirm' to command");
return;
}

if (s != "confirm")
{
CrestronConsole.ConsoleCommandResponse(@"To remove all clients, add 'confirm' to the command");
return;
}

Expand All @@ -816,8 +822,6 @@ private void RemoveAllTokens(string s)
var path = _wsPath + client.Key;
if (_server.RemoveWebSocketService(path))
{
UiClients.Remove(client.Key);

CrestronConsole.ConsoleCommandResponse(string.Format("Client removed with token: {0}", client.Key));
}
else
Expand All @@ -826,6 +830,8 @@ private void RemoveAllTokens(string s)
}
}

UiClients.Clear();

UpdateSecret();
}

Expand Down

0 comments on commit ba9cbb2

Please sign in to comment.