From 903f812424f2994e40169ee49de216d33c2965cb Mon Sep 17 00:00:00 2001 From: Shy <48560522+shyguy1412@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:31:35 +0100 Subject: [PATCH] REMOTE: add 'getAllServers' method to RFA (#1058) --- src/RemoteFileAPI/MessageHandlers.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/RemoteFileAPI/MessageHandlers.ts b/src/RemoteFileAPI/MessageHandlers.ts index fbf59647c..b6180d8a0 100644 --- a/src/RemoteFileAPI/MessageHandlers.ts +++ b/src/RemoteFileAPI/MessageHandlers.ts @@ -1,7 +1,7 @@ import { resolveFilePath } from "../Paths/FilePath"; import { hasTextExtension } from "../Paths/TextFilePath"; import { hasScriptExtension } from "../Paths/ScriptFilePath"; -import { GetServer } from "../Server/AllServers"; +import { GetServer, GetAllServers } from "../Server/AllServers"; import { RFAMessage, FileData, @@ -111,4 +111,13 @@ export const RFARequestHandler: Record void | R getDefinitionFile: function (msg: RFAMessage): RFAMessage { return new RFAMessage({ result: libSource + "", id: msg.id }); }, + + getAllServers: function (msg: RFAMessage): RFAMessage { + const servers = GetAllServers().map((server) => ({ + hostname: server.hostname, + hasAdminRights: server.hasAdminRights, + })); + + return new RFAMessage({ result: JSON.stringify(servers), id: msg.id }); + }, };