mirror of
https://github.com/d07RiV/diabloweb.git
synced 2026-06-03 21:41:38 +00:00
i forgot
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "diabloweb",
|
||||
"version": "1.0.22",
|
||||
"version": "1.0.24",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "diabloweb",
|
||||
"version": "1.0.22",
|
||||
"version": "1.0.24",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "7.4.3",
|
||||
|
||||
@@ -5,7 +5,7 @@ import ReactGA from 'react-ga';
|
||||
|
||||
import create_fs from './fs';
|
||||
import load_game from './api/loader';
|
||||
import { SpawnSize } from './api/load_spawn';
|
||||
import { SpawnSizes } from './api/load_spawn';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
ReactGA.initialize('UA-43123589-6');
|
||||
@@ -98,7 +98,7 @@ class App extends React.Component {
|
||||
|
||||
this.fs.then(fs => {
|
||||
const spawn = fs.files.get('spawn.mpq');
|
||||
if (spawn && spawn.byteLength === SpawnSize) {
|
||||
if (spawn && SpawnSizes.includes(spawn.byteLength)) {
|
||||
this.setState({has_spawn: true});
|
||||
}
|
||||
});
|
||||
@@ -554,7 +554,7 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {started, loading, error, progress, dropping, touch, has_spawn} = this.state;
|
||||
const {started, loading, error, progress, dropping, has_spawn} = this.state;
|
||||
return (
|
||||
<div className={classNames("App", {touch: this.touchControls, started, dropping, keyboard: !!this.showKeyboard})} ref={this.setElement}>
|
||||
<div className="touch-ui touch-mods">
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const SpawnSize = 50274091;
|
||||
const SpawnSizes = [50274091, 25830791];
|
||||
|
||||
export { SpawnSize };
|
||||
export { SpawnSizes };
|
||||
|
||||
export default async function load_spawn(api, fs) {
|
||||
let file = fs.files.get('spawn.mpq');
|
||||
if (file && file.byteLength !== SpawnSize) {
|
||||
if (file && !SpawnSizes.includes(file.byteLength)) {
|
||||
fs.files.delete('spawn.mpq');
|
||||
await fs.delete('spawn.mpq');
|
||||
file = null;
|
||||
@@ -17,14 +17,14 @@ export default async function load_spawn(api, fs) {
|
||||
responseType: 'arraybuffer',
|
||||
onDownloadProgress: e => {
|
||||
if (api.onProgress) {
|
||||
api.onProgress({text: 'Downloading...', loaded: e.loaded, total: e.total || SpawnSize});
|
||||
api.onProgress({text: 'Downloading...', loaded: e.loaded, total: e.total || SpawnSizes[1]});
|
||||
}
|
||||
},
|
||||
headers: {
|
||||
'Cache-Control': 'max-age=31536000'
|
||||
}
|
||||
});
|
||||
if (spawn.data.byteLength !== SpawnSize) {
|
||||
if (!SpawnSizes.includes(spawn.data.byteLength)) {
|
||||
throw Error("Invalid spawn.mpq size. Try clearing cache and refreshing the page.");
|
||||
}
|
||||
const data = new Uint8Array(spawn.data);
|
||||
|
||||
Reference in New Issue
Block a user