Compare commits

..

20 commits

Author SHA1 Message Date
dependabot[bot]
efc0cb4a3f
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] <support@github.com>
2022-06-12 19:01:41 +00:00
smartfrigde
86c3636a19 Add setup translation loading 2022-06-12 20:59:59 +02:00
smartfrigde
994ab5f5b0 Add fallback to English US if language doesn't exist 2022-06-12 13:32:54 +02:00
Phorcys
ade35473a8
Translated using Weblate (French)
Currently translated at 100.0% (30 of 30 strings)

Translation: ArmCord/ArmCord
Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/fr/
2022-06-12 13:18:36 +02:00
smartfrigde
f9bfed7585 Add translation loading for settings 2022-06-12 13:18:31 +02:00
smartfridge
410c899c84
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/
2022-06-12 00:15:32 +02:00
smartfrigde
fa24b7996f Add language detection from Discord 2022-06-11 22:14:33 +02:00
Anonymous
e518c0f04e
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/
2022-06-10 23:22:42 +02:00
Anonymous
113a693603
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/
2022-06-10 23:22:41 +02:00
Anonymous
85dea97312
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/
2022-06-10 23:22:41 +02:00
Anonymous
00bf23667b
Translated using Weblate (Norwegian Bokmål)
Currently translated at 76.6% (23 of 30 strings)

Translation: ArmCord/ArmCord
Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/nb_NO/
2022-06-10 23:22:41 +02:00
Anonymous
7f524b1559
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/
2022-06-10 23:22:41 +02:00
Anonymous
478c2da61a
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/
2022-06-10 23:22:40 +02:00
smartfrigde
b43a992027 Tweak translations a bit 2022-06-10 23:22:32 +02:00
Anonymous
b8b1d04d24
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/
2022-06-10 22:38:33 +02:00
Ufal Salman
465a072e67
Added translation using Weblate (Indonesian) 2022-06-10 22:38:33 +02:00
smartfrigde
0f6f650be2 Add 16x16 icon 2022-06-10 22:38:27 +02:00
smartfrigde
a12463877a Add macOS tray icon potential fix 2022-06-10 22:29:43 +02:00
smartfrigde
98f88f4609 Fix icon loading 2022-06-10 20:46:30 +02:00
smartfrigde
81377d3657 Add performance mode 2022-06-10 20:27:37 +02:00
20 changed files with 271 additions and 46 deletions

BIN
assets/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -12,8 +12,8 @@
"no": "No", "no": "No",
"next": "Next", "next": "Next",
"setup_question4": "Select a client mod you want to install:", "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.", "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": "ArmCord theme:",
"settings-theme-glasstron": "Glasstron (experimental)", "settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)", "settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
@ -21,8 +21,12 @@
"settings-tray": "Minimize to tray", "settings-tray": "Minimize to tray",
"settings-patches": "Automatic Patches", "settings-patches": "Automatic Patches",
"settings-channel": "Discord channel:", "settings-channel": "Discord channel:",
"settings-invitewebsocket": "discord.gg support", "settings-invitewebsocket": "Invite Websocket",
"settings-mod": "Client mod:", "settings-mod": "Client mod:",
"settings-prfmMode": "Performance mode:",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Battery",
"settings-none": "None",
"settings-save": "Save settings", "settings-save": "Save settings",
"settings-updater": "Check for updates" "settings-updater": "Check for updates"
} }

View file

@ -1,6 +1,6 @@
{ {
"loading_screen_start": "Démarrage d'ArmCord…", "loading_screen_start": "Démarrage d'ArmCord…",
"loading_screen_update": "Une nouvelle version de ArmCord est disponible. Veuillez mettre à jour la dernière version.", "loading_screen_update": "Une nouvelle version d'ArmCord est disponible. Veuillez mettre à jour vers la dernière version.",
"setup_question1": "Sélectionnez le type de configuration que vous souhaitez effectuer :", "setup_question1": "Sélectionnez le type de configuration que vous souhaitez effectuer :",
"setup_question1_answer1": "Configuration express", "setup_question1_answer1": "Configuration express",
"setup_question1_answer2": "Configuration complète", "setup_question1_answer2": "Configuration complète",
@ -10,19 +10,23 @@
"no": "Non", "no": "Non",
"next": "Suivant", "next": "Suivant",
"setup_question4": "Sélectionnez le mod client que vous souhaitez installer :", "setup_question4": "Sélectionnez le mod client que vous souhaitez installer :",
"setup_question4_clientmodnotice": "Pourquoi pas tous ? Le fait d'avoir plusieurs mods clients en même temps peut causer des problèmes. Si vous voulez vraiment le faire, consultez notre documentation.", "setup_question4_clientmodnotice": "Pourquoi pas tous ? Le fait d'avoir plusieurs clients mods en même temps peut causer des problèmes. Si vous voulez vraiment le faire, consultez notre Discord.",
"loading_screen_offline": "Vous semblez être hors ligne. Veuillez vous connecter à internet et réessayer.", "loading_screen_offline": "Vous semblez être hors ligne. Veuillez vous connecter à internet et réessayer.",
"setup_offline": "Vous semblez être hors ligne. Veuillez vous connecter à internet et redémarrer ArmCord Setup.", "setup_offline": "Vous semblez être hors ligne. Veuillez vous connecter à internet et redémarrer l'installateur ArmCord.",
"settings-tray": "Minimize to tray", "settings-tray": "Minimize to tray",
"settings-channel": "Discord channel:", "settings-channel": "Discord channel:",
"settings-mod": "Client mod:", "settings-mod": "Client mod:",
"settings-save": "Save settings", "settings-save": "Save settings",
"settings-updater": "Check for updates", "settings-updater": "Check for updates",
"settings-theme": "ArmCord Theme:", "settings-theme": "Thème ArmCord :",
"settings-theme-tabs": "Tabs (experimental)", "settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-glasstron": "Glasstron (experimental)", "settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-native": "Native", "settings-theme-native": "Native",
"settings-patches": "Automatic Patches", "settings-patches": "Automatic Patches",
"settings-invitewebsocket": "discord.gg support" "settings-invitewebsocket": "Lien discord.gg",
"settings-prfmMode": "Mode performance :",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Batterie",
"settings-none": "Aucun"
} }

32
assets/lang/id-ID.json Normal file
View file

@ -0,0 +1,32 @@
{
"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",
"settings-prfmMode": "Performance mode:",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Battery",
"settings-none": "None"
}

View file

@ -24,5 +24,9 @@
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",
"settings-patches": "Automatic Patches", "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"
} }

View file

@ -24,5 +24,9 @@
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",
"settings-patches": "Automatic Patches", "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"
} }

View file

@ -24,5 +24,9 @@
"settings-theme-tabs": "Tabs (experimenteel)", "settings-theme-tabs": "Tabs (experimenteel)",
"settings-theme-default": "Standaard", "settings-theme-default": "Standaard",
"settings-theme-native": "Native", "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"
} }

View file

@ -7,7 +7,7 @@
"no": "Nie", "no": "Nie",
"next": "Dalej", "next": "Dalej",
"setup_question4": "Wybierz modyfikację klienta którą chcesz zainstalować:", "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_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.", "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", "setup_question1_answer1": "Ekspresowa konfiguracja",
@ -24,5 +24,9 @@
"settings-theme-default": "Domyślny", "settings-theme-default": "Domyślny",
"settings-theme-native": "Natywny", "settings-theme-native": "Natywny",
"settings-patches": "Automatyczne łatki", "settings-patches": "Automatyczne łatki",
"settings-invitewebsocket": "Wsparcie linków discord.gg" "settings-invitewebsocket": "Websocket dla zaproszeń",
"settings-prfmMode": "Tryb wydajności:",
"settings-prfmMode-performance": "Wydajny",
"settings-prfmMode-battery": "Bateria",
"settings-none": "Nic/Brak"
} }

BIN
assets/macos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -26,7 +26,7 @@
"@types/node": "^17.0.33", "@types/node": "^17.0.33",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"electron": "^18.2.4", "electron": "^19.0.4",
"electron-builder": "^23.0.3", "electron-builder": "^23.0.3",
"husky": "^8.0.1", "husky": "^8.0.1",
"prettier": "^2.5.1", "prettier": "^2.5.1",
@ -34,6 +34,7 @@
}, },
"dependencies": { "dependencies": {
"electron-context-menu": "github:ArmCord/electron-context-menu", "electron-context-menu": "github:ArmCord/electron-context-menu",
"os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0", "v8-compile-cache": "^2.3.0",
"ws": "^8.6.0" "ws": "^8.6.0"
}, },

View file

@ -12,12 +12,14 @@
<body> <body>
<div class="container"> <div class="container">
<div id="warning" class="hidden"> <div id="warning" class="hidden">
<p>You appear to be offline. Please connect to the internet and restart ArmCord Setup.</p> <p id="setup_offline">
You appear to be offline. Please connect to the internet and restart ArmCord Setup.
</p>
</div> </div>
<div id="setup"> <div id="setup">
<div id="logo" class="hidden"></div> <div id="logo" class="hidden"></div>
<div id="page1" class="hidden"> <div id="page1" class="hidden">
<p>Select the type of setup you want to perform.</p> <p id="setup_question1">Select the type of setup you want to perform.</p>
<div id="buttons"> <div id="buttons">
<button id="express" class="center">Express</button> <button id="express" class="center">Express</button>
<button id="full" class="center">Full</button> <button id="full" class="center">Full</button>
@ -25,7 +27,7 @@
</div> </div>
<div id="page2" class="hidden"> <div id="page2" class="hidden">
<p class="text-center setup-ask">Choose your Discord channel/instance:</p> <p class="text-center setup-ask" id="setup_question2">Choose your Discord channel/instance:</p>
<div class="center"> <div class="center">
<select name="channel" id="channel" class="dropdown-button"> <select name="channel" id="channel" class="dropdown-button">
<option value="stable">Stable</option> <option value="stable">Stable</option>
@ -34,7 +36,9 @@
<option value="foss">Fosscord</option> <option value="foss">Fosscord</option>
</select> </select>
</div> </div>
<p class="text-center setup-ask">Should ArmCord handle client mods installation?</p> <p class="text-center setup-ask" id="setup_question3">
Should ArmCord handle client mods installation?
</p>
<div class="center"> <div class="center">
<select name="csp" id="csp" class="dropdown-button"> <select name="csp" id="csp" class="dropdown-button">
<option value="true">Yes</option> <option value="true">Yes</option>
@ -47,7 +51,7 @@
</div> </div>
<div id="page3" class="hidden"> <div id="page3" class="hidden">
<p class="text-center setup-ask">Select a client mod you want to install:</p> <p class="text-center setup-ask" id="setup_question4">Select a client mod you want to install:</p>
<div class="center"> <div class="center">
<select name="mod" id="mod" class="dropdown-button"> <select name="mod" id="mod" class="dropdown-button">
<option value="cumcord">Cumcord</option> <option value="cumcord">Cumcord</option>
@ -55,9 +59,9 @@
<option value="flicker">Flicker (Heavily WIP)</option> <option value="flicker">Flicker (Heavily WIP)</option>
</select> </select>
</div> </div>
<p class="text-center"> <p class="text-center" id="setup_question4_clientmodnotice">
Why not all of them? Having many client mods at the same time can cause issues. If you really 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 ;)
</p> </p>
<div id="buttons"> <div id="buttons">
<button id="next" class="center">Next</button> <button id="next" class="center">Next</button>
@ -65,7 +69,25 @@
</div> </div>
</div> </div>
</div> </div>
<script>
async function loadLang() {
document.getElementById("next").innerHTML = await armcord.getLang("next");
document.getElementById("setup_offline").innerHTML = await armcord.getLang("setup_offline");
document.getElementById("setup_question1").innerHTML = await armcord.getLang("setup_question1");
document.getElementById("express").innerHTML = await armcord.getLang("setup_question1_answer1");
document.getElementById("full").innerHTML = await armcord.getLang("setup_question1_answer2");
document.getElementById("setup_question2").innerHTML = await armcord.getLang("setup_question2");
document.getElementById("setup_question3").innerHTML = await armcord.getLang("setup_question3");
document.getElementById("setup_question4").innerHTML = await armcord.getLang("setup_question4");
document.getElementById("setup_question4_clientmodnotice").innerHTML = await armcord.getLang(
"setup_question4_clientmodnotice"
);
//select stuff1
document.getElementById("csp").options[1].text = await armcord.getLang("no");
document.getElementById("csp").options[0].text = await armcord.getLang("yes");
}
loadLang();
</script>
<script> <script>
document.onload = function () { document.onload = function () {
ipcRenderer.send("win-unmaximize"); ipcRenderer.send("win-unmaximize");
@ -101,6 +123,7 @@
automaticPatches: false, automaticPatches: false,
mods: "cumcord", mods: "cumcord",
inviteWebsocket: true, inviteWebsocket: true,
performanceMode: "none",
blurType: "acrylic" blurType: "acrylic"
}); });
setTimeout(() => window.armcordinternal.restart(), 5000); setTimeout(() => window.armcordinternal.restart(), 5000);
@ -130,6 +153,7 @@
autoLaunch: true, autoLaunch: true,
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
performanceMode: "none",
mods: options.mod, mods: options.mod,
inviteWebsocket: true, inviteWebsocket: true,
blurType: "acrylic" blurType: "acrylic"
@ -145,6 +169,7 @@
automaticPatches: false, automaticPatches: false,
autoLaunch: true, autoLaunch: true,
mods: "none", mods: "none",
performanceMode: "none",
inviteWebsocket: true, inviteWebsocket: true,
blurType: "acrylic" blurType: "acrylic"
}); });

View file

@ -1,7 +1,7 @@
//ipc stuff //ipc stuff
import {app, ipcMain, shell, desktopCapturer} from "electron"; import {app, ipcMain, shell, desktopCapturer} from "electron";
import {createTabsGuest, mainWindow} from "./window"; import {createTabsGuest, mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig} from "./utils"; import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils";
import {customTitlebar, tabs} from "./main"; import {customTitlebar, tabs} from "./main";
import {createSettingsWindow} from "./settings/main"; import {createSettingsWindow} from "./settings/main";
export function registerIpc() { export function registerIpc() {
@ -11,6 +11,12 @@ export function registerIpc() {
ipcMain.on("openTab", (event, number: number) => { ipcMain.on("openTab", (event, number: number) => {
createTabsGuest(number); createTabsGuest(number);
}); });
ipcMain.on("setLang", (event, lang: string) => {
setLang(lang);
});
ipcMain.on("getLang", (event, object: string) => {
getLang(object);
});
ipcMain.on("open-external-link", (event, href: string) => { ipcMain.on("open-external-link", (event, href: string) => {
shell.openExternal(href); shell.openExternal(href);
}); });
@ -54,6 +60,9 @@ export function registerIpc() {
ipcMain.on("channel", async (event) => { ipcMain.on("channel", async (event) => {
event.returnValue = await getConfig("channel"); event.returnValue = await getConfig("channel");
}); });
ipcMain.handle("getLang", (event, toGet: string) => {
return getLang(toGet);
});
ipcMain.on("clientmod", async (event, arg) => { ipcMain.on("clientmod", async (event, arg) => {
event.returnValue = await getConfig("mods"); event.returnValue = await getConfig("mods");
}); });

View file

@ -1,7 +1,7 @@
// Modules to control application life and create native browser window // Modules to control application life and create native browser window
import {app, BrowserWindow, session, dialog} from "electron"; import {app, BrowserWindow, session, dialog} from "electron";
import "v8-compile-cache"; import "v8-compile-cache";
import {getConfig, setup, checkIfConfigExists} from "./utils"; import {getConfig, setup, checkIfConfigExists, injectElectronFlags} from "./utils";
import "./extensions/mods"; import "./extensions/mods";
import "./extensions/plugin"; import "./extensions/plugin";
import "./tray"; import "./tray";
@ -12,6 +12,7 @@ export var settings: any;
export var customTitlebar: boolean; export var customTitlebar: boolean;
export var tabs: boolean; export var tabs: boolean;
if (process.platform == "linux") { if (process.platform == "linux") {
if (process.env.$XDG_SESSION_TYPE == "wayland") { if (process.env.$XDG_SESSION_TYPE == "wayland") {
console.log("Wayland specific patches applied."); console.log("Wayland specific patches applied.");
@ -24,7 +25,7 @@ if (process.platform == "linux") {
} }
} }
checkIfConfigExists(); checkIfConfigExists();
injectElectronFlags();
app.whenReady().then(async () => { app.whenReady().then(async () => {
switch (await getConfig("windowStyle")) { switch (await getConfig("windowStyle")) {
case "default": case "default":

View file

@ -16,6 +16,11 @@ contextBridge.exposeInMainWorld("armcord", {
electron: process.versions.electron, electron: process.versions.electron,
channel: ipcRenderer.sendSync("channel"), channel: ipcRenderer.sendSync("channel"),
openTab: (number: number) => ipcRenderer.sendSync("openTab", number), openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
getLang: (toGet: string) =>
ipcRenderer.invoke("getLang", toGet).then((result) => {
return result;
}),
version: ipcRenderer.sendSync("get-app-version", "app-version"), version: ipcRenderer.sendSync("get-app-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector, getDisplayMediaSelector: getDisplayMediaSelector,
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow") openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")

View file

@ -4,11 +4,19 @@ import "./patch";
import * as fs from "fs"; import * as fs from "fs";
import * as path from "path"; import * as path from "path";
import {injectTitlebar} from "./titlebar"; import {injectTitlebar} from "./titlebar";
import {sleep, addStyle, injectJS} from "../utils"; import {sleep, addStyle, injectJS, addScript} from "../utils";
import {ipcRenderer} from "electron"; import {ipcRenderer} from "electron";
import {injectTabs} from "./tabs"; import {injectTabs} from "./tabs";
var version = ipcRenderer.sendSync("get-app-version", "app-version"); var version = ipcRenderer.sendSync("get-app-version", "app-version");
async function updateLang() {
if (window.location.href.indexOf("setup.html") > -1) {
console.log("Setup, skipping lang update");
} else {
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 { declare global {
interface Window { interface Window {
armcord: any; armcord: any;
@ -30,7 +38,7 @@ if (window.location.href.indexOf("splash.html") > -1) {
if (ipcRenderer.sendSync("tabs")) { if (ipcRenderer.sendSync("tabs")) {
injectTabs(); injectTabs();
} }
sleep(5000).then(() => { sleep(5000).then(async () => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css"); const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8")); addStyle(fs.readFileSync(cssPath, "utf8"));
@ -38,14 +46,17 @@ if (window.location.href.indexOf("splash.html") > -1) {
case "goosemod": case "goosemod":
injectJS(clientMods.goosemod); injectJS(clientMods.goosemod);
console.log("Loading GooseMod..."); console.log("Loading GooseMod...");
await updateLang();
break; break;
case "cumcord": case "cumcord":
injectJS(clientMods.cumcord); injectJS(clientMods.cumcord);
console.log("Loading Cumcord..."); console.log("Loading Cumcord...");
await updateLang();
break; break;
case "flicker": case "flicker":
injectJS(clientMods.flicker); injectJS(clientMods.flicker);
console.log("Loading FlickerMod..."); console.log("Loading FlickerMod...");
await updateLang();
break; break;
} }
}); });

View file

@ -1,5 +1,5 @@
import {BrowserWindow, shell, ipcMain} from "electron"; import {BrowserWindow, shell, ipcMain} from "electron";
import {getConfig, setConfigBulk, Settings} from "../utils"; import {getConfig, setConfigBulk, Settings, getLang} from "../utils";
import path from "path"; import path from "path";
var settingsWindow: BrowserWindow; var settingsWindow: BrowserWindow;
var instance: number = 0; var instance: number = 0;
@ -31,6 +31,9 @@ export function createSettingsWindow() {
ipcMain.handle("getSetting", (event, toGet: string) => { ipcMain.handle("getSetting", (event, toGet: string) => {
return getConfig(toGet); return getConfig(toGet);
}); });
ipcMain.handle("getLang", (event, toGet: string) => {
return getLang(toGet);
});
settingsWindow.webContents.setWindowOpenHandler(({url}) => { settingsWindow.webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url); shell.openExternal(url);
return {action: "deny"}; return {action: "deny"};
@ -38,6 +41,7 @@ export function createSettingsWindow() {
settingsWindow.loadURL(`file://${__dirname}/settings.html`); settingsWindow.loadURL(`file://${__dirname}/settings.html`);
settingsWindow.on("close", (event: Event) => { settingsWindow.on("close", (event: Event) => {
ipcMain.removeHandler("getSetting"); ipcMain.removeHandler("getSetting");
ipcMain.removeHandler("getLang");
ipcMain.removeAllListeners("saveSettings"); ipcMain.removeAllListeners("saveSettings");
instance = 0; instance = 0;
}); });

View file

@ -2,6 +2,10 @@ import {contextBridge, ipcRenderer} from "electron";
console.log("ArmCord Settings"); console.log("ArmCord Settings");
contextBridge.exposeInMainWorld("settings", { contextBridge.exposeInMainWorld("settings", {
save: (...args: any) => ipcRenderer.send("saveSettings", ...args), save: (...args: any) => ipcRenderer.send("saveSettings", ...args),
getLang: (toGet: string) =>
ipcRenderer.invoke("getLang", toGet).then((result) => {
return result;
}),
get: (toGet: string) => get: (toGet: string) =>
ipcRenderer.invoke("getSetting", toGet).then((result) => { ipcRenderer.invoke("getSetting", toGet).then((result) => {
return result; return result;

View file

@ -14,7 +14,7 @@
<option value="default">Default</option> <option value="default">Default</option>
<option value="native">Native</option> <option value="native">Native</option>
</select> </select>
<p class="header">ArmCord theme:</p> <p class="header" id="settings-theme">ArmCord theme:</p>
</div> </div>
<br /> <br />
<div class="switch"> <div class="switch">
@ -24,19 +24,19 @@
</div> </div>
<br /> <br />
<div class="switch"> <div class="switch">
<label class="header">Minimize to tray</label> <label class="header" id="settings-tray">Minimize to tray</label>
<input class="tgl tgl-light left" id="tray" type="checkbox" /> <input class="tgl tgl-light left" id="tray" type="checkbox" />
<label class="tgl-btn left" for="tray"></label> <label class="tgl-btn left" for="tray"></label>
</div> </div>
<br /> <br />
<div class="switch"> <div class="switch">
<label class="header">Automatic Patches</label> <label class="header" id="settings-patches">Automatic Patches</label>
<input class="tgl tgl-light left" id="patches" type="checkbox" /> <input class="tgl tgl-light left" id="patches" type="checkbox" />
<label class="tgl-btn left" for="patches"></label> <label class="tgl-btn left" for="patches"></label>
</div> </div>
<br /> <br />
<div class="switch"> <div class="switch">
<label class="header">Invite Websocket</label> <label class="header" id="settings-invitewebsocket">Invite Websocket</label>
<input class="tgl tgl-light left" id="websocket" type="checkbox" /> <input class="tgl tgl-light left" id="websocket" type="checkbox" />
<label class="tgl-btn left" for="websocket"></label> <label class="tgl-btn left" for="websocket"></label>
</div> </div>
@ -47,7 +47,7 @@
<option value="ptb">PTB</option> <option value="ptb">PTB</option>
<option value="foss">Fosscord</option> <option value="foss">Fosscord</option>
</select> </select>
<p class="header">Discord channel:</p> <p class="header" id="settings-channel">Discord channel:</p>
</div> </div>
<div class="switch"> <div class="switch">
<select name="mod" id="mod" class="left"> <select name="mod" id="mod" class="left">
@ -56,12 +56,41 @@
<option value="flicker">Flicker</option> <option value="flicker">Flicker</option>
<option value="none">None</option> <option value="none">None</option>
</select> </select>
<p class="header">Client mod:</p> <p class="header" id="settings-mod">Client mod:</p>
</div> </div>
<div class="switch">
<button id="save" class="center">Save settings</button> <select name="prfmMode" id="prfmMode" class="left">
<option value="performance">Performance</option>
<option value="battery">Battery</option>
<option value="none">None</option>
</select>
<p class="header" id="settings-prfmMode">Performance mode:</p>
</div>
<button id="settings-save" class="center">Save settings</button>
</body> </body>
<script>
async function loadLang() {
document.getElementById("settings-save").innerHTML = await settings.getLang("settings-save");
document.getElementById("settings-mod").innerHTML = await settings.getLang("settings-mod");
document.getElementById("settings-channel").innerHTML = await settings.getLang("settings-channel");
document.getElementById("settings-invitewebsocket").innerHTML = await settings.getLang(
"settings-invitewebsocket"
);
document.getElementById("settings-patches").innerHTML = await settings.getLang("settings-patches");
document.getElementById("settings-tray").innerHTML = await settings.getLang("settings-tray");
document.getElementById("settings-theme").innerHTML = await settings.getLang("settings-theme");
//select stuff
document.getElementById("mod").options[3].text = await settings.getLang("settings-none");
document.getElementById("prfmMode").options[2].text = await settings.getLang("settings-none");
document.getElementById("prfmMode").options[1].text = await settings.getLang("settings-prfmMode-battery");
document.getElementById("prfmMode").options[0].text = await settings.getLang(
"settings-prfmMode-performance"
);
document.getElementById("theme").options[1].text = await settings.getLang("settings-theme-native");
document.getElementById("theme").options[0].text = await settings.getLang("settings-theme-default");
}
loadLang();
</script>
<script> <script>
async function loadSettings() { async function loadSettings() {
document.getElementById("csp").checked = await settings.get("armcordCSP"); document.getElementById("csp").checked = await settings.get("armcordCSP");
@ -71,9 +100,10 @@
document.getElementById("mod").value = await settings.get("mods"); document.getElementById("mod").value = await settings.get("mods");
document.getElementById("channel").value = await settings.get("channel"); document.getElementById("channel").value = await settings.get("channel");
document.getElementById("theme").value = await settings.get("windowStyle"); document.getElementById("theme").value = await settings.get("windowStyle");
document.getElementById("prfmMode").value = await settings.get("performanceMode");
} }
loadSettings(); loadSettings();
document.getElementById("save").addEventListener("click", function () { document.getElementById("settings-save").addEventListener("click", function () {
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string) //function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
settings.save({ settings.save({
windowStyle: document.getElementById("theme").value, windowStyle: document.getElementById("theme").value,
@ -84,6 +114,7 @@
mods: document.getElementById("mod").value, mods: document.getElementById("mod").value,
blurType: "acrylic", blurType: "acrylic",
inviteWebsocket: document.getElementById("websocket").checked, inviteWebsocket: document.getElementById("websocket").checked,
performanceMode: document.getElementById("prfmMode").value,
doneSetup: true doneSetup: true
}); });
}); });

View file

@ -1,6 +1,7 @@
import * as fs from "fs"; import * as fs from "fs";
import {app, dialog} from "electron"; import {app, dialog} from "electron";
import path from "path"; import path from "path";
import {defaultMaxListeners} from "events";
export var firstRun: boolean; export var firstRun: boolean;
export var isSetup: boolean; export var isSetup: boolean;
export var contentPath: string; export var contentPath: string;
@ -42,6 +43,7 @@ export function setup() {
automaticPatches: false, automaticPatches: false,
mods: "cumcord", mods: "cumcord",
blurType: "acrylic", blurType: "acrylic",
performanceMode: "none",
inviteWebsocket: true, inviteWebsocket: true,
doneSetup: false doneSetup: false
}; };
@ -63,7 +65,79 @@ export async function injectJS(inject: string) {
document.body.appendChild(el); 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");
}
}
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");
}
var language: string;
export async function getLang(object: string) {
if (language == undefined) {
const userDataPath = app.getPath("userData");
const storagePath = path.join(userDataPath, "/storage/");
const langConfigFile = storagePath + "lang.json";
let rawdata = fs.readFileSync(langConfigFile, "utf-8");
let parsed = JSON.parse(rawdata);
language = parsed["lang"];
}
if (language.length == 2) {
language = language + "-" + language.toUpperCase();
}
var langPath = path.join(__dirname, "../", "/assets/lang/" + language + ".json");
if (!fs.existsSync(langPath)) {
langPath = path.join(__dirname, "../", "/assets/lang/en-US.json");
}
let rawdata = fs.readFileSync(langPath, "utf-8");
let parsed = JSON.parse(rawdata);
return parsed[object];
}
//ArmCord Settings/Storage manager //ArmCord Settings/Storage manager
export interface Settings { export interface Settings {
@ -73,6 +147,7 @@ export interface Settings {
minimizeToTray: boolean; minimizeToTray: boolean;
automaticPatches: boolean; automaticPatches: boolean;
mods: string; mods: string;
performanceMode: string;
blurType: string; blurType: string;
inviteWebsocket: boolean; inviteWebsocket: boolean;
doneSetup: boolean; doneSetup: boolean;

View file

@ -4,9 +4,10 @@
// I'm sorry for this mess but I'm not sure how to fix it. // I'm sorry for this mess but I'm not sure how to fix it.
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron"; import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
import path from "path"; import path from "path";
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig} from "./utils"; import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang} from "./utils";
import {registerIpc} from "./ipc"; import {registerIpc} from "./ipc";
import startServer from "./socket"; import startServer from "./socket";
import {osLocale} from 'os-locale';
import contextMenu from "electron-context-menu"; import contextMenu from "electron-context-menu";
import os from "os"; import os from "os";
export var icon: string; export var icon: string;
@ -85,10 +86,10 @@ async function doAfterDefiningTheWindow() {
if ((await getConfig("inviteWebsocket")) == true) { if ((await getConfig("inviteWebsocket")) == true) {
startServer(); startServer();
} }
try { try {
mainWindow.loadFile(contentPath); mainWindow.loadFile(contentPath);
if (isSetup) { if (isSetup) {
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
mainWindow.setSize(390, 470); mainWindow.setSize(390, 470);
} }
} catch (e) { } catch (e) {
@ -98,6 +99,7 @@ async function doAfterDefiningTheWindow() {
console.log(process.platform); console.log(process.platform);
if (process.platform === "win32") { if (process.platform === "win32") {
if (firstRun) { if (firstRun) {
// await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
mainWindow.setSize(390, 470); mainWindow.setSize(390, 470);
mainWindow.loadURL(`file://${__dirname}/content/setup.html`); mainWindow.loadURL(`file://${__dirname}/content/setup.html`);
} else { } else {
@ -105,6 +107,7 @@ async function doAfterDefiningTheWindow() {
} }
} else { } else {
if (firstRun) { if (firstRun) {
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
mainWindow.setSize(390, 470); mainWindow.setSize(390, 470);
mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`); mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`);
} else { } else {
@ -119,7 +122,7 @@ export function createCustomWindow() {
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: false, frame: false,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -135,7 +138,7 @@ export function createNativeWindow() {
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -157,7 +160,7 @@ export function createTabsHost() {
height: 350, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -186,7 +189,7 @@ export function createTabsGuest(number: number) {
height: 600, height: 600,
title: "ArmCord Guest Window " + number, title: "ArmCord Guest Window " + number,
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {
@ -223,7 +226,7 @@ export function createInviteWindow() {
height: 600, height: 600,
title: "ArmCord Invite Manager", title: "ArmCord Invite Manager",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true, frame: true,
autoHideMenuBar: true, autoHideMenuBar: true,
webPreferences: { webPreferences: {