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", label: "reload & kill all scripts",
click: () => { click: () => {
if (intervalID) clearInterval(intervalID); if (intervalID) clearInterval(intervalID);
createWindow(true);
win.webContents.forcefullyCrashRenderer(); win.webContents.forcefullyCrashRenderer();
win.close(); win.close();
createWindow(true);
}, },
}, },
], ],
@ -114,3 +114,9 @@ function createWindow(killall) {
app.whenReady().then(() => { app.whenReady().then(() => {
createWindow(false); 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 // 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 { KEY } from "../../utils/helpers/keyCodes";
import { ProgramsSeen } from "../../Programs/ui/ProgramsRoot"; import { ProgramsSeen } from "../../Programs/ui/ProgramsRoot";
import { InvitationsSeen } from "../../Faction/ui/FactionsRoot"; import { InvitationsSeen } from "../../Faction/ui/FactionsRoot";
import { hash } from "../../hash/hash";
const openedMixin = (theme: Theme): CSSObject => ({ const openedMixin = (theme: Theme): CSSObject => ({
width: theme.spacing(31), width: theme.spacing(31),
@ -338,11 +339,13 @@ export function SidebarRoot(props: IProps): React.ReactElement {
<ListItemIcon> <ListItemIcon>
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />} {!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
</ListItemIcon> </ListItemIcon>
<ListItemText primary={ <ListItemText
<Tooltip title={__COMMIT_HASH__}> primary={
<Tooltip title={hash()}>
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography> <Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
</Tooltip> </Tooltip>
} /> }
/>
</ListItem> </ListItem>
<Divider /> <Divider />
<List> <List>

@ -69,6 +69,7 @@ import { top } from "./commands/top";
import { unalias } from "./commands/unalias"; import { unalias } from "./commands/unalias";
import { weaken } from "./commands/weaken"; import { weaken } from "./commands/weaken";
import { wget } from "./commands/wget"; import { wget } from "./commands/wget";
import { hash } from "../hash/hash";
export class Terminal implements ITerminal { export class Terminal implements ITerminal {
// Flags to determine whether the player is currently running a hack or an analyze // 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[] = []; commandHistory: string[] = [];
commandHistoryIndex = 0; 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 // True if a Coding Contract prompt is opened
contractOpen = false; contractOpen = false;
@ -555,7 +558,7 @@ export class Terminal implements ITerminal {
} }
clear(): void { 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(); TerminalEvents.emit();
TerminalClearEvents.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 { CONSTANTS } from "../Constants";
import { ActivateRecoveryMode } from "./React/RecoveryRoot"; import { ActivateRecoveryMode } from "./React/RecoveryRoot";
import { hash } from "../hash/hash";
const useStyles = makeStyles((theme: Theme) => const useStyles = makeStyles((theme: Theme) =>
createStyles({ createStyles({
@ -69,7 +70,9 @@ export function LoadingScreen(): React.ReactElement {
<CircularProgress size={150} color="primary" /> <CircularProgress size={150} color="primary" />
</Grid> </Grid>
<Grid item> <Grid item>
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString} ({__COMMIT_HASH__})</Typography> <Typography variant="h3">
Loading Bitburner v{CONSTANTS.VersionString} ({hash()})
</Typography>
</Grid> </Grid>
{show && ( {show && (
<Grid item> <Grid item>

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