- added `latest.log` file generation, changed log files naming

From previous commits:
- fixed chinese voice data installation (!33)
- don't attempt to edit /etc/hosts or use pkexec when running as flatpak (!31)

From beta-1:
- fixed compatibility issues with patch repos
This commit is contained in:
Observer KRypt0n_ 2022-02-03 17:12:55 +02:00
parent b30c2276ef
commit a4a1d3501e
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
8 changed files with 35 additions and 18 deletions

View file

@ -135,8 +135,8 @@ This is our current roadmap goals. You can find older ones [here](repository/pag
* <s>Move launcher on [Empathize](https://github.com/empathizejs/framework)</s> *(2.1.0)*
* <s>Make notifications translations</s> *(2.1.0)*
* <s>ToS Violation Window</s> *(2.1.0)*
* <s>Add `latest.log` file generation</s> *(2.1.2)*
* Add Chinese game's version support (due to changes in the Krock's patch)
* Add `latest.log` file generation
* Implement manual config flushing functionality from the Empathize's API
* Add analytics window
* Add an option to show terminal with the wine's log of the game

View file

@ -1,6 +1,6 @@
{
"applicationId": "com.gitlab.KRypt0n_.an-anime-game-launcher",
"version": "2.1.2-beta1",
"version": "2.1.2",
"defaultMode": "window",
"port": 0,
"documentRoot": "/bundle/",

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-launcher",
"version": "2.1.2-beta1",
"version": "2.1.2",
"license": "GPL-3.0",
"type": "module",
"scripts": {

View file

@ -39,7 +39,7 @@ const bundler = new Bundler({
output: path.join(__dirname, '../dist/An Anime Game Launcher.AppImage'),
// Application version
version: '2.1.2-beta1'
version: '2.1.2'
});
// Bundle project

View file

@ -19,6 +19,22 @@
const launcher = new Launcher(onMount);
const getLogFilename = (date: Date = Debug.startedAt) => {
const prefixZero = (num: number) => num < 10 ? `0${num}` : num;
return `${date.getFullYear()}-${prefixZero(date.getMonth() + 1)}-${prefixZero(date.getDate())}-${prefixZero(date.getHours())}-${prefixZero(date.getMinutes())}-${prefixZero(date.getSeconds())}.log`;
};
constants.paths.launcherDir.then((launcherDir) => {
Neutralino.filesystem.getStats(`${launcherDir}/logs/latest.log`)
.then(async () => {
const created_at = (await Neutralino.os.execCommand(`stat -c '%W' "${path.addSlashes(`${launcherDir}/logs/latest.log`)}"`)).stdOut;
Neutralino.filesystem.moveFile(`${launcherDir}/logs/latest.log`, `${launcherDir}/logs/${getLogFilename(new Date(created_at * 1000))}`);
})
.catch(() => {});
});
Neutralino.events.on('windowClose', async () => {
Downloader.closeStreams(true);
Archive.closeStreams(true);
@ -46,7 +62,7 @@
const log = Debug.get().join('\r\n');
if (log != '')
await Neutralino.filesystem.writeFile(`${launcherDir}/logs/${Debug.startedAt.getDate()}-${Debug.startedAt.getMonth() + 1}-${Debug.startedAt.getFullYear()}-${Debug.startedAt.getHours()}-${Debug.startedAt.getMinutes()}-${Debug.startedAt.getSeconds()}.log`, log);
await Neutralino.filesystem.writeFile(`${launcherDir}/logs/latest.log`, log);
// And close the launcher when they was saved
Neutralino.app.exit();
@ -64,7 +80,7 @@
const log = `=== Log can be incomplete ===\r\n\r\n${Debug.get().join('\r\n')}`;
if (log != '')
await Neutralino.filesystem.writeFile(`${await constants.paths.launcherDir}/logs/${Debug.startedAt.getDate()}-${Debug.startedAt.getMonth() + 1}-${Debug.startedAt.getFullYear()}-${Debug.startedAt.getHours()}-${Debug.startedAt.getMinutes()}-${Debug.startedAt.getSeconds()}.log`, log);
await Neutralino.filesystem.writeFile(`${await constants.paths.launcherDir}/logs/latest.log`, log);
logSavingStarted = false;
}, 5000);
@ -77,7 +93,7 @@
* Update launcher's title
*/
Game.latest.then((game) => {
Windows.current.setTitle(`An Anime Game Launcher - ${game.version} (beta revision)`);
Windows.current.setTitle(`An Anime Game Launcher - ${game.version}`);
});
/**

View file

@ -100,7 +100,7 @@ class Paths
/**
* Cache file
*
* @default "~/.local/share/anime-game-launcher/cache.json"
* @default "~/.local/share/anime-game-launcher/.cache.json"
*/
public static get cache(): Promise<string>
{

View file

@ -186,13 +186,16 @@ export default class Launcher
});
});
}
public static async isFlatpak(): Promise<boolean> {
try {
const stats = await Neutralino.filesystem.getStats("/.flatpak-info");
return stats.isFile;
} catch (error) {
return false;
}
/**
* Check if the launcher is running under flatpak
*/
public static isFlatpak(): Promise<boolean>
{
return new Promise((resolve) => {
Neutralino.filesystem.getStats('/.flatpak-info')
.then((stats) => resolve(stats.isFile))
.catch(() => resolve(false));
});
}
};

View file

@ -305,8 +305,6 @@ export default class Patch
const originalPlayer = /if \[ "\${sum}" == "([a-z0-9]{32})" \]; then/mg.exec(response);
console.log(originalPlayer);
// If we could get original UnityPlayer.dll hash - then we can
// compare it with actual UnityPlayer.dll hash and say whether the patch
// was applied or not