REMOTE: add 'getAllServers' method to RFA (#1058)

This commit is contained in:
Shy 2024-02-10 12:31:35 +01:00 committed by GitHub
parent e8311d4f05
commit 903f812424
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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<string, (message: RFAMessage) => 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 });
},
};