MISC: Allow exporting save data even if game fails to load (#2784)

This commit is contained in:
catloversg
2026-05-19 05:12:04 +07:00
committed by GitHub
parent 3ebe82c60a
commit 016ffbf8c7
3 changed files with 9 additions and 1 deletions
+6 -1
View File
@@ -27,6 +27,12 @@
</div>
<!-- Use esm for top-level await -->
<script type="module">
if (!window.indexedDB || typeof window.indexedDB.databases !== "function") {
const errorMessage = `Your browser is too outdated. Please update your browser.\n\nUserAgent: ${navigator.userAgent}`;
alert(errorMessage);
// This is the simplest way to stop execution in top-level code without using a labeled block or IIFE.
throw new Error(errorMessage);
}
const databaseName = "bitburnerSave";
// Check src/db.ts to see why the current max version is 2. If the database version is greater than this value, it
// means that the code in this file is outdated.
@@ -35,7 +41,6 @@
const database = databases.find((info) => info.name === databaseName);
if (!database) {
alert("There is no save data");
// This is the simplest way to stop execution in top-level code without using a labeled block or IIFE.
throw new Error("There is no save data");
}
if (database.version === undefined || database.version > maxDatabaseVersion) {
+2
View File
@@ -61,6 +61,8 @@ export function LoadingScreen(): React.ReactElement {
<Grid item>
<Typography>
If the game fails to load, consider <a href="?noScripts">killing all scripts</a>
<br />
You can export your save data at <a href="./export.html">export.html</a>
</Typography>
</Grid>
)}
+1
View File
@@ -12,6 +12,7 @@ npm install
cd ..
# .app should have the fully built game already after npm run build
cp export.html .package
cp -r .app/* .package
cp -r electron/* .package