diff --git a/neutralino.config.json b/neutralino.config.json index 4b43044..44bdd0f 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -40,4 +40,4 @@ "binaryVersion": "4.0.0", "clientVersion": "3.0.0" } -} \ No newline at end of file +} diff --git a/src/ts/core/Downloader.ts b/src/ts/core/Downloader.ts index bd37ddc..8674f9e 100644 --- a/src/ts/core/Downloader.ts +++ b/src/ts/core/Downloader.ts @@ -1,3 +1,4 @@ +import Process from '../neutralino/Process'; import { DebugThread } from './Debug'; import fetch from './Fetch'; @@ -48,7 +49,7 @@ class Stream if (this.onStart) this.onStart(); - const command = `curl -s -L -N -o "${output}" "${uri}"`; + const command = `curl -s -L -N -o '${Process.addSlashes(output)}' '${uri}'`; Neutralino.os.execCommand(command, { background: true diff --git a/src/ts/launcher/State.ts b/src/ts/launcher/State.ts index b98f719..dda9960 100644 --- a/src/ts/launcher/State.ts +++ b/src/ts/launcher/State.ts @@ -65,17 +65,20 @@ export default class State this.predownloadButton.style['display'] = 'none'; this.settingsButton.style['display'] = 'none'; - const module = this._state === 'game-pre-installation-available' ? - 'Predownload' : 'PredownloadVoice'; + // We must specify this files here directly + // because otherwise Vite will not bundle 'em + const predownloadModule = import('./states/Predownload'); + const predownloadVoiceModule = import('./states/PredownloadVoice'); - import(`./states/${module}`).then((module) => { - module.default(this.launcher).then(() => { - this.update().then(() => { - this.launchButton.style['display'] = 'block'; - this.settingsButton.style['display'] = 'block'; + (this._state === 'game-pre-installation-available' ? predownloadModule : predownloadVoiceModule) + .then((module) => { + module.default(this.launcher).then(() => { + this.update().then(() => { + this.launchButton.style['display'] = 'block'; + this.settingsButton.style['display'] = 'block'; + }); }); }); - }); }; this.update().then(() => { diff --git a/src/ts/launcher/states/Predownload.ts b/src/ts/launcher/states/Predownload.ts index 2811752..222fb1d 100644 --- a/src/ts/launcher/states/Predownload.ts +++ b/src/ts/launcher/states/Predownload.ts @@ -12,6 +12,8 @@ export default (launcher: Launcher): Promise => { module.default(launcher).then(() => updateGame()); }); } + + else updateGame(); }); const updateGame = async () => { diff --git a/src/ts/launcher/states/PredownloadVoice.ts b/src/ts/launcher/states/PredownloadVoice.ts index 10da460..d6d2f02 100644 --- a/src/ts/launcher/states/PredownloadVoice.ts +++ b/src/ts/launcher/states/PredownloadVoice.ts @@ -1,9 +1,12 @@ import type Launcher from '../../Launcher'; import Voice from '../../Voice'; +import Game from '../../Game'; export default (launcher: Launcher, prevGameVersion: string|null = null): Promise => { return new Promise(async (resolve) => { + prevGameVersion ??= await Game.current; + Voice.predownloadUpdate(await Voice.selected, prevGameVersion).then((stream) => { launcher.progressBar?.init({ label: 'Downloading voice package...',