This commit is contained in:
Olivier Gagnon 2021-12-16 20:07:34 -05:00
parent 3436873373
commit 9e86131625
8 changed files with 35 additions and 15 deletions

@ -75,9 +75,9 @@ function createWindow(killall) {
label: "reload & kill all scripts",
click: () => {
if (intervalID) clearInterval(intervalID);
createWindow(true);
win.webContents.forcefullyCrashRenderer();
win.close();
createWindow(true);
},
},
],
@ -114,3 +114,9 @@ function createWindow(killall) {
app.whenReady().then(() => {
createWindow(false);
});
app.on("window-all-closed", function () {
console.log("Died");
app.quit();
process.exit(0);
});

File diff suppressed because one or more lines are too long

@ -1,2 +1,2 @@
// Defined by webpack on startup or compilation
declare const __COMMIT_HASH__: string;
declare let __COMMIT_HASH__: string;

@ -55,6 +55,7 @@ import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { KEY } from "../../utils/helpers/keyCodes";
import { ProgramsSeen } from "../../Programs/ui/ProgramsRoot";
import { InvitationsSeen } from "../../Faction/ui/FactionsRoot";
import { hash } from "../../hash/hash";
const openedMixin = (theme: Theme): CSSObject => ({
width: theme.spacing(31),
@ -338,11 +339,13 @@ export function SidebarRoot(props: IProps): React.ReactElement {
<ListItemIcon>
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
</ListItemIcon>
<ListItemText primary={
<Tooltip title={__COMMIT_HASH__}>
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
<ListItemText
primary={
<Tooltip title={hash()}>
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
</Tooltip>
} />
}
/>
</ListItem>
<Divider />
<List>

@ -69,6 +69,7 @@ import { top } from "./commands/top";
import { unalias } from "./commands/unalias";
import { weaken } from "./commands/weaken";
import { wget } from "./commands/wget";
import { hash } from "../hash/hash";
export class Terminal implements ITerminal {
// Flags to determine whether the player is currently running a hack or an analyze
@ -77,7 +78,9 @@ export class Terminal implements ITerminal {
commandHistory: string[] = [];
commandHistoryIndex = 0;
outputHistory: (Output | Link | RawOutput)[] = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
outputHistory: (Output | Link | RawOutput)[] = [
new Output(`Bitburner v${CONSTANTS.VersionString} (${hash()})`, "primary"),
];
// True if a Coding Contract prompt is opened
contractOpen = false;
@ -555,7 +558,7 @@ export class Terminal implements ITerminal {
}
clear(): void {
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__ || "DEV"})`, "primary")];
TerminalEvents.emit();
TerminalClearEvents.emit();
}

8
src/hash/hash.ts Normal file

@ -0,0 +1,8 @@
export function hash(): string {
try {
if (__COMMIT_HASH__) {
return __COMMIT_HASH__;
}
} catch (err) {}
return "DEV";
}

@ -15,6 +15,7 @@ import { GameRoot } from "./GameRoot";
import { CONSTANTS } from "../Constants";
import { ActivateRecoveryMode } from "./React/RecoveryRoot";
import { hash } from "../hash/hash";
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@ -69,7 +70,9 @@ export function LoadingScreen(): React.ReactElement {
<CircularProgress size={150} color="primary" />
</Grid>
<Grid item>
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString} ({__COMMIT_HASH__})</Typography>
<Typography variant="h3">
Loading Bitburner v{CONSTANTS.VersionString} ({hash()})
</Typography>
</Grid>
{show && (
<Grid item>

@ -44,10 +44,7 @@ module.exports = (env, argv) => {
// Get the current commit hash to inject into the app
// https://stackoverflow.com/a/38401256
const commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
const commitHash = require("child_process").execSync("git rev-parse --short HEAD").toString().trim();
return {
plugins: [
@ -113,7 +110,7 @@ module.exports = (env, argv) => {
},
}),
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash)
__COMMIT_HASH__: JSON.stringify(commitHash || "DEV"),
}),
// In dev mode, use a faster method of create sourcemaps
// while keeping lines/columns accurate