From f15f8ed4b52ba0fa6d2ff9567683535debcd76f6 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sat, 23 Oct 2021 21:14:51 +0200 Subject: [PATCH 1/6] fix genshinlib error --- entry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/entry.js b/entry.js index 8555a8a..154291c 100644 --- a/entry.js +++ b/entry.js @@ -6,6 +6,7 @@ const { shell, nativeImage } = require('electron'); +const { Genshinlib } = require('./public/js/Genshinlib'); const path = require('path'); From 66ba07a3de767f9ea5ae695876dbd55e40792fc7 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sat, 23 Oct 2021 23:39:50 +0200 Subject: [PATCH 2/6] Swap Runners to Wine Version --- public/html/settings.html | 2 +- public/locales/de.json | 1 + public/locales/en-us.json | 1 + public/locales/en.json | 1 + public/locales/es.json | 1 + public/locales/fr.json | 1 + public/locales/id.json | 1 + public/locales/ja.json | 1 + public/locales/ko.json | 1 + public/locales/pt.json | 1 + public/locales/ru.json | 1 + public/locales/th.json | 1 + public/locales/vi.json | 1 + public/locales/zh-cn.json | 1 + public/locales/zh-tw.json | 1 + 15 files changed, 15 insertions(+), 1 deletion(-) diff --git a/public/html/settings.html b/public/html/settings.html index f0f7d73..8c8c056 100644 --- a/public/html/settings.html +++ b/public/html/settings.html @@ -64,7 +64,7 @@
-

Runners

+

diff --git a/public/locales/de.json b/public/locales/de.json index 4adc818..1641ff0 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -6,6 +6,7 @@ "Voice": "Sprachpaket", "SettingsTitle": "Einstellungen", "GeneralSettings": "Generell", + "WineVersion": "Wine Version", "Downloading": "wird Heruntergeladen", "Unpack": "wird Entpackt", "GameDownloaded": "Spiel würde erfolgreich heruntergeladen", diff --git a/public/locales/en-us.json b/public/locales/en-us.json index 7eddd44..03a768b 100644 --- a/public/locales/en-us.json +++ b/public/locales/en-us.json @@ -7,6 +7,7 @@ "SettingsTitle": "Settings", "GeneralSettings": "General", "Downloading": "Downloading", + "WineVersion": "Wine version", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", "ApplyPatch": "Applying patch...", diff --git a/public/locales/en.json b/public/locales/en.json index 7eddd44..3c84201 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/es.json b/public/locales/es.json index 7eddd44..3c84201 100644 --- a/public/locales/es.json +++ b/public/locales/es.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/fr.json b/public/locales/fr.json index 7eddd44..3c84201 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/id.json b/public/locales/id.json index 7eddd44..3c84201 100644 --- a/public/locales/id.json +++ b/public/locales/id.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/ja.json b/public/locales/ja.json index 7a2a76e..d993c8b 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -7,6 +7,7 @@ "SettingsTitle": "設定", "GeneralSettings": "一般", "Downloading": "ダウンロード中", + "WineVersion": "ワインバージョン", "Unpack": "開梱", "GameDownloaded": "ゲームのインストールに成功しました", "ApplyPatch": "パッチの適用...", diff --git a/public/locales/ko.json b/public/locales/ko.json index 7eddd44..3c84201 100644 --- a/public/locales/ko.json +++ b/public/locales/ko.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/pt.json b/public/locales/pt.json index 7eddd44..3c84201 100644 --- a/public/locales/pt.json +++ b/public/locales/pt.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/ru.json b/public/locales/ru.json index 7eddd44..3c84201 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/th.json b/public/locales/th.json index 7eddd44..3c84201 100644 --- a/public/locales/th.json +++ b/public/locales/th.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/vi.json b/public/locales/vi.json index 7eddd44..3c84201 100644 --- a/public/locales/vi.json +++ b/public/locales/vi.json @@ -6,6 +6,7 @@ "Voice": "Voice Pack", "SettingsTitle": "Settings", "GeneralSettings": "General", + "WineVersion": "Wine version", "Downloading": "Downloading", "Unpack": "Unpacking", "GameDownloaded": "Game was successfully installed", diff --git a/public/locales/zh-cn.json b/public/locales/zh-cn.json index f5f0ddd..75a0221 100644 --- a/public/locales/zh-cn.json +++ b/public/locales/zh-cn.json @@ -7,6 +7,7 @@ "SettingsTitle": "设置", "GeneralSettings": "一般的", "Downloading": "下载", + "WineVersion": "葡萄酒版", "Unpack": "开箱", "GameDownloaded": "游戏安装成功", "ApplyPatch": "应用补丁...", diff --git a/public/locales/zh-tw.json b/public/locales/zh-tw.json index cc1d6df..2d73ce6 100644 --- a/public/locales/zh-tw.json +++ b/public/locales/zh-tw.json @@ -7,6 +7,7 @@ "SettingsTitle": "設置", "GeneralSettings": "一般的", "Downloading": "下載", + "WineVersion": "葡萄酒版", "Unpack": "Unpacking", "GameDownloaded": "遊戲安裝成功", "ApplyPatch": "Applying patch...", From e7b2e1e41e67c6d41f629928c68dca9ff9325f58 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sat, 23 Oct 2021 23:49:56 +0200 Subject: [PATCH 3/6] Add Update String --- public/html/settings.html | 2 +- public/locales/de.json | 1 + public/locales/en-us.json | 1 + public/locales/en.json | 1 + public/locales/es.json | 1 + public/locales/fr.json | 1 + public/locales/id.json | 1 + public/locales/ja.json | 1 + public/locales/ko.json | 1 + public/locales/pt.json | 1 + public/locales/ru.json | 1 + public/locales/th.json | 1 + public/locales/vi.json | 1 + public/locales/zh-cn.json | 1 + public/locales/zh-tw.json | 1 + src/ts/LauncherUI.ts | 2 +- 16 files changed, 16 insertions(+), 2 deletions(-) diff --git a/public/html/settings.html b/public/html/settings.html index 8c8c056..4aef602 100644 --- a/public/html/settings.html +++ b/public/html/settings.html @@ -17,7 +17,7 @@ diff --git a/public/locales/de.json b/public/locales/de.json index 1641ff0..3f6f4ca 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -1,5 +1,6 @@ { "Install": "Installieren", + "Update": "Updaten", "Launch": "Starten", "Runners": "Runners", "Langs": "Sprachen", diff --git a/public/locales/en-us.json b/public/locales/en-us.json index 03a768b..ef0cacf 100644 --- a/public/locales/en-us.json +++ b/public/locales/en-us.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/en.json b/public/locales/en.json index 3c84201..cad7c8f 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/es.json b/public/locales/es.json index 3c84201..cad7c8f 100644 --- a/public/locales/es.json +++ b/public/locales/es.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/fr.json b/public/locales/fr.json index 3c84201..cad7c8f 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/id.json b/public/locales/id.json index 3c84201..cad7c8f 100644 --- a/public/locales/id.json +++ b/public/locales/id.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/ja.json b/public/locales/ja.json index d993c8b..a2a2d76 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -1,5 +1,6 @@ { "Install": "インストール", + "Update": "アップデート", "Launch": "打ち上げ", "Runners": "Runners", "Langs": "言語", diff --git a/public/locales/ko.json b/public/locales/ko.json index 3c84201..cad7c8f 100644 --- a/public/locales/ko.json +++ b/public/locales/ko.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/pt.json b/public/locales/pt.json index 3c84201..cad7c8f 100644 --- a/public/locales/pt.json +++ b/public/locales/pt.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/ru.json b/public/locales/ru.json index 3c84201..cad7c8f 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/th.json b/public/locales/th.json index 3c84201..cad7c8f 100644 --- a/public/locales/th.json +++ b/public/locales/th.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/vi.json b/public/locales/vi.json index 3c84201..cad7c8f 100644 --- a/public/locales/vi.json +++ b/public/locales/vi.json @@ -1,5 +1,6 @@ { "Install": "Install", + "Update": "Update", "Launch": "Launch", "Runners": "Runners", "Langs": "Languages", diff --git a/public/locales/zh-cn.json b/public/locales/zh-cn.json index 75a0221..3dc9fa9 100644 --- a/public/locales/zh-cn.json +++ b/public/locales/zh-cn.json @@ -1,5 +1,6 @@ { "Install": "安装", + "Update": "更新", "Launch": "发射", "Runners": "Runners", "Langs": "语言", diff --git a/public/locales/zh-tw.json b/public/locales/zh-tw.json index 2d73ce6..dc1de1e 100644 --- a/public/locales/zh-tw.json +++ b/public/locales/zh-tw.json @@ -1,5 +1,6 @@ { "Install": "安裝", + "Update": "更新", "Launch": "發射", "Runners": "Runners", "Langs": "語言", diff --git a/src/ts/LauncherUI.ts b/src/ts/LauncherUI.ts index 133fa5a..73b557a 100644 --- a/src/ts/LauncherUI.ts +++ b/src/ts/LauncherUI.ts @@ -55,7 +55,7 @@ export class LauncherUI break; case 'game-update-available': - $('#launch').text('Update'); // FIXME i18n.translate + $('#launch').text(i18n.translate('Update')); break; From e11beb4a726451965786eacd95f62db1fa22a4c0 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sun, 24 Oct 2021 08:06:04 +0200 Subject: [PATCH 4/6] Shorten line --- src/ts/LauncherUI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ts/LauncherUI.ts b/src/ts/LauncherUI.ts index 73b557a..3c824a0 100644 --- a/src/ts/LauncherUI.ts +++ b/src/ts/LauncherUI.ts @@ -162,7 +162,7 @@ export class LauncherUI i18n.setLang(lang); $('*[i18id]').each((i, element) => { - element.innerText = i18n.translate(element.getAttribute('i18id')?.toString()!); + element.innerText = i18n.translate(element.getAttribute('i18id')!); }); } } \ No newline at end of file From e75952ca68079ba9a4c80711b230e93ff38011e9 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sun, 24 Oct 2021 08:06:12 +0200 Subject: [PATCH 5/6] Fix Button not updating --- src/ts/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ts/index.ts b/src/ts/index.ts index 0438930..4b9cda6 100644 --- a/src/ts/index.ts +++ b/src/ts/index.ts @@ -37,7 +37,8 @@ $(() => { ipcRenderer.on('change-lang', (event: void, data: any) => { LauncherUI.updateBackground(); - LauncherUI.updateLang(); + // Needs data.lang in the arguments since the button doesn't get updated otherwise. + LauncherUI.updateLang(data.lang); }); let rpc: any; From 0cde3979bf987ac6cfbb15f1b0a983f0e271d863 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sun, 24 Oct 2021 08:17:04 +0200 Subject: [PATCH 6/6] Move social to LauncherUI --- src/ts/LauncherUI.ts | 13 +++++++++++++ src/ts/index.ts | 11 ++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ts/LauncherUI.ts b/src/ts/LauncherUI.ts index 3c824a0..77ceed9 100644 --- a/src/ts/LauncherUI.ts +++ b/src/ts/LauncherUI.ts @@ -156,6 +156,19 @@ export class LauncherUI Genshinlib.getBackgroundUri().then(uri => $('body').css('background-image', `url(${uri})`)); } + public static updateSocial (): void + { + fetch(`https://genshin.mihoyo.com/launcher/10/${Genshinlib.lang.launcher}?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`) + .then(res => res.text()) + .then(body => { + $('#__layout').remove(); + $(body).find('#__layout').appendTo('#launchcontent'); + + $('#launchcontent .home__main .home-swiper-wrap').remove(); + $('#launchcontent .home__main .home-news').remove(); + }); + } + public static updateLang (lang: string|null = null): void { if (lang !== null) diff --git a/src/ts/index.ts b/src/ts/index.ts index 4b9cda6..220eb93 100644 --- a/src/ts/index.ts +++ b/src/ts/index.ts @@ -25,18 +25,11 @@ $(() => { LauncherUI.setState('game-launch-available'); LauncherUI.updateBackground(); - - fetch(`https://genshin.mihoyo.com/launcher/10/${Genshinlib.lang.launcher}?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`) - .then(res => res.text()) - .then(body => { - $(body).find('#__layout').appendTo('#launchcontent'); - - $('#launchcontent .home__main .home-swiper-wrap').remove(); - $('#launchcontent .home__main .home-news').remove(); - }); + LauncherUI.updateSocial(); ipcRenderer.on('change-lang', (event: void, data: any) => { LauncherUI.updateBackground(); + LauncherUI.updateSocial(); // Needs data.lang in the arguments since the button doesn't get updated otherwise. LauncherUI.updateLang(data.lang); });