mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Add metadata (hash, ramUsage) to be returns
Allows for better dirty checking and integrations
This commit is contained in:
parent
935f4718e0
commit
cf8908fbc8
@ -4,6 +4,7 @@ import { Terminal } from "./Terminal";
|
||||
import { SnackbarEvents } from "./ui/React/Snackbar";
|
||||
import { IMap, IReturnStatus } from "./types";
|
||||
import { GetServer } from "./Server/AllServers";
|
||||
import { resolve } from "cypress/types/bluebird";
|
||||
|
||||
export function initElectron(): void {
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
@ -43,7 +44,9 @@ function initWebserver(): void {
|
||||
data: {
|
||||
files: home.scripts.map((script) => ({
|
||||
filename: script.filename,
|
||||
code: script.code
|
||||
code: script.code,
|
||||
hash: script.hash(),
|
||||
ramUsage: script.ramUsage
|
||||
}))
|
||||
}
|
||||
}
|
||||
@ -72,12 +75,17 @@ function initWebserver(): void {
|
||||
msg: "Home server does not exist."
|
||||
}
|
||||
}
|
||||
const result = home.writeToScriptFile(Player, filename, code);
|
||||
|
||||
const {success, overwritten} = home.writeToScriptFile(Player, filename, code);
|
||||
let script;
|
||||
if (success) {
|
||||
script = home.getScript(filename);
|
||||
}
|
||||
return {
|
||||
res: result.success,
|
||||
res: success,
|
||||
data: {
|
||||
overwritten: result.overwritten
|
||||
overwritten,
|
||||
hash: script?.hash() || undefined,
|
||||
ramUsage: script?.ramUsage
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user