diff --git a/README.md b/README.md index a61e695..453b8c0 100644 --- a/README.md +++ b/README.md @@ -159,11 +159,11 @@ This is our current roadmap goals. You can find older ones [here](repository/pag * ToS Violation Window *(2.1.0)* * Add `latest.log` file generation *(2.1.2)* * Add an option to show terminal with the wine's log of the game *(7375c743, released in 2.1.3)* +* Statistics window * Add Chinese game's version support (due to changes in the Krock's patch) * Implement manual config flushing functionality from the Empathize's API * Add analytics window * Dark progress bar design -* Statistics window * Changelog window * Screenshots explorer * Add Patch category in settings menu with diff --git a/analytics.html b/analytics.html index dfaaf51..3ed10fd 100644 --- a/analytics.html +++ b/analytics.html @@ -5,6 +5,7 @@ + diff --git a/package.json b/package.json index a1612d9..732ce81 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "check": "svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@empathize/framework": "^1.4.6", + "@empathize/framework": "^1.4.8", "js-md5": "^0.7.3", "semver": "^7.3.5", "svelte-i18n": "^3.3.13", diff --git a/public/locales/de-de.yaml b/public/locales/de-de.yaml index b770f6e..395f8f3 100644 --- a/public/locales/de-de.yaml +++ b/public/locales/de-de.yaml @@ -322,4 +322,23 @@ tos_violation: title: Ich verstehe das Risiko tooltip: Sie sollten diesen Text wirklich lesen, Er ist sehr wichtig. cancel: Abbrechen - discord: Unser Discord Server \ No newline at end of file + discord: Unser Discord Server + +# Analytics window +analytics: + title: Yanfeis Kommission... + header: Teilnahme an der anonymen Datenerhebung + + body: + - Um die aktive Nutzerbasis für Linux zu zählen, möchte Yanfei bei jedem Update des Spiels Ihre IP-Adresse erfassen + - Die IP-Adresse wird zu Sicherheitszwecken gehasht + + actions: + share_country: + title: Land teilen + hint: Erlauben Sie Yanfei das Land zu speichern das Ihre IP-Adresse anzeigt, um die Statistiken detaillierter zu gestalten. + Es werden keine anderen Daten als das Land gespeichert + + participate: Teilnehmen + skip: Überspringen + skip_forever: Überspringen und nicht mehr nach fragen \ No newline at end of file diff --git a/public/locales/en-us.yaml b/public/locales/en-us.yaml index fe485f6..02ae16d 100644 --- a/public/locales/en-us.yaml +++ b/public/locales/en-us.yaml @@ -322,4 +322,22 @@ tos_violation: title: I understand the risk tooltip: You really should read this text above. It's important cancel: Cancel - discord: Our discord server \ No newline at end of file + discord: Our discord server + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/public/locales/es-es.yaml b/public/locales/es-es.yaml index 4e79f57..509dbbc 100644 --- a/public/locales/es-es.yaml +++ b/public/locales/es-es.yaml @@ -320,4 +320,22 @@ tos_violation: title: Sí, entiendo el riesgo tooltip: Realmente deberías leer el texto de arriba. Es importante. cancel: Cancelar - discord: Nuestro servidor de Discord \ No newline at end of file + discord: Nuestro servidor de Discord + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/public/locales/fr-fr.yaml b/public/locales/fr-fr.yaml index cefca77..47d82ca 100644 --- a/public/locales/fr-fr.yaml +++ b/public/locales/fr-fr.yaml @@ -23,7 +23,7 @@ launcher: game: downloading: Téléchargement du jeu... unpacking: Décompression du jeu... - applying_changes: Applying changes... + applying_changes: Application des changements... deleting_outdated: Suppression des fichiers non à jour... # Voice packages installation @@ -42,12 +42,14 @@ launcher: update: Mise à jour apply_changes: - title: Apply changes - hint: Apply hdiff changes to the game files + # There you may want to do it with a line break "Appliquer" may look better ? + title: Appliquer les changements + hint: Appliquer le patch hdiff sur les fichiers du jeu remove_outdated: - title: Remove outdated - hint: Remove outdated game files + # Same as "Appliquer" to keep a consistency if the previous one has a line break this one should else none but welcome long button I guess. + title: Supprimer les obsolètes + hint: Supprimer les fichiers du jeu qui sont devenus obsolètes # When the game should be patched patching: @@ -310,8 +312,8 @@ notifications: # HDiffPatch couldn't successfully apply game files changes game_changes_applying_error: - title: An error occurred during game updating - body: '{files} files couldn''t be updated by the hdiff patch' + title: Une erreur a été détectée pendant la mise à jour du jeu + body: '{files} fichiers n''ont pas pu être mise à jour avec le patch hdiff' # ToS violation warning window tos_violation: @@ -330,4 +332,23 @@ tos_violation: title: Je comprends les risques tooltip: Vous devriez réellement lire le texte ci-dessus, c'est important. cancel: Annuler - discord: Notre serveur discord \ No newline at end of file + discord: Notre serveur discord + +# Analytics window +analytics: + title: Commission de Yanfei... + header: Participer a la collecte des données anonymement + + body: + - Pour comptabiliser le nombre d'utilisateurs sur Linux, Yanfei aimerait collecter votre adresse IP à chaque mise à jour du jeu + - Votre adresse IP sera cryptée (méthode Hash) pour des raisons de sécurités + + actions: + share_country: + title: Partage du Pays + hint: Autoriser Yanfei a sauvegardé votre Pays avec votre IP pour rendre les statistiques plus détaillées. + Aucune autre donnée que votre pays sera sauvegardé + + participate: Participer + skip: Passer + skip_forever: Passer et ne plus demander \ No newline at end of file diff --git a/public/locales/hu-hu.yaml b/public/locales/hu-hu.yaml index 724e757..c459240 100644 --- a/public/locales/hu-hu.yaml +++ b/public/locales/hu-hu.yaml @@ -23,7 +23,7 @@ launcher: game: downloading: Játék letöltése folyamatban... unpacking: Játék kibontása folyamatban... - applying_changes: Applying changes... + applying_changes: Változások alkalmazása... deleting_outdated: Lejárt fájlok kitörlése... # Voice packages installation @@ -42,12 +42,12 @@ launcher: update: Frissítés apply_changes: - title: Apply changes - hint: Apply hdiff changes to the game files + title: Változások alkalmazása + hint: Hdiff változások alkalmazása a játékfájlokra remove_outdated: - title: Remove outdated - hint: Remove outdated game files + title: Elavultak törlése + hint: Elavult játékfájlok törlése # When the game should be patched patching: @@ -302,8 +302,8 @@ notifications: # HDiffPatch couldn't successfully apply game files changes game_changes_applying_error: - title: An error occurred during game updating - body: '{files} files couldn''t be updated by the hdiff patch' + title: Hiba történt a játék frissítése közben + body: '{files} fájlt nem lehetett frissíteni a hdiff patch-el' # ToS violation warning window tos_violation: @@ -322,4 +322,22 @@ tos_violation: title: Megértem tooltip: A fenti szöveget ajánlott elolvasnod. Tényleg fontos. cancel: Mégse - discord: 'Discord szerverünk:' \ No newline at end of file + discord: 'Discord szerverünk:' + +# Analytics window +analytics: + title: Yanfei jussa... + header: Részvétel anoním adatgyűjtésben + + body: + - Hogy számon tartsuk az aktív Linux felhasználók számát, Yanfei szeretné elkérni az IP-det minden játékfrissítésnél + - Az IP-d hashelve lesz biztonsági okokból + + actions: + share_country: + title: Ország megosztása + hint: Engedély Yanfei-nek hogy tárolja az IP címed regisztrált országát, hogy részletesebbek lehessenek a statisztikák. Más adat nem lesz tárolva + + participate: Részvétel + skip: Átugrás + skip_forever: Átugrás és többet ne kérdezd \ No newline at end of file diff --git a/public/locales/id-id.yaml b/public/locales/id-id.yaml index b302ec3..ed99d82 100644 --- a/public/locales/id-id.yaml +++ b/public/locales/id-id.yaml @@ -322,4 +322,22 @@ tos_violation: title: Saya mengerti risikonya tooltip: Kamu harus benar benar membaca teks diatas. Sangat Penting cancel: Batalkan - discord: Peladen Discord kami \ No newline at end of file + discord: Peladen Discord kami + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/public/locales/it-it.yaml b/public/locales/it-it.yaml index 014e024..10dcb52 100644 --- a/public/locales/it-it.yaml +++ b/public/locales/it-it.yaml @@ -321,3 +321,21 @@ tos_violation: tooltip: Dovresti davvero leggere il testo sopra. È importante cancel: Annulla discord: Il nostro server Discord + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/public/locales/nb-no.yaml b/public/locales/nb-no.yaml index 0a745d8..f59c18d 100644 --- a/public/locales/nb-no.yaml +++ b/public/locales/nb-no.yaml @@ -322,4 +322,22 @@ tos_violation: title: Jeg forstår risikoen tooltip: Du burde virkelig lese teksten over. Det er viktig cancel: Avbryt - discord: Vår discord server \ No newline at end of file + discord: Vår discord server + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/public/locales/ru-ru.yaml b/public/locales/ru-ru.yaml index cd2f314..27a15c8 100644 --- a/public/locales/ru-ru.yaml +++ b/public/locales/ru-ru.yaml @@ -321,4 +321,23 @@ tos_violation: title: Я осознаю риск tooltip: Вы действительно должны прочитать этот текст сверху. Это важно cancel: Отменить - discord: Наш Discord сервер \ No newline at end of file + discord: Наш Discord сервер + +# Analytics window +analytics: + title: Просьба Янь Фэй... + header: Примите участие в анонимном сборе данных + + body: + - Чтобы посчитать число активных игроков на Linux, Янь Фэй просит их поделиться IP адресом после каждого обновления игры + - IP адрес будет хэширован для обеспечения его безопасности + + actions: + share_country: + title: Поделиться названием страны + hint: Разрешить Янь Фэй хранить название страны, к которой привязан ваш IP адрес, чтобы сделать статистику более детальной. + Никаких других данных кроме названия страны сохранено не будет + + participate: Участвовать + skip: Пропустить + skip_forever: Пропустить и больше не спрашивать \ No newline at end of file diff --git a/public/locales/uwu.yaml b/public/locales/uwu.yaml index 0e14123..a8d8b05 100644 --- a/public/locales/uwu.yaml +++ b/public/locales/uwu.yaml @@ -321,4 +321,22 @@ tos_violation: title: I understand the risk tooltip: You really should read this text above. It's important cancel: Cancel - discord: Our discord server \ No newline at end of file + discord: Our discord server + +# Analytics window +analytics: + title: Yanfei's commission... + header: Participate in anonymous data collection + + body: + - To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates + - The IP address will be hashed for security purpose + + actions: + share_country: + title: Share country + hint: Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored + + participate: Participate + skip: Skip + skip_forever: Skip and don't ask again \ No newline at end of file diff --git a/src/analytics.svelte b/src/analytics.svelte index 055018d..1797453 100644 --- a/src/analytics.svelte +++ b/src/analytics.svelte @@ -6,14 +6,31 @@ import { onMount } from 'svelte'; import { _, locale } from 'svelte-i18n'; - import { Configs, Windows } from './empathize'; + import { Configs, Windows, fetch, IPC } from './empathize'; + + import constants from './ts/Constants'; + + import YanfeiIcon from './assets/images/yanfei.png'; + + import LeftCheckbox from './components/LeftCheckbox.svelte'; + import Button from './components/Button.svelte'; onMount(() => { Windows.current.show(); - Windows.current.center(); + Windows.current.center(700, 460); }); - Neutralino.events.on('windowClose', () => { + let shareCountry = true; + + const closeWindow = async () => { + await Neutralino.filesystem.removeFile(`${await constants.paths.launcherDir}/.analytics`); + + Neutralino.app.exit(); + }; + + Neutralino.events.on('windowClose', async () => { + await IPC.write('analytics-close'); + Neutralino.app.exit(); }); @@ -28,6 +45,56 @@ {#if typeof $locale === 'string'}
- +
+ + +

{$_('analytics.header')}

+
+ +

{$_('analytics.body.0')}

+

{$_('analytics.body.1')}

+ + +
{/if} diff --git a/src/components/Checkbox.svelte b/src/components/Checkbox.svelte index 64fec1f..d16548f 100644 --- a/src/components/Checkbox.svelte +++ b/src/components/Checkbox.svelte @@ -1,6 +1,8 @@ + +
+
+ + +
+ + {$_(lang)} +
+ + diff --git a/src/defaultSettings.ts b/src/defaultSettings.ts index dd74625..5aa7baf 100644 --- a/src/defaultSettings.ts +++ b/src/defaultSettings.ts @@ -222,7 +222,14 @@ export default new Promise(async (resolve) => { * @default "5d" */ launcher: '5d' - } + }, + + /** + * Skip analytics window + * + * @default false + */ + skip_analytics: false }); resolve(); diff --git a/src/sass/analytics.sass b/src/sass/analytics.sass index 37028cb..dc404c1 100644 --- a/src/sass/analytics.sass +++ b/src/sass/analytics.sass @@ -1,37 +1,57 @@ +@use "sass:map" + @import "basic" -body - padding: 32px 64px +@import "components/button" +@import "components/checkbox" -.header - display: inline-flex +@mixin themable($theme-name, $theme-map) + body[data-theme=#{$theme-name}] + padding: 32px 64px - img - width: 96px - height: 96px - margin-right: 32px + background-color: map.get($theme-map, "background") -.footer - position: absolute + color: map.get($theme-map, "text") - bottom: 0 - margin-bottom: 32px + p, span, div + color: map.get($theme-map, "text") - width: calc(100% - 128px) + main + .header + display: inline-flex - > div - width: 100% + img + width: 96px + height: 96px + margin-right: 32px - div.checkbox - font-size: medium + .footer + position: absolute - .actions - display: inline-flex + bottom: 0 + margin-bottom: 32px - margin-top: 48px + width: calc(100% - 128px) - .actions-right - margin-left: auto + > div + width: 100% - .button:not(:last-child) - margin-right: 12px + div.checkbox + font-size: medium + + .actions + display: inline-flex + + margin-top: 48px + + .actions-right + margin-left: auto + + .button:not(:last-child) + margin-right: 12px + +@import "themes/light" +@import "themes/dark" + +@include themable(light, $light) +@include themable(dark, $dark) diff --git a/src/settings.svelte b/src/settings.svelte index 067b927..126464b 100644 --- a/src/settings.svelte +++ b/src/settings.svelte @@ -329,7 +329,9 @@ @@ -347,19 +349,25 @@ { @@ -374,7 +382,9 @@ @@ -382,7 +392,9 @@ @@ -406,7 +418,9 @@ runnersRecommendable = value} /> @@ -418,7 +432,9 @@ dxvkRecommendable = value} /> diff --git a/src/ts/Constants.ts b/src/ts/Constants.ts index 264238c..59ed46a 100644 --- a/src/ts/Constants.ts +++ b/src/ts/Constants.ts @@ -231,7 +231,8 @@ export default class constants fpsunlock: { unlocker: `https://github.com/34736384/${this.placeholders.lowercase.first}-fps-unlock/releases/download/v1.4.2/unlockfps.exe`, bat: 'https://dev.kaifa.ch/Maroxy/an-anime-game-aur/raw/branch/fpsunlock/fpsunlock.bat' - } + }, + analytics: 'https://aagl.launcher.moe/stat/' }; // TODO: cache drops at that dates instead of the 7 days period diff --git a/src/ts/launcher/State.ts b/src/ts/launcher/State.ts index 05c365b..32085f9 100644 --- a/src/ts/launcher/State.ts +++ b/src/ts/launcher/State.ts @@ -107,7 +107,6 @@ export default class State title: 'ToS violation warning', width: 700, height: 500, - alwaysOnTop: true, exitProcessOnClose: false }); @@ -140,6 +139,46 @@ export default class State }); } + // If there's analytics window waits for its time + else if (await fs.exists(path.join(await constants.paths.launcherDir, '.analytics'))) + { + Windows.open('analytics', { + title: Locales.translate('analytics.title') as string, + width: 700, + height: 460, + exitProcessOnClose: false + }); + + await new Promise((resolve) => { + const analyticsWaiter = async () => { + let closed = false; + + for (const record of await IPC.read()) + if (record.data == 'analytics-close') + { + closed = true; + + record.pop(); + + break; + } + + if (closed) + resolve(); + + else + { + if (await fs.exists(path.join(await constants.paths.launcherDir, '.analytics'))) + setTimeout(analyticsWaiter, 1000); + + else resolve(); + } + }; + + setTimeout(analyticsWaiter, 1000); + }); + } + // Show launcher's window await Windows.current.show(); await Windows.current.center(1280, 700); diff --git a/src/ts/launcher/states/Install.ts b/src/ts/launcher/states/Install.ts index 05cdb6b..7abdd3a 100644 --- a/src/ts/launcher/states/Install.ts +++ b/src/ts/launcher/states/Install.ts @@ -1,10 +1,13 @@ import type Launcher from '../../Launcher'; +import { promisify, Configs } from '../../../empathize'; + import Game from '../../Game'; import Prefix from '../../core/Prefix'; import constants from '../../Constants'; import Locales from '../Locales'; -import { promisify } from '@empathize/framework'; + +declare const Neutralino; export default (launcher: Launcher): Promise => { return new Promise(async (resolve) => { @@ -103,6 +106,9 @@ export default (launcher: Launcher): Promise => { ] }); + if (!await Configs.get('skip_analytics')) + await Neutralino.filesystem.writeFile(`${await constants.paths.launcherDir}/.analytics`, ''); + // Download voice package when the game itself has been installed import('./InstallVoice').then((module) => { module.default(launcher).then(() => resolve());