mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-19 07:48:37 +02:00
BUGFIX: fix double stringify on server array (#1100)
The server array that the RFA currently sends is stringified twice. I fixed that and also added a proper ResultType for the new data
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { BaseServer } from "src/Server/BaseServer";
|
||||
|
||||
export class RFAMessage {
|
||||
jsonrpc = "2.0"; // Transmits version of JSON-RPC. Compliance maybe allows some funky interaction with external tools?
|
||||
public method?: string; // Is defined when it's a request/notification, otherwise undefined
|
||||
@@ -15,7 +17,7 @@ export class RFAMessage {
|
||||
}
|
||||
}
|
||||
|
||||
type ResultType = string | number | string[] | FileContent[];
|
||||
type ResultType = string | number | string[] | FileContent[] | RFAServerData[];
|
||||
type FileMetadata = FileData | FileContent | FileLocation | FileServer;
|
||||
|
||||
export interface FileData {
|
||||
@@ -38,6 +40,8 @@ export interface FileServer {
|
||||
server: string;
|
||||
}
|
||||
|
||||
export type RFAServerData = Pick<BaseServer, "hostname" | "hasAdminRights">;
|
||||
|
||||
export function isFileData(p: unknown): p is FileData {
|
||||
const pf = p as FileData;
|
||||
return typeof pf.server === "string" && typeof pf.filename === "string" && typeof pf.content === "string";
|
||||
|
||||
Reference in New Issue
Block a user