diff --git a/README.md b/README.md index 27240eb..c7eb5dd 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,9 @@ We have our own [An Anime Game](https://discord.gg/ck37X6UWBp) discord server wh This is our current usage statistics. You can find older ones [here](repository/pages/STATISTICS.md) -### Our discord server — 343 member +### Our discord server — 386 member - +
diff --git a/package.json b/package.json index adcd017..b527be9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ }, "dependencies": { "@empathize/framework": "^1.4.8", - "js-md5": "^0.7.3", "semver": "^7.3.5", "svelte-i18n": "^3.3.13", "yaml": "^1.10.2" @@ -21,7 +20,6 @@ "@neutralinojs/neu": "^9.2.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.37", "@tsconfig/svelte": "^3.0.0", - "@types/js-md5": "^0.4.3", "neutralino-appimage-bundler": "^1.3.2", "sass": "^1.49.8", "svelte": "^3.46.4", diff --git a/repository/pages/STATISTICS.md b/repository/pages/STATISTICS.md index 6ebfa95..1f3346f 100644 --- a/repository/pages/STATISTICS.md +++ b/repository/pages/STATISTICS.md @@ -4,12 +4,19 @@ This file is a launcher usage statistics archive. You can see here which journey Our current statistics you can find in [readme](../../README.md) -### 2.2.0 — 29 total +> You can suggest colors for your countries - +### 2.4.0 -### 2.3.0 — 99 total +| Period | Source | Data | +| - | - | - | +| 20 Feb — 10 Mar | Discord server | | +| 10 Mar — ? | Discord server | | + +### 2.3.0 — 99 total — in-launcher analytics -> You can suggest colors for your countries \ No newline at end of file +### 2.2.0 — 29 total — in-launcher analytics + + diff --git a/repository/pics/stats/discord.png b/repository/pics/stats/2022/feb-mar.png similarity index 100% rename from repository/pics/stats/discord.png rename to repository/pics/stats/2022/feb-mar.png diff --git a/repository/pics/stats/2022/mar-apr.png b/repository/pics/stats/2022/mar-apr.png new file mode 100644 index 0000000..4e343e5 Binary files /dev/null and b/repository/pics/stats/2022/mar-apr.png differ diff --git a/src/ts/Patch.ts b/src/ts/Patch.ts index c2f092b..4641eda 100644 --- a/src/ts/Patch.ts +++ b/src/ts/Patch.ts @@ -1,5 +1,3 @@ -import md5 from 'js-md5'; - import type { PatchInfo } from './types/Patch'; import { fetch, promisify, Debug, Cache, path, fs } from '../empathize'; @@ -8,6 +6,7 @@ import { DebugThread } from '@empathize/framework/dist/meta/Debug'; import constants from './Constants'; import Game from './Game'; import Launcher from './Launcher'; +import md5 from './core/md5'; declare const Neutralino; @@ -306,18 +305,13 @@ export default class Patch // before responding whether the patch applied or not if (cache.value['playerHash'] !== null) { - constants.paths.gameDir.then((gameDir) => { - Neutralino.filesystem.readBinaryFile(`${gameDir}/UnityPlayer.dll`) - .then((currPlayer: ArrayBuffer) => { - cache.value['output']['applied'] = md5(currPlayer) != cache.value['playerHash']; + const playerHash = await md5(`${await constants.paths.gameDir}/UnityPlayer.dll`); - resolve(cache.value['output']); - }) - .catch(() => resolve(cache.value['output'])); - }); + if (playerHash !== null) + cache.value['output']['applied'] = playerHash != cache.value['playerHash']; } - else resolve(cache.value['output']); + resolve(cache.value['output']); } else reject(cache.value['error']); @@ -403,15 +397,12 @@ export default class Patch cn: hashesMatches[1][1] }[patchInfo.server]; - constants.paths.gameDir.then((gameDir) => { - Neutralino.filesystem.readBinaryFile(`${gameDir}/UnityPlayer.dll`) - .then((currPlayer: ArrayBuffer) => { - patchInfo.applied = md5(currPlayer) != originalPlayer; + const playerHash = await md5(`${await constants.paths.gameDir}/UnityPlayer.dll`); - resolveOutput(patchInfo, originalPlayer); - }) - .catch(() => resolveOutput(patchInfo)); - }); + if (playerHash !== null) + patchInfo.applied = playerHash != originalPlayer; + + resolveOutput(patchInfo, originalPlayer); } else resolveOutput(patchInfo); diff --git a/src/ts/core/md5.ts b/src/ts/core/md5.ts new file mode 100644 index 0000000..9c82083 --- /dev/null +++ b/src/ts/core/md5.ts @@ -0,0 +1,17 @@ +import { fs, path } from '../../empathize'; + +declare const Neutralino; + +export default function md5(file: string): Promise +{ + return new Promise(async (resolve) => { + if (await fs.exists(file)) + { + const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(file)}"`); + + resolve((process.stdOut || process.stdErr).split(' ')[0]); + } + + else resolve(null); + }); +}; diff --git a/src/ts/launcher/states/CheckIntegrity.ts b/src/ts/launcher/states/CheckIntegrity.ts index 403c5d1..63b5d54 100644 --- a/src/ts/launcher/states/CheckIntegrity.ts +++ b/src/ts/launcher/states/CheckIntegrity.ts @@ -1,7 +1,7 @@ import type Launcher from '../../Launcher'; import type { PatchInfo } from '../../types/Patch'; -import { fs, path, Downloader } from '../../../empathize'; +import { fs, Downloader } from '../../../empathize'; import { DebugThread } from '@empathize/framework/dist/meta/Debug'; import constants from '../../Constants'; @@ -9,6 +9,7 @@ import Patch from '../../Patch'; import Locales from '../Locales'; import Voice from '../../Voice'; import Game from '../../Game'; +import md5 from '../../core/md5'; declare const Neutralino; @@ -108,8 +109,7 @@ class FilesVerifier else if (!fileCheckInfo.remoteName.includes('UnityPlayer.dll') || !this.patch.applied) { - const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(`${this.gameDir}/${fileCheckInfo.remoteName}`)}"`); - const fileHash = (process.stdOut || process.stdErr).split(' ')[0]; + const fileHash = await md5(`${this.gameDir}/${fileCheckInfo.remoteName}`); if (fileHash != fileCheckInfo.md5) { @@ -223,9 +223,7 @@ class FilesRepairer Downloader.download(fileUri, `${gameDir}/${fileInfo.remoteName}.new`).then((stream) => { stream.finish(async () => { - const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(`${gameDir}/${fileInfo.remoteName}.new`)}"`); - - if ((process.stdOut || process.stdErr).split(' ')[0] == fileInfo.md5) + if (await md5(`${gameDir}/${fileInfo.remoteName}.new`) == fileInfo.md5) { await fs.remove(`${gameDir}/${fileInfo.remoteName}`); await fs.move(`${gameDir}/${fileInfo.remoteName}.new`, `${gameDir}/${fileInfo.remoteName}`);