diff --git a/.gitignore b/.gitignore index 0c9ab2b..3cbbb01 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,7 @@ yarn.lock wineprefix-installation.log public/css/index.css public/css/settings.css +public/css/analytics.css +public/css/components.css public/js repository-pics/logo.xcf \ No newline at end of file diff --git a/entry.js b/entry.js index 778700c..f34b443 100644 --- a/entry.js +++ b/entry.js @@ -9,10 +9,9 @@ const { const path = require('path'); -const Store = require('electron-store'); -Store.initRenderer(); +require('electron-store').initRenderer(); -let mainWindow; +let mainWindow, analyticsWindow; ipcMain.handle('hide-window', () => mainWindow.hide()); ipcMain.handle('show-window', () => mainWindow.show()); @@ -25,7 +24,7 @@ ipcMain.on('notification', (event, args) => { }); ipcMain.handle('open-settings', () => { - const settingsWindow = new BrowserWindow({ + const settingsWindow = new BrowserWindow ({ width: 900, height: 600, webPreferences: { @@ -41,9 +40,31 @@ ipcMain.handle('open-settings', () => { }); settingsWindow.loadFile(path.join(__dirname, 'public', 'html', 'settings.html')); - settingsWindow.once('ready-to-show', () => settingsWindow.show()); + settingsWindow.once('ready-to-show', settingsWindow.show); }); +ipcMain.handle('open-analytics-participation', () => { + analyticsWindow = new BrowserWindow ({ + width: 700, + height: 500, + webPreferences: { + nodeIntegration: true, + contextIsolation: false + }, + icon: path.join(__dirname, 'public', 'images', 'icon64.png'), + autoHideMenuBar: true, + resizable: false, + parent: mainWindow, + modal: true, + show: false + }); + + analyticsWindow.loadFile(path.join(__dirname, 'public', 'html', 'analytics.html')); + analyticsWindow.once('ready-to-show', analyticsWindow.show); +}); + +ipcMain.handle('hide-analytics-participation', () => analyticsWindow.close()); + function createWindow () { // https://www.electronjs.org/docs/latest/api/browser-window/#class-browserwindow diff --git a/package.json b/package.json index 7f2f613..f5729a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "an-anime-game-linux-launcher", - "version": "0.7.0", + "version": "0.8.0", "description": "An Anime Game Linux Launcher", "author": "Nikita Podvirnyy ", "contributors": [ diff --git a/public/html/analytics.html b/public/html/analytics.html new file mode 100644 index 0000000..8b3e0a6 --- /dev/null +++ b/public/html/analytics.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + Yanfei's commission... + + + +
+ + +

Participate in anonymous data collection

+
+ +

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

+ + + + diff --git a/public/html/settings.html b/public/html/settings.html index 392058a..c96215b 100644 --- a/public/html/settings.html +++ b/public/html/settings.html @@ -6,9 +6,11 @@ + + @@ -58,7 +60,7 @@
- English + English (US)
diff --git a/public/images/yanfei.png b/public/images/yanfei.png new file mode 100644 index 0000000..93005ed Binary files /dev/null and b/public/images/yanfei.png differ diff --git a/public/locales/de.json b/public/locales/de.json index 4c8c615..7e829e2 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch nicht verfügbar", "PatchRequiredHint": "Diese Spielversion hat noch kein anti-cheat patch, Bitte warten sie ein paar Tage bevor sie es erneut versuchen", "TestPatch": "Test Patch anwenden", - "TestPatchHint": "Diese Spielversion hat ein anti-cheat patch aber es befindet sich noch in der Testphase. Sie können noch ein paar Tage warten bis es Stabil ist oder auf eigenen Risiko den Testpatch anwenden" + "TestPatchHint": "Diese Spielversion hat ein anti-cheat patch aber es befindet sich noch in der Testphase. Sie können noch ein paar Tage warten bis es Stabil ist oder auf eigenen Risiko den Testpatch anwenden", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/en-us.json b/public/locales/en-us.json index f5e122d..e60abe6 100644 --- a/public/locales/en-us.json +++ b/public/locales/en-us.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/en.json b/public/locales/en.json index 87fd972..1147b73 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/es.json b/public/locales/es.json index 87fd972..1147b73 100644 --- a/public/locales/es.json +++ b/public/locales/es.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/fr.json b/public/locales/fr.json index 87fd972..1147b73 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/id.json b/public/locales/id.json index 87fd972..1147b73 100644 --- a/public/locales/id.json +++ b/public/locales/id.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/ja.json b/public/locales/ja.json index 51d73b7..ca219c1 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -15,5 +15,13 @@ "PatchRequired": "要パッチ", "PatchRequiredHint": "このゲームバージョンにはアンチチートパッチがありません。数日待ってから再度お試しください", "TestPatch": "テストパッチの適用", - "TestPatchHint": "このゲームバージョンにはアンチチートパッチがありますが、テスト段階にあります。安定するまで数日お待ちいただくか、ご自身の責任で適用してください" + "TestPatchHint": "このゲームバージョンにはアンチチートパッチがありますが、テスト段階にあります。安定するまで数日お待ちいただくか、ご自身の責任で適用してください", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/ko.json b/public/locales/ko.json index 87fd972..1147b73 100644 --- a/public/locales/ko.json +++ b/public/locales/ko.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/pt.json b/public/locales/pt.json index 87fd972..1147b73 100644 --- a/public/locales/pt.json +++ b/public/locales/pt.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/ru.json b/public/locales/ru.json index a7c8cac..a0e82ed 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -15,5 +15,13 @@ "PatchRequired": "Необходим патч", "PatchRequiredHint": "Эта версия игры не имеет патча античита. Пожалуйста, подождите несколько дней и попробуйте снова", "TestPatch": "Применить тестовый патч", - "TestPatchHint": "Эта версия игры имеет лишь тестовый патч античита. Вы можете подождать пару дней до того, как он станет стабильным, либо применить его на свой страх и риск" + "TestPatchHint": "Эта версия игры имеет лишь тестовый патч античита. Вы можете подождать пару дней до того, как он станет стабильным, либо применить его на свой страх и риск", + "AnalyticsTitle": "Просьба Янь Фэй...", + "ParticipateInAnalytics": "Примите участие в анонимном сборе данных", + "AnalyticsText1": "Чтобы посчитать число активных игроков на Linux, Янь Фэй просит их поделиться IP адресом после каждого обновления игры", + "AnalyticsText2": "IP адрес будет хэширован для обеспечения его безопасности", + "AnalyticsShareCountry": "Поделиться названием страны", + "Participate": "Участвовать", + "Skip": "Пропустить", + "SkipAndDontAsk": "Пропустить и не спрашивать" } \ No newline at end of file diff --git a/public/locales/th.json b/public/locales/th.json index 87fd972..1147b73 100644 --- a/public/locales/th.json +++ b/public/locales/th.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/vi.json b/public/locales/vi.json index 87fd972..1147b73 100644 --- a/public/locales/vi.json +++ b/public/locales/vi.json @@ -15,5 +15,13 @@ "PatchRequired": "Patch required", "PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again", "TestPatch": "Apply test patch", - "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk" + "TestPatchHint": "This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/zh-cn.json b/public/locales/zh-cn.json index 68f1c07..742cb80 100644 --- a/public/locales/zh-cn.json +++ b/public/locales/zh-cn.json @@ -15,5 +15,13 @@ "PatchRequired": "需要补丁", "PatchRequiredHint": "此游戏版本没有防作弊补丁。请等待几天,然后重试", "TestPatch": "应用测试补丁", - "TestPatchHint": "此游戏版本有防作弊补丁,但处于测试阶段。您可以等待几天直到它稳定或自担风险应用它" + "TestPatchHint": "此游戏版本有防作弊补丁,但处于测试阶段。您可以等待几天直到它稳定或自担风险应用它", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/locales/zh-tw.json b/public/locales/zh-tw.json index 5267efd..761ea4a 100644 --- a/public/locales/zh-tw.json +++ b/public/locales/zh-tw.json @@ -15,5 +15,13 @@ "PatchRequired": "需要補丁", "PatchRequiredHint": "此遊戲版本沒有防作弊補丁。請等待幾天,然後重試", "TestPatch": "應用測試補丁", - "TestPatchHint": "該遊戲版本有一個反作弊補丁,但處於測試階段。您可以等待幾天直到它穩定或自擔風險應用它" + "TestPatchHint": "該遊戲版本有一個反作弊補丁,但處於測試階段。您可以等待幾天直到它穩定或自擔風險應用它", + "AnalyticsTitle": "Yanfei's commission...", + "ParticipateInAnalytics": "Participate in anonymous data collection", + "AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates", + "AnalyticsText2": "The IP address will be hashed for security purpose", + "AnalyticsShareCountry": "Share country", + "Participate": "Participate", + "Skip": "Skip", + "SkipAndDontAsk": "Skip and don't ask again" } \ No newline at end of file diff --git a/public/runners.json b/public/runners.json index eefd83a..a16dd2d 100644 --- a/public/runners.json +++ b/public/runners.json @@ -70,6 +70,15 @@ { "title": "Proton-GE", "runners": [ + { + "name": "Proton-6.20-GE-1", + "version": "6.20-GE-1", + "uri": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/6.20-GE-1/Proton-6.20-GE-1.tar.gz", + "archive": "tar", + "folder": "Proton-6.20-GE-1", + "makeFolder": false, + "executable": "files/bin/wine64" + }, { "name": "Proton-6.19-GE-2", "version": "6.19-GE-2", diff --git a/src/sass/analytics.sass b/src/sass/analytics.sass new file mode 100644 index 0000000..f200c84 --- /dev/null +++ b/src/sass/analytics.sass @@ -0,0 +1,37 @@ +body + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif + + padding: 32px 64px + +.header + display: inline-flex + + img + width: 96px + height: 96px + margin-right: 32px + +.footer + position: absolute + + bottom: 0 + margin-bottom: 32px + + width: calc(100% - 128px) + + > div + width: 100% + + div.checkbox + font-size: medium + + .actions + display: inline-flex + + margin-top: 48px + + .actions-right + margin-left: auto + + .button:not(:last-child) + margin-right: 12px diff --git a/src/sass/components.sass b/src/sass/components.sass new file mode 100644 index 0000000..01a2677 --- /dev/null +++ b/src/sass/components.sass @@ -0,0 +1,220 @@ +$light: #f1f4f9 +$light2: #eff2ff +$primary: #657ef8 +$secondary: #e1e7ff + +/* List of buttons */ + +.list-item + display: flex + align-items: center + + height: 52px + margin-bottom: 8px + padding: 0 12px + + border-radius: 12px + background-color: $light + + font-size: 18px + cursor: pointer + + &:hover + background-color: $light2 + + > div + width: auto + height: 52px + min-width: 52px + + margin-left: auto + + display: flex + align-items: center + + > img + width: 16px + height: 16px + + margin: auto + +.list-item-active + background-color: $primary !important + color: white !important + +.list-item-disabled + background-color: $light !important + color: #abadbd !important + + cursor: default !important + + img + filter: invert(70%) sepia(13%) saturate(241%) hue-rotate(196deg) brightness(97%) contrast(91%) + +/* Checkbox */ + +.checkbox + display: inline-flex + align-items: center + + font-size: larger + + width: calc(100% - 24px) + height: 48px + padding: 0 12px + + border-radius: 12px + + .checkbox-mark + display: flex + + background-color: $light2 + + border-radius: 16px + margin-left: auto + padding: 8px 16px + + cursor: pointer + + &:hover + background-color: $primary + + svg + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) + + svg + height: 12px + width: 12px + +.checkbox-active + .checkbox-mark + background-color: $primary + + svg + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) + +.selectable-checkbox + cursor: pointer + + &:hover + background-color: $light2 + +.checkbox-active:is(.selectable-checkbox) + background-color: $light2 + +/* Select box */ + +.select + display: inline-flex + align-items: center + + font-size: larger + + width: calc(100% - 24px) + height: 48px + padding: 0 12px + + border-radius: 12px + + .select-options + position: absolute + display: none + + height: 230px + overflow: auto + + background-color: white + border-radius: 12px + + box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2) + + padding: 8px 12px + transform: translateY(calc(50% + 32px)) translateX(208px) + + cursor: pointer + + ul + list-style: none + + padding: 0 + margin: 0 + + li + color: #8592a3 + font-size: smaller + + border-radius: 8px + padding: 8px + + &:hover + background-color: $light2 + color: $primary + + li:not(last-child) + margin-bottom: 4px + + li.selected + background-color: $light2 + color: $primary + + .selected-item + display: flex + align-items: baseline + + font-size: initial + + background-color: $light2 + + border-radius: 16px + margin-left: auto + padding: 8px 16px + + cursor: pointer + + &:hover + background-color: $primary + color: white + + svg + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) + + svg + height: 12px + width: 12px + + margin-left: 8px + + transform: rotate(90deg) + +.select-active + .selected-item + color: white + background-color: $primary + + svg + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) + + .select-options + display: block + +/* Buttons */ + +.button + background-color: $light + border-radius: 16px + border: none + + cursor: pointer + font-size: 16px + + padding: 8px 20px + + &:hover + background-color: $secondary + +.button-primary + background-color: $secondary + + &:hover + background-color: $primary + color: white diff --git a/src/sass/index.sass b/src/sass/index.sass index 4f485e7..b6b9dd8 100644 --- a/src/sass/index.sass +++ b/src/sass/index.sass @@ -20,7 +20,7 @@ body .button:hover:not([disabled]) background-color: #fac60b - box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, .3) + box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2) .button:disabled background-color: rgba(0, 0, 0, .35) diff --git a/src/sass/settings.sass b/src/sass/settings.sass index a442c48..74ccab0 100644 --- a/src/sass/settings.sass +++ b/src/sass/settings.sass @@ -55,196 +55,3 @@ body .settings-item:last-child margin-bottom: 24px - -.list-item - display: flex - align-items: center - - height: 52px - margin-bottom: 8px - padding: 0 12px - - border-radius: 12px - background-color: #f1f4f9 - - font-size: 18px - cursor: pointer - - &:hover - background-color: #eff2ff - - > div - width: auto - height: 52px - min-width: 52px - - margin-left: auto - - display: flex - align-items: center - - > img - width: 16px - height: 16px - - margin: auto - -.list-item-active - background-color: #657ef8 !important - color: white !important - -.list-item-disabled - background-color: #f1f4f9 !important - color: #abadbd !important - - cursor: default !important - - img - filter: invert(70%) sepia(13%) saturate(241%) hue-rotate(196deg) brightness(97%) contrast(91%) - -.dropdown-menu - display: flex - align-items: center - - height: 52px - margin-bottom: 8px - padding: 0 12px - - border-radius: 12px - background-color: #f1f4f9 - - font-size: 18px - cursor: pointer - -.checkbox - display: inline-flex - align-items: center - - font-size: larger - - width: calc(100% - 24px) - height: 48px - padding: 0 12px - - border-radius: 12px - - .checkbox-mark - display: flex - - background-color: #e1e7ff - - border-radius: 16px - margin-left: auto - padding: 8px 16px - - cursor: pointer - - &:hover - background-color: #657ef8 - - svg - filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) - - svg - height: 12px - width: 12px - -.checkbox-active - .checkbox-mark - background-color: #657ef8 - - svg - filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) - -.select - display: inline-flex - align-items: center - - font-size: larger - - width: calc(100% - 24px) - height: 48px - padding: 0 12px - - border-radius: 12px - - .select-options - position: absolute - display: none - - height: 230px - overflow: auto - - background-color: white - border-radius: 12px - - box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2) - - padding: 8px 12px - transform: translateY(calc(50% + 32px)) translateX(208px) - - cursor: pointer - - ul - list-style: none - - padding: 0 - margin: 0 - - li - color: #8592a3 - font-size: smaller - - border-radius: 8px - padding: 8px - - &:hover - background-color: #e1e7ff - color: #657ef8 - - li:not(last-child) - margin-bottom: 4px - - li.selected - background-color: #e1e7ff - color: #657ef8 - - .selected-item - display: flex - align-items: baseline - - font-size: initial - - background-color: #e1e7ff - - border-radius: 16px - margin-left: auto - padding: 8px 16px - - cursor: pointer - - &:hover - background-color: #657ef8 - color: white - - svg - filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) - - svg - height: 12px - width: 12px - - margin-left: 8px - - transform: rotate(90deg) - -.select-active - .selected-item - color: white - background-color: #657ef8 - - svg - filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%) - - .select-options - display: block diff --git a/src/ts/analytics.ts b/src/ts/analytics.ts new file mode 100644 index 0000000..261f6ff --- /dev/null +++ b/src/ts/analytics.ts @@ -0,0 +1,29 @@ +const { ipcRenderer } = require('electron'); + +import $ from 'cash-dom'; +import { Genshinlib } from './lib/Genshinlib'; +import { LauncherUI } from './lib/LauncherUI'; + +$(() => { + LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher')); + + $('#participate').on('click', async () => { + await fetch(`https://an-anime-game-launcher.000webhostapp.com${ !$('#share-country').hasClass('checkbox-active') ? '/?hide-geo' : '' }`); + + Genshinlib.updateConfig('analytics', Genshinlib.version); + + ipcRenderer.invoke('hide-analytics-participation'); + }); + + $('#skip').on('click', () => { + Genshinlib.updateConfig('analytics', Genshinlib.version); + + ipcRenderer.invoke('hide-analytics-participation'); + }); + + $('#skip-and-ignore').on('click', () => { + Genshinlib.updateConfig('analytics', null); + + ipcRenderer.invoke('hide-analytics-participation'); + }); +}); diff --git a/src/ts/index.ts b/src/ts/index.ts index aba80b1..56002df 100644 --- a/src/ts/index.ts +++ b/src/ts/index.ts @@ -96,6 +96,9 @@ $(() => { }); }); + if (Genshinlib.getConfig('analytics') !== null && Genshinlib.getConfig('analytics') !== Genshinlib.version) + ipcRenderer.invoke('open-analytics-participation'); + Genshinlib.getData().then(data => { // Update available if (Genshinlib.version != data.game.latest.version) diff --git a/src/ts/lib/Genshinlib.ts b/src/ts/lib/Genshinlib.ts index cc2abed..dbca01b 100644 --- a/src/ts/lib/Genshinlib.ts +++ b/src/ts/lib/Genshinlib.ts @@ -23,7 +23,8 @@ const config = new store ({ version: null, patch: null, runner: null, - rpc: false + rpc: false, + analytics: '0' } }); @@ -97,7 +98,7 @@ export class Genshinlib return config.get(property); } - public static updateConfig (property: string, value: string|boolean|null|number): Genshinlib + public static updateConfig (property: string, value: string|boolean|null|number) { return config.set(property, value); } @@ -257,10 +258,10 @@ export class Genshinlib public static patchGame (version: string, onFinish: () => void, onData: (data: string) => void) { - Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'krock.zip'), (current: number, total: number, difference: number) => null).then(() => { - Tools.unzip(path.join(this.launcherDir, 'krock.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => { + Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'patch.zip'), (current: number, total: number, difference: number) => null).then(() => { + Tools.unzip(path.join(this.launcherDir, 'patch.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => { // Delete zip file and assign patch directory. - fs.unlinkSync(path.join(this.launcherDir, 'krock.zip')); + fs.unlinkSync(path.join(this.launcherDir, 'patch.zip')); let patchDir: string = path.join(this.tmpPatchDir, version.replace(/\./g, '')); diff --git a/src/ts/lib/LauncherUI.ts b/src/ts/lib/LauncherUI.ts index 438d6b3..b2db26b 100644 --- a/src/ts/lib/LauncherUI.ts +++ b/src/ts/lib/LauncherUI.ts @@ -161,7 +161,12 @@ export class LauncherUI public static updateBackground (): void { - Genshinlib.getBackgroundUri().then(uri => $('body').css('background-image', `url(${uri})`)); + Genshinlib.getBackgroundUri().then(uri => { + uri = `url(${uri})`; + + if ($('body').css('background-image') != uri) + $('body').css('background-image', uri); + }); } public static updateSocial (): void @@ -186,4 +191,4 @@ export class LauncherUI element.innerText = this.i18n.translate(element.getAttribute('i18id')!); }); } -} \ No newline at end of file +} diff --git a/src/ts/lib/components.ts b/src/ts/lib/components.ts new file mode 100644 index 0000000..fc37b11 --- /dev/null +++ b/src/ts/lib/components.ts @@ -0,0 +1,53 @@ +import $ from 'cash-dom'; + +$(() => { + $('.checkbox-mark').on('click', (e) => { + let item = $(e.target); + + while (!item.hasClass('checkbox')) + item = item.parent(); + + if (!item.hasClass('selectable-checkbox')) + item.toggleClass('checkbox-active').trigger('classChange'); + }); + + $('.selectable-checkbox').on('click', (e) => { + let item = $(e.target); + + while (!item.hasClass('checkbox')) + item = item.parent(); + + item.toggleClass('checkbox-active').trigger('classChange'); + }); + + $('.selected-item').on('click', (e) => { + let item = $(e.target); + + while (!item.hasClass('select')) + item = item.parent(); + + item.toggleClass('select-active').trigger('classChange'); + }); + + $('.select-options li').on('click', (e) => { + let item = $(e.target), li = $(e.target); + + if (!item.hasClass('selected')) + { + while (!item.hasClass('select')) + item = item.parent(); + + item.find('.select-options li').removeClass('selected'); + li.addClass('selected'); + + item.removeClass('select-active'); + + item.find('.selected-item span').text(li.text()); + + item.trigger('selectionChanged', { + caption: li.text(), + value: li.attr('value') + }); + } + }); +}); diff --git a/src/ts/settings.ts b/src/ts/settings.ts index 180a35e..d2750e4 100644 --- a/src/ts/settings.ts +++ b/src/ts/settings.ts @@ -12,10 +12,6 @@ $(() => { // Make sure settings is shown in correct language. LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher') ?? 'en-us'); - $('*[i18id]').each((i, element) => { - element.innerText = LauncherUI.i18n.translate(element.getAttribute('i18id')?.toString()!); - }); - $('.menu-item').on('click', (e) => { $('.settings')[0]!.scrollTop = document.getElementById(e.target.getAttribute('anchor'))!.offsetTop - 16; @@ -30,46 +26,6 @@ $(() => { $(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active'); }); - $('.checkbox-mark').on('click', (e) => { - let item = $(e.target); - - while (!item.hasClass('checkbox')) - item = item.parent(); - - item.toggleClass('checkbox-active').trigger('classChange'); - }); - - $('.selected-item').on('click', (e) => { - let item = $(e.target); - - while (!item.hasClass('select')) - item = item.parent(); - - item.toggleClass('select-active').trigger('classChange'); - }); - - $('.select-options li').on('click', (e) => { - let item = $(e.target), li = $(e.target); - - if (!item.hasClass('selected')) - { - while (!item.hasClass('select')) - item = item.parent(); - - item.find('.select-options li').removeClass('selected'); - li.addClass('selected'); - - item.removeClass('select-active'); - - item.find('.selected-item span').text(li.text()); - - item.trigger('selectionChanged', { - caption: li.text(), - value: li.attr('value') - }); - } - }); - $('#language').on('selectionChanged', (e, data: any) => { let activeLang = Genshinlib.getConfig('lang.launcher'); @@ -86,7 +42,7 @@ $(() => { }); // Select the saved options in launcher.json on load - $(`#voice-list option[value="${Genshinlib.getConfig('lang.voice')}"]`).prop('selected', true); + // $(`#voice-list option[value="${Genshinlib.getConfig('lang.voice')}"]`).prop('selected', true); $(`#language li[value=${Genshinlib.getConfig('lang.launcher')}]`).addClass('selected'); $('#language .selected-item span').text($(`#language li[value=${Genshinlib.getConfig('lang.launcher')}]`).text()); @@ -100,7 +56,7 @@ $(() => { ipcRenderer.send('rpc-toggle'); }); - $('#voice-list').on('change', (e) => { + /*$('#voice-list').on('change', (e) => { let activeVP = Genshinlib.getConfig('voice'); if (activeVP != e.target.value) @@ -114,7 +70,7 @@ $(() => { } else console.log('VP can\' be changed to the already set language'); - }); + });*/ let activeRunner = Genshinlib.getConfig('runner');