mirror of
https://github.com/d07RiV/diabloweb.git
synced 2026-07-03 11:51:35 +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",
|
"name": "diabloweb",
|
||||||
"version": "1.0.22",
|
"version": "1.0.24",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "diabloweb",
|
"name": "diabloweb",
|
||||||
"version": "1.0.22",
|
"version": "1.0.24",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "7.4.3",
|
"@babel/core": "7.4.3",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import ReactGA from 'react-ga';
|
|||||||
|
|
||||||
import create_fs from './fs';
|
import create_fs from './fs';
|
||||||
import load_game from './api/loader';
|
import load_game from './api/loader';
|
||||||
import { SpawnSize } from './api/load_spawn';
|
import { SpawnSizes } from './api/load_spawn';
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
ReactGA.initialize('UA-43123589-6');
|
ReactGA.initialize('UA-43123589-6');
|
||||||
@@ -98,7 +98,7 @@ class App extends React.Component {
|
|||||||
|
|
||||||
this.fs.then(fs => {
|
this.fs.then(fs => {
|
||||||
const spawn = fs.files.get('spawn.mpq');
|
const spawn = fs.files.get('spawn.mpq');
|
||||||
if (spawn && spawn.byteLength === SpawnSize) {
|
if (spawn && SpawnSizes.includes(spawn.byteLength)) {
|
||||||
this.setState({has_spawn: true});
|
this.setState({has_spawn: true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -554,7 +554,7 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {started, loading, error, progress, dropping, touch, has_spawn} = this.state;
|
const {started, loading, error, progress, dropping, has_spawn} = this.state;
|
||||||
return (
|
return (
|
||||||
<div className={classNames("App", {touch: this.touchControls, started, dropping, keyboard: !!this.showKeyboard})} ref={this.setElement}>
|
<div className={classNames("App", {touch: this.touchControls, started, dropping, keyboard: !!this.showKeyboard})} ref={this.setElement}>
|
||||||
<div className="touch-ui touch-mods">
|
<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';
|
import axios from 'axios';
|
||||||
|
|
||||||
const SpawnSize = 50274091;
|
const SpawnSizes = [50274091, 25830791];
|
||||||
|
|
||||||
export { SpawnSize };
|
export { SpawnSizes };
|
||||||
|
|
||||||
export default async function load_spawn(api, fs) {
|
export default async function load_spawn(api, fs) {
|
||||||
let file = fs.files.get('spawn.mpq');
|
let file = fs.files.get('spawn.mpq');
|
||||||
if (file && file.byteLength !== SpawnSize) {
|
if (file && !SpawnSizes.includes(file.byteLength)) {
|
||||||
fs.files.delete('spawn.mpq');
|
fs.files.delete('spawn.mpq');
|
||||||
await fs.delete('spawn.mpq');
|
await fs.delete('spawn.mpq');
|
||||||
file = null;
|
file = null;
|
||||||
@@ -17,14 +17,14 @@ export default async function load_spawn(api, fs) {
|
|||||||
responseType: 'arraybuffer',
|
responseType: 'arraybuffer',
|
||||||
onDownloadProgress: e => {
|
onDownloadProgress: e => {
|
||||||
if (api.onProgress) {
|
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: {
|
headers: {
|
||||||
'Cache-Control': 'max-age=31536000'
|
'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.");
|
throw Error("Invalid spawn.mpq size. Try clearing cache and refreshing the page.");
|
||||||
}
|
}
|
||||||
const data = new Uint8Array(spawn.data);
|
const data = new Uint8Array(spawn.data);
|
||||||
|
|||||||
Reference in New Issue
Block a user