From 551dda74d7f76c43fdb04d9121816f24705876a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 13:21:43 +0000 Subject: [PATCH 01/21] Update typescript requirement from ^4.6.3 to ^4.7.3 Updates the requirements on [typescript](https://github.com/Microsoft/TypeScript) to permit the latest version. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.3...v4.7.3) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17c7f28..4767391 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "electron-builder": "^23.0.3", "husky": "^8.0.1", "prettier": "^2.5.1", - "typescript": "^4.6.3" + "typescript": "^4.7.3" }, "dependencies": { "electron-context-menu": "github:ArmCord/electron-context-menu", From 81377d36573fe3cf13329377eed2f3dfce0c4057 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:24:13 +0200 Subject: [PATCH 02/21] Add performance mode --- src/content/setup.html | 3 +++ src/main.ts | 5 +++-- src/settings/settings.html | 11 +++++++++- src/utils.ts | 41 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/content/setup.html b/src/content/setup.html index 6ed4c94..4b9d4bd 100644 --- a/src/content/setup.html +++ b/src/content/setup.html @@ -101,6 +101,7 @@ automaticPatches: false, mods: "cumcord", inviteWebsocket: true, + performanceMode: "none", blurType: "acrylic" }); setTimeout(() => window.armcordinternal.restart(), 5000); @@ -130,6 +131,7 @@ autoLaunch: true, minimizeToTray: true, automaticPatches: false, + performanceMode: "none", mods: options.mod, inviteWebsocket: true, blurType: "acrylic" @@ -145,6 +147,7 @@ automaticPatches: false, autoLaunch: true, mods: "none", + performanceMode: "none", inviteWebsocket: true, blurType: "acrylic" }); diff --git a/src/main.ts b/src/main.ts index ec61b77..8d1abb9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ // Modules to control application life and create native browser window import {app, BrowserWindow, session, dialog} from "electron"; import "v8-compile-cache"; -import {getConfig, setup, checkIfConfigExists} from "./utils"; +import {getConfig, setup, checkIfConfigExists, injectElectronFlags} from "./utils"; import "./extensions/mods"; import "./extensions/plugin"; import "./tray"; @@ -12,6 +12,7 @@ export var settings: any; export var customTitlebar: boolean; export var tabs: boolean; + if (process.platform == "linux") { if (process.env.$XDG_SESSION_TYPE == "wayland") { console.log("Wayland specific patches applied."); @@ -24,7 +25,7 @@ if (process.platform == "linux") { } } checkIfConfigExists(); - +injectElectronFlags(); app.whenReady().then(async () => { switch (await getConfig("windowStyle")) { case "default": diff --git a/src/settings/settings.html b/src/settings/settings.html index 7d723c5..c57151c 100644 --- a/src/settings/settings.html +++ b/src/settings/settings.html @@ -58,7 +58,14 @@

Client mod:

- +
+ +

Performance mode:

+
@@ -71,6 +78,7 @@ document.getElementById("mod").value = await settings.get("mods"); document.getElementById("channel").value = await settings.get("channel"); document.getElementById("theme").value = await settings.get("windowStyle"); + document.getElementById("performanceMode").value = await settings.get("performanceMode"); } loadSettings(); document.getElementById("save").addEventListener("click", function () { @@ -84,6 +92,7 @@ mods: document.getElementById("mod").value, blurType: "acrylic", inviteWebsocket: document.getElementById("websocket").checked, + performanceMode: document.getElementById("prfmMode").value, doneSetup: true }); }); diff --git a/src/utils.ts b/src/utils.ts index e331a96..2a42ff8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,7 @@ import * as fs from "fs"; import {app, dialog} from "electron"; import path from "path"; +import { defaultMaxListeners } from "events"; export var firstRun: boolean; export var isSetup: boolean; export var contentPath: string; @@ -42,6 +43,7 @@ export function setup() { automaticPatches: false, mods: "cumcord", blurType: "acrylic", + performanceMode: "none", inviteWebsocket: true, doneSetup: false }; @@ -63,7 +65,45 @@ export async function injectJS(inject: string) { document.body.appendChild(el); } +export async function injectElectronFlags() { + // MIT License + // Copyright (c) 2022 GooseNest + + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the "Software"), to deal + // in the Software without restriction, including without limitation the rights + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + // copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + + // The above copyright notice and this permission notice shall be included in all + // copies or substantial portions of the Software. + + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + // SOFTWARE. + const presets = { + 'performance': `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance + 'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium? + }; + switch (await getConfig("performanceMode")) { + case "performance": + console.log("Performance mode enabled"); + app.commandLine.appendSwitch(presets.performance); + break; + case "battery": + console.log("Battery mode enabled"); + app.commandLine.appendSwitch(presets.battery); + break; + default: + console.log("No performance modes set"); + } +} //ArmCord Settings/Storage manager export interface Settings { @@ -73,6 +113,7 @@ export interface Settings { minimizeToTray: boolean; automaticPatches: boolean; mods: string; + performanceMode: string, blurType: string; inviteWebsocket: boolean; doneSetup: boolean; From 98f88f4609ade9757a72262d3cd126848caa79da Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:46:30 +0200 Subject: [PATCH 03/21] Fix icon loading --- package.json | 2 +- src/window.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 17c7f28..6686ce4 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@types/node": "^17.0.33", "@types/ws": "^8.5.3", "copyfiles": "^2.4.1", - "electron": "^18.2.4", + "electron": "^19.0.4", "electron-builder": "^23.0.3", "husky": "^8.0.1", "prettier": "^2.5.1", diff --git a/src/window.ts b/src/window.ts index 7445fe7..9b6acf2 100644 --- a/src/window.ts +++ b/src/window.ts @@ -119,7 +119,7 @@ export function createCustomWindow() { height: 350, title: "ArmCord", darkTheme: true, - icon: path.join(__dirname, "/assets/icon_transparent.png"), + icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), frame: false, autoHideMenuBar: true, webPreferences: { @@ -135,7 +135,7 @@ export function createNativeWindow() { height: 350, title: "ArmCord", darkTheme: true, - icon: path.join(__dirname, "/assets/icon_transparent.png"), + icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), frame: true, autoHideMenuBar: true, webPreferences: { @@ -157,7 +157,7 @@ export function createTabsHost() { height: 350, title: "ArmCord", darkTheme: true, - icon: path.join(__dirname, "/assets/icon_transparent.png"), + icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), frame: true, autoHideMenuBar: true, webPreferences: { @@ -186,7 +186,7 @@ export function createTabsGuest(number: number) { height: 600, title: "ArmCord Guest Window " + number, darkTheme: true, - icon: path.join(__dirname, "/assets/icon_transparent.png"), + icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), frame: true, autoHideMenuBar: true, webPreferences: { @@ -223,7 +223,7 @@ export function createInviteWindow() { height: 600, title: "ArmCord Invite Manager", darkTheme: true, - icon: path.join(__dirname, "/assets/icon_transparent.png"), + icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"), frame: true, autoHideMenuBar: true, webPreferences: { From a12463877a9f7626e0a83bec93207d5429d88b24 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Fri, 10 Jun 2022 22:29:43 +0200 Subject: [PATCH 04/21] Add macOS tray icon potential fix --- assets/macos.png | Bin 0 -> 4460 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/macos.png diff --git a/assets/macos.png b/assets/macos.png new file mode 100644 index 0000000000000000000000000000000000000000..953ecfa160dfcaed2b442d82526c9cc4aab2cbb8 GIT binary patch literal 4460 zcmZ`-c{tSV_x_Aw#%?SjOBk|?@!GP>BxT>SZ)5MZFJWvmC6qCiY$1d!Lxd!<43Vu! zc9JPu2$R7`=^<8uo00{|iv0ASM%0MzpV zfG4=9-9q#H0D>~Qfdu~kw@N#!9-lJ|!G`u>0KmlgpM!vcBHnWn8h+E{I&=-f$R(ii zbvp6<9?bD3QqMYSez7n**x5F2K&LxwY2w`W_A99S#j^HU+p|s6NSb7E+5!$=VOc2# zkV8@v^Y*KELeEd{=lX3J^Dqi}li0lHr9NbDFk6-W^V8^>A)oK8heoE{K%<;vuGjX+ z1ZpFIdUia}W}CZmx#_uE?`}g?%-B_G(eCfHM&@CUP~KVHSOTU zrQ4yF8wMCCHUX@T(bv@pHb%aOiR1)&-U&Uqy?bz3L=+Bmvsu50iB~0GAhC~8XiIBb zOYl2gj-5+Sp}IDpQKwaBesZ+O2OWR`VE^$7PI1)7(icGru=OUpqQrkO+N4(qZ!Y1S zK(V<`gZn{PJ6fO)Fax}Zg1WvFZ#s!!49FC?ib)C=eK-&C_7)F3xEgo~gN%cC&PYqR59xVy8vBGPBg4E zIfa$Hby=~6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`yZj>CNTg2 literal 0 HcmV?d00001 From 0f6f650be2e8aa58c91511069a4c39318f3ca3d1 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Fri, 10 Jun 2022 22:38:27 +0200 Subject: [PATCH 05/21] Add 16x16 icon --- assets/16.png | Bin 0 -> 1134 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/16.png diff --git a/assets/16.png b/assets/16.png new file mode 100644 index 0000000000000000000000000000000000000000..f43ff68fd6370e39be7d8a943c4a09c2e57241c5 GIT binary patch literal 1134 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>SW8zQByM2p6H)IU({5zu02I+RG_!UJcMmG@3@NvBi`O+U%dcw6sy~rf zw6eJCPI1@W+@`ZRji-w`Zx?mmD(bqOTDd17r#7SJP;uAo;_kcAIZN_dE~ZuO%Wu70 z&~_!G_AoF)cMJE`0v+8^666O;DY(G2RdTlb4|}mn_uQUm#mQv9^5(YsXghf}_J&O- zu3TE5BqFHd(SBjKAuF50;)Am01!h?rGh}7X6tum2_wS6|a>?{_C#9w`N%JtT`5nsA zYj|mI&zs^%mF-_|-zs6|PX2ncp2hv~T~7|niI;9Jv3@DFVj9pPj7i?^E=+0MH7P(2 zXMsm#F#`j)FbFd;%$g$s6l5>)^mS!_#>OS0$jKD(5R~p;c)B=-NL)^yFl}Ng1CyIX z!i34;0U=2a9fk%Pt5>XAnQdU;z}ncdY}&TIb@TQ$E)-7m2v-5)Q zD{y`6n^BP*Tzm0Xkxq!^40jEsP( zL)XwC#K^$P*x1UzNZY``%D}*8Qu-1U4Y~O#nQ4`{HTa&t4+>}oPgg&ebxsLQ0MavN Ab^rhX literal 0 HcmV?d00001 From 465a072e674ec399356b9fa48464f1988dd5f070 Mon Sep 17 00:00:00 2001 From: Ufal Salman Date: Sat, 7 May 2022 13:38:16 +0200 Subject: [PATCH 06/21] Added translation using Weblate (Indonesian) --- assets/lang/id-ID.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 assets/lang/id-ID.json diff --git a/assets/lang/id-ID.json b/assets/lang/id-ID.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/assets/lang/id-ID.json @@ -0,0 +1 @@ +{} From b8b1d04d24a548b57ab1ab748d0ebd44b487cb4f Mon Sep 17 00:00:00 2001 From: Anonymous Date: Sat, 7 May 2022 11:38:17 +0000 Subject: [PATCH 07/21] Translated using Weblate (Indonesian) Currently translated at 100.0% (0 of 0 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/id/ --- assets/lang/id-ID.json | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/assets/lang/id-ID.json b/assets/lang/id-ID.json index 0967ef4..8e16124 100644 --- a/assets/lang/id-ID.json +++ b/assets/lang/id-ID.json @@ -1 +1,28 @@ -{} +{ + "loading_screen_start": "Starting ArmCord…", + "loading_screen_offline": "You appear to be offline. Please connect to the Internet and try again.", + "loading_screen_update": "A new version of ArmCord is available. Please update to the latest version.", + "setup_question1": "Select what kind of setup you want to perform:", + "setup_question1_answer1": "Express setup", + "setup_question1_answer2": "Full setup", + "setup_question2": "Choose your Discord channel/instance:", + "setup_offline": "You appear to be offline. Please connect to the Internet and restart the ArmCord setup.", + "setup_question3": "Should ArmCord handle client mods installation?", + "yes": "Yes", + "no": "No", + "next": "Next", + "setup_question4": "Select a client mod you want to install:", + "setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation.", + "settings-theme": "ArmCord Theme:", + "settings-theme-glasstron": "Glasstron (experimental)", + "settings-theme-tabs": "Tabs (experimental)", + "settings-theme-default": "Default", + "settings-theme-native": "Native", + "settings-tray": "Minimize to tray", + "settings-patches": "Automatic Patches", + "settings-channel": "Discord channel:", + "settings-invitewebsocket": "discord.gg support", + "settings-mod": "Client mod:", + "settings-save": "Save settings", + "settings-updater": "Check for updates" +} From b43a9920273d8e78514814baed663901a6b6a990 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Fri, 10 Jun 2022 23:17:03 +0200 Subject: [PATCH 08/21] Tweak translations a bit --- assets/lang/en_US.json | 10 +++++++--- src/content/setup.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/lang/en_US.json b/assets/lang/en_US.json index 03e21bc..979bc73 100644 --- a/assets/lang/en_US.json +++ b/assets/lang/en_US.json @@ -12,8 +12,8 @@ "no": "No", "next": "Next", "setup_question4": "Select a client mod you want to install:", - "setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation.", - "settings-theme": "ArmCord Theme:", + "setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our Discord.", + "settings-theme": "ArmCord theme:", "settings-theme-glasstron": "Glasstron (experimental)", "settings-theme-tabs": "Tabs (experimental)", "settings-theme-default": "Default", @@ -21,8 +21,12 @@ "settings-tray": "Minimize to tray", "settings-patches": "Automatic Patches", "settings-channel": "Discord channel:", - "settings-invitewebsocket": "discord.gg support", + "settings-invitewebsocket": "Invite Websocket", "settings-mod": "Client mod:", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None", "settings-save": "Save settings", "settings-updater": "Check for updates" } diff --git a/src/content/setup.html b/src/content/setup.html index 4b9d4bd..1783c8f 100644 --- a/src/content/setup.html +++ b/src/content/setup.html @@ -57,7 +57,7 @@

Why not all of them? Having many client mods at the same time can cause issues. If you really - want to do it though, check our documentation ;) + want to do it though, check our Discord ;)

From 478c2da61a5748341a47f796efdace0ef98f8578 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:39 +0000 Subject: [PATCH 09/21] Translated using Weblate (French) Currently translated at 76.6% (23 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/fr/ --- assets/lang/fr-FR.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/fr-FR.json b/assets/lang/fr-FR.json index 28dbdbd..31e09b1 100644 --- a/assets/lang/fr-FR.json +++ b/assets/lang/fr-FR.json @@ -24,5 +24,9 @@ "settings-theme-glasstron": "Glasstron (experimental)", "settings-theme-native": "Native", "settings-patches": "Automatic Patches", - "settings-invitewebsocket": "discord.gg support" + "settings-invitewebsocket": "discord.gg support", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None" } From 7f524b155950d069b5ccd1b72153858540b2c080 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:39 +0000 Subject: [PATCH 10/21] Translated using Weblate (Italian) Currently translated at 76.6% (23 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/it/ --- assets/lang/it-IT.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/it-IT.json b/assets/lang/it-IT.json index 144d221..a301d5c 100644 --- a/assets/lang/it-IT.json +++ b/assets/lang/it-IT.json @@ -24,5 +24,9 @@ "settings-theme-default": "Default", "settings-theme-native": "Native", "settings-patches": "Automatic Patches", - "settings-invitewebsocket": "discord.gg support" + "settings-invitewebsocket": "discord.gg support", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None" } From 00bf23667b39808ad9d7118b54ac00304416d7dd Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:39 +0000 Subject: [PATCH 11/21] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 76.6% (23 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/nb_NO/ --- assets/lang/nb-NO.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/nb-NO.json b/assets/lang/nb-NO.json index 41670f2..050af76 100644 --- a/assets/lang/nb-NO.json +++ b/assets/lang/nb-NO.json @@ -24,5 +24,9 @@ "settings-theme-default": "Default", "settings-theme-native": "Native", "settings-patches": "Automatic Patches", - "settings-invitewebsocket": "discord.gg support" + "settings-invitewebsocket": "discord.gg support", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None" } From 85dea9731279bc13e4d4f20721b661c4b0f9cb32 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:40 +0000 Subject: [PATCH 12/21] Translated using Weblate (Dutch) Currently translated at 76.6% (23 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/nl/ --- assets/lang/nl-NL.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/nl-NL.json b/assets/lang/nl-NL.json index 485d28f..bb37188 100644 --- a/assets/lang/nl-NL.json +++ b/assets/lang/nl-NL.json @@ -24,5 +24,9 @@ "settings-theme-tabs": "Tabs (experimenteel)", "settings-theme-default": "Standaard", "settings-theme-native": "Native", - "settings-invitewebsocket": "discord.gg support" + "settings-invitewebsocket": "discord.gg support", + "settings-none": "None", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery" } From 113a693603ce46603799c2b9df5a88bbd02ace18 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:40 +0000 Subject: [PATCH 13/21] Translated using Weblate (Polish) Currently translated at 76.6% (23 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/pl/ --- assets/lang/pl-PL.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/pl-PL.json b/assets/lang/pl-PL.json index 979e56b..7e06569 100644 --- a/assets/lang/pl-PL.json +++ b/assets/lang/pl-PL.json @@ -24,5 +24,9 @@ "settings-theme-default": "Domyślny", "settings-theme-native": "Natywny", "settings-patches": "Automatyczne łatki", - "settings-invitewebsocket": "Wsparcie linków discord.gg" + "settings-invitewebsocket": "Wsparcie linków discord.gg", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None" } From e518c0f04ede5f715e5da5ca23cecb8c87dbcb97 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 10 Jun 2022 21:22:40 +0000 Subject: [PATCH 14/21] Translated using Weblate (Indonesian) Currently translated at 0.0% (0 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/id/ --- assets/lang/id-ID.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/lang/id-ID.json b/assets/lang/id-ID.json index 8e16124..03f2b4f 100644 --- a/assets/lang/id-ID.json +++ b/assets/lang/id-ID.json @@ -24,5 +24,9 @@ "settings-invitewebsocket": "discord.gg support", "settings-mod": "Client mod:", "settings-save": "Save settings", - "settings-updater": "Check for updates" + "settings-updater": "Check for updates", + "settings-prfmMode": "Performance mode:", + "settings-prfmMode-performance": "Performance", + "settings-prfmMode-battery": "Battery", + "settings-none": "None" } From fa24b7996f1de8041d05a1ff9e8dff98c28e9d14 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Sat, 11 Jun 2022 22:14:16 +0200 Subject: [PATCH 15/21] Add language detection from Discord --- src/ipc.ts | 5 ++++- src/preload/bridge.ts | 1 + src/preload/preload.ts | 13 ++++++++++--- src/utils.ts | 22 ++++++++++++++++++---- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/ipc.ts b/src/ipc.ts index c3e799d..92079ec 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -1,7 +1,7 @@ //ipc stuff import {app, ipcMain, shell, desktopCapturer} from "electron"; import {createTabsGuest, mainWindow} from "./window"; -import {setConfigBulk, getVersion, getConfig} from "./utils"; +import {setConfigBulk, getVersion, getConfig, setLang} from "./utils"; import {customTitlebar, tabs} from "./main"; import {createSettingsWindow} from "./settings/main"; export function registerIpc() { @@ -11,6 +11,9 @@ export function registerIpc() { ipcMain.on("openTab", (event, number: number) => { createTabsGuest(number); }); + ipcMain.on("setLang", (event, lang: string) => { + setLang(lang); + }); ipcMain.on("open-external-link", (event, href: string) => { shell.openExternal(href); }); diff --git a/src/preload/bridge.ts b/src/preload/bridge.ts index 23fe888..931e08e 100644 --- a/src/preload/bridge.ts +++ b/src/preload/bridge.ts @@ -16,6 +16,7 @@ contextBridge.exposeInMainWorld("armcord", { electron: process.versions.electron, channel: ipcRenderer.sendSync("channel"), openTab: (number: number) => ipcRenderer.sendSync("openTab", number), + setLang: (lang: string) => ipcRenderer.send("setLang", lang), version: ipcRenderer.sendSync("get-app-version", "app-version"), getDisplayMediaSelector: getDisplayMediaSelector, openSettingsWindow: () => ipcRenderer.send("openSettingsWindow") diff --git a/src/preload/preload.ts b/src/preload/preload.ts index fcde5a0..810f4a3 100644 --- a/src/preload/preload.ts +++ b/src/preload/preload.ts @@ -4,11 +4,15 @@ import "./patch"; import * as fs from "fs"; import * as path from "path"; import {injectTitlebar} from "./titlebar"; -import {sleep, addStyle, injectJS} from "../utils"; +import {sleep, addStyle, injectJS, addScript} from "../utils"; import {ipcRenderer} from "electron"; import {injectTabs} from "./tabs"; var version = ipcRenderer.sendSync("get-app-version", "app-version"); - +async function updateLang() { + addScript(`function getDiscordLang() { + {const _w=webpackChunkdiscord_app;let lang;_w.push([[Symbol()],{},e=>{for(const k in e.c){const m=e.c[k].exports;const mDef=m?.default&&m.__esModule?m.default:m;if(mDef?._chosenLocale&&!lang)lang=mDef}}]);_w.pop();window.armcord.setLang(lang._chosenLocale);return lang._chosenLocale;void 0}} + getDiscordLang();`); +} declare global { interface Window { armcord: any; @@ -30,7 +34,7 @@ if (window.location.href.indexOf("splash.html") > -1) { if (ipcRenderer.sendSync("tabs")) { injectTabs(); } - sleep(5000).then(() => { + sleep(5000).then(async () => { const cssPath = path.join(__dirname, "../", "/content/css/discord.css"); addStyle(fs.readFileSync(cssPath, "utf8")); @@ -38,14 +42,17 @@ if (window.location.href.indexOf("splash.html") > -1) { case "goosemod": injectJS(clientMods.goosemod); console.log("Loading GooseMod..."); + await updateLang(); break; case "cumcord": injectJS(clientMods.cumcord); console.log("Loading Cumcord..."); + await updateLang(); break; case "flicker": injectJS(clientMods.flicker); console.log("Loading FlickerMod..."); + await updateLang(); break; } }); diff --git a/src/utils.ts b/src/utils.ts index 2a42ff8..9e51f49 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,7 @@ import * as fs from "fs"; import {app, dialog} from "electron"; import path from "path"; -import { defaultMaxListeners } from "events"; +import {defaultMaxListeners} from "events"; export var firstRun: boolean; export var isSetup: boolean; export var contentPath: string; @@ -88,8 +88,8 @@ export async function injectElectronFlags() { // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. const presets = { - 'performance': `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance - 'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium? + performance: `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance + battery: "--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu" // Known to have better battery life for Chromium? }; switch (await getConfig("performanceMode")) { case "performance": @@ -104,6 +104,20 @@ export async function injectElectronFlags() { console.log("No performance modes set"); } } +export async function setLang(language: string) { + const userDataPath = app.getPath("userData"); + const storagePath = path.join(userDataPath, "/storage/"); + const langConfigFile = storagePath + "lang.json"; + if (!fs.existsSync(langConfigFile)) { + fs.writeFileSync(langConfigFile, "{}", "utf-8"); + } + let rawdata = fs.readFileSync(langConfigFile, "utf-8"); + let parsed = JSON.parse(rawdata); + parsed["lang"] = language; + let toSave = JSON.stringify(parsed); + fs.writeFileSync(langConfigFile, toSave, "utf-8"); +} + //ArmCord Settings/Storage manager export interface Settings { @@ -113,7 +127,7 @@ export interface Settings { minimizeToTray: boolean; automaticPatches: boolean; mods: string; - performanceMode: string, + performanceMode: string; blurType: string; inviteWebsocket: boolean; doneSetup: boolean; From 410c899c84346c4c92194eaf4f9a77e14117a392 Mon Sep 17 00:00:00 2001 From: smartfridge Date: Fri, 10 Jun 2022 21:26:06 +0000 Subject: [PATCH 16/21] Translated using Weblate (Polish) Currently translated at 100.0% (30 of 30 strings) Translation: ArmCord/ArmCord Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/pl/ --- assets/lang/pl-PL.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/lang/pl-PL.json b/assets/lang/pl-PL.json index 7e06569..e4892b6 100644 --- a/assets/lang/pl-PL.json +++ b/assets/lang/pl-PL.json @@ -7,7 +7,7 @@ "no": "Nie", "next": "Dalej", "setup_question4": "Wybierz modyfikację klienta którą chcesz zainstalować:", - "setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszą dokumentację.", + "setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszego Discorda.", "loading_screen_start": "Ładowanie ArmCord…", "loading_screen_offline": "Wydaje nam się, że nie jesteś połączony z Internetem. Połącz się z internetem i spróbuj ponownie.", "setup_question1_answer1": "Ekspresowa konfiguracja", @@ -24,9 +24,9 @@ "settings-theme-default": "Domyślny", "settings-theme-native": "Natywny", "settings-patches": "Automatyczne łatki", - "settings-invitewebsocket": "Wsparcie linków discord.gg", - "settings-prfmMode": "Performance mode:", - "settings-prfmMode-performance": "Performance", - "settings-prfmMode-battery": "Battery", - "settings-none": "None" + "settings-invitewebsocket": "Websocket dla zaproszeń", + "settings-prfmMode": "Tryb wydajności:", + "settings-prfmMode-performance": "Wydajny", + "settings-prfmMode-battery": "Bateria", + "settings-none": "Nic/Brak" } From f9bfed7585bceb4ab5e878db11efdc3161ba449d Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Sun, 12 Jun 2022 13:18:18 +0200 Subject: [PATCH 17/21] Add translation loading for settings --- assets/lang/{en_US.json => en-US.json} | 0 src/ipc.ts | 5 ++- src/settings/main.ts | 6 +++- src/settings/preload.ts | 4 +++ src/settings/settings.html | 44 +++++++++++++++++++------- src/utils.ts | 19 ++++++++++- 6 files changed, 64 insertions(+), 14 deletions(-) rename assets/lang/{en_US.json => en-US.json} (100%) diff --git a/assets/lang/en_US.json b/assets/lang/en-US.json similarity index 100% rename from assets/lang/en_US.json rename to assets/lang/en-US.json diff --git a/src/ipc.ts b/src/ipc.ts index 92079ec..830a2f1 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -1,7 +1,7 @@ //ipc stuff import {app, ipcMain, shell, desktopCapturer} from "electron"; import {createTabsGuest, mainWindow} from "./window"; -import {setConfigBulk, getVersion, getConfig, setLang} from "./utils"; +import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils"; import {customTitlebar, tabs} from "./main"; import {createSettingsWindow} from "./settings/main"; export function registerIpc() { @@ -14,6 +14,9 @@ export function registerIpc() { ipcMain.on("setLang", (event, lang: string) => { setLang(lang); }); + ipcMain.on("getLang", (event, object: string) => { + getLang(object); + }); ipcMain.on("open-external-link", (event, href: string) => { shell.openExternal(href); }); diff --git a/src/settings/main.ts b/src/settings/main.ts index 53a46d4..4167f62 100644 --- a/src/settings/main.ts +++ b/src/settings/main.ts @@ -1,5 +1,5 @@ import {BrowserWindow, shell, ipcMain} from "electron"; -import {getConfig, setConfigBulk, Settings} from "../utils"; +import {getConfig, setConfigBulk, Settings, getLang} from "../utils"; import path from "path"; var settingsWindow: BrowserWindow; var instance: number = 0; @@ -31,6 +31,9 @@ export function createSettingsWindow() { ipcMain.handle("getSetting", (event, toGet: string) => { return getConfig(toGet); }); + ipcMain.handle("getLang", (event, toGet: string) => { + return getLang(toGet); + }); settingsWindow.webContents.setWindowOpenHandler(({url}) => { shell.openExternal(url); return {action: "deny"}; @@ -38,6 +41,7 @@ export function createSettingsWindow() { settingsWindow.loadURL(`file://${__dirname}/settings.html`); settingsWindow.on("close", (event: Event) => { ipcMain.removeHandler("getSetting"); + ipcMain.removeHandler("getLang"); ipcMain.removeAllListeners("saveSettings"); instance = 0; }); diff --git a/src/settings/preload.ts b/src/settings/preload.ts index 0c90a53..38c986d 100644 --- a/src/settings/preload.ts +++ b/src/settings/preload.ts @@ -2,6 +2,10 @@ import {contextBridge, ipcRenderer} from "electron"; console.log("ArmCord Settings"); contextBridge.exposeInMainWorld("settings", { save: (...args: any) => ipcRenderer.send("saveSettings", ...args), + getLang: (toGet: string) => + ipcRenderer.invoke("getLang", toGet).then((result) => { + return result; + }), get: (toGet: string) => ipcRenderer.invoke("getSetting", toGet).then((result) => { return result; diff --git a/src/settings/settings.html b/src/settings/settings.html index c57151c..e352741 100644 --- a/src/settings/settings.html +++ b/src/settings/settings.html @@ -14,7 +14,7 @@ -

ArmCord theme:

+

ArmCord theme:


@@ -24,19 +24,19 @@

- +

- +

- +
@@ -47,7 +47,7 @@ -

Discord channel:

+

Discord channel:

-

Client mod:

+

Client mod:

-

Performance mode:

+

Performance mode:

- + - +