mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-23 08:02:04 +02:00
MISC: Allow exporting save data even if game fails to load (#2784)
This commit is contained in:
@@ -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) {
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user