Compare commits

..

1 commit

Author SHA1 Message Date
dependabot[bot]
551dda74d7
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-07 13:21:43 +00:00
20 changed files with 46 additions and 271 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -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 Discord.",
"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 documentation.",
"settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default",
@ -21,12 +21,8 @@
"settings-tray": "Minimize to tray",
"settings-patches": "Automatic Patches",
"settings-channel": "Discord channel:",
"settings-invitewebsocket": "Invite Websocket",
"settings-invitewebsocket": "discord.gg support",
"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"
}

View file

@ -1,6 +1,6 @@
{
"loading_screen_start": "Démarrage d'ArmCord…",
"loading_screen_update": "Une nouvelle version d'ArmCord est disponible. Veuillez mettre à jour vers la dernière version.",
"loading_screen_update": "Une nouvelle version de ArmCord est disponible. Veuillez mettre à jour la dernière version.",
"setup_question1": "Sélectionnez le type de configuration que vous souhaitez effectuer :",
"setup_question1_answer1": "Configuration express",
"setup_question1_answer2": "Configuration complète",
@ -10,23 +10,19 @@
"no": "Non",
"next": "Suivant",
"setup_question4": "Sélectionnez le mod client que vous souhaitez installer :",
"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.",
"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.",
"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 l'installateur ArmCord.",
"setup_offline": "Vous semblez être hors ligne. Veuillez vous connecter à internet et redémarrer ArmCord Setup.",
"settings-tray": "Minimize to tray",
"settings-channel": "Discord channel:",
"settings-mod": "Client mod:",
"settings-save": "Save settings",
"settings-updater": "Check for updates",
"settings-theme": "Thème ArmCord :",
"settings-theme": "ArmCord Theme:",
"settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-native": "Native",
"settings-patches": "Automatic Patches",
"settings-invitewebsocket": "Lien discord.gg",
"settings-prfmMode": "Mode performance :",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Batterie",
"settings-none": "Aucun"
"settings-invitewebsocket": "discord.gg support"
}

View file

@ -1,32 +0,0 @@
{
"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,9 +24,5 @@
"settings-theme-default": "Default",
"settings-theme-native": "Native",
"settings-patches": "Automatic Patches",
"settings-invitewebsocket": "discord.gg support",
"settings-prfmMode": "Performance mode:",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Battery",
"settings-none": "None"
"settings-invitewebsocket": "discord.gg support"
}

View file

@ -24,9 +24,5 @@
"settings-theme-default": "Default",
"settings-theme-native": "Native",
"settings-patches": "Automatic Patches",
"settings-invitewebsocket": "discord.gg support",
"settings-prfmMode": "Performance mode:",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Battery",
"settings-none": "None"
"settings-invitewebsocket": "discord.gg support"
}

View file

@ -24,9 +24,5 @@
"settings-theme-tabs": "Tabs (experimenteel)",
"settings-theme-default": "Standaard",
"settings-theme-native": "Native",
"settings-invitewebsocket": "discord.gg support",
"settings-none": "None",
"settings-prfmMode": "Performance mode:",
"settings-prfmMode-performance": "Performance",
"settings-prfmMode-battery": "Battery"
"settings-invitewebsocket": "discord.gg support"
}

View file

@ -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ć naszego Discorda.",
"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ę.",
"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,5 @@
"settings-theme-default": "Domyślny",
"settings-theme-native": "Natywny",
"settings-patches": "Automatyczne łatki",
"settings-invitewebsocket": "Websocket dla zaproszeń",
"settings-prfmMode": "Tryb wydajności:",
"settings-prfmMode-performance": "Wydajny",
"settings-prfmMode-battery": "Bateria",
"settings-none": "Nic/Brak"
"settings-invitewebsocket": "Wsparcie linków discord.gg"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View file

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

View file

@ -12,14 +12,12 @@
<body>
<div class="container">
<div id="warning" class="hidden">
<p id="setup_offline">
You appear to be offline. Please connect to the internet and restart ArmCord Setup.
</p>
<p>You appear to be offline. Please connect to the internet and restart ArmCord Setup.</p>
</div>
<div id="setup">
<div id="logo" class="hidden"></div>
<div id="page1" class="hidden">
<p id="setup_question1">Select the type of setup you want to perform.</p>
<p>Select the type of setup you want to perform.</p>
<div id="buttons">
<button id="express" class="center">Express</button>
<button id="full" class="center">Full</button>
@ -27,7 +25,7 @@
</div>
<div id="page2" class="hidden">
<p class="text-center setup-ask" id="setup_question2">Choose your Discord channel/instance:</p>
<p class="text-center setup-ask">Choose your Discord channel/instance:</p>
<div class="center">
<select name="channel" id="channel" class="dropdown-button">
<option value="stable">Stable</option>
@ -36,9 +34,7 @@
<option value="foss">Fosscord</option>
</select>
</div>
<p class="text-center setup-ask" id="setup_question3">
Should ArmCord handle client mods installation?
</p>
<p class="text-center setup-ask">Should ArmCord handle client mods installation?</p>
<div class="center">
<select name="csp" id="csp" class="dropdown-button">
<option value="true">Yes</option>
@ -51,7 +47,7 @@
</div>
<div id="page3" class="hidden">
<p class="text-center setup-ask" id="setup_question4">Select a client mod you want to install:</p>
<p class="text-center setup-ask">Select a client mod you want to install:</p>
<div class="center">
<select name="mod" id="mod" class="dropdown-button">
<option value="cumcord">Cumcord</option>
@ -59,9 +55,9 @@
<option value="flicker">Flicker (Heavily WIP)</option>
</select>
</div>
<p class="text-center" id="setup_question4_clientmodnotice">
<p class="text-center">
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 ;)
want to do it though, check our documentation ;)
</p>
<div id="buttons">
<button id="next" class="center">Next</button>
@ -69,25 +65,7 @@
</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>
document.onload = function () {
ipcRenderer.send("win-unmaximize");
@ -123,7 +101,6 @@
automaticPatches: false,
mods: "cumcord",
inviteWebsocket: true,
performanceMode: "none",
blurType: "acrylic"
});
setTimeout(() => window.armcordinternal.restart(), 5000);
@ -153,7 +130,6 @@
autoLaunch: true,
minimizeToTray: true,
automaticPatches: false,
performanceMode: "none",
mods: options.mod,
inviteWebsocket: true,
blurType: "acrylic"
@ -169,7 +145,6 @@
automaticPatches: false,
autoLaunch: true,
mods: "none",
performanceMode: "none",
inviteWebsocket: true,
blurType: "acrylic"
});

View file

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

View file

@ -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, injectElectronFlags} from "./utils";
import {getConfig, setup, checkIfConfigExists} from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
@ -12,7 +12,6 @@ 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.");
@ -25,7 +24,7 @@ if (process.platform == "linux") {
}
}
checkIfConfigExists();
injectElectronFlags();
app.whenReady().then(async () => {
switch (await getConfig("windowStyle")) {
case "default":

View file

@ -16,11 +16,6 @@ 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),
getLang: (toGet: string) =>
ipcRenderer.invoke("getLang", toGet).then((result) => {
return result;
}),
version: ipcRenderer.sendSync("get-app-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector,
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")

View file

@ -4,19 +4,11 @@ import "./patch";
import * as fs from "fs";
import * as path from "path";
import {injectTitlebar} from "./titlebar";
import {sleep, addStyle, injectJS, addScript} from "../utils";
import {sleep, addStyle, injectJS} from "../utils";
import {ipcRenderer} from "electron";
import {injectTabs} from "./tabs";
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 {
interface Window {
armcord: any;
@ -38,7 +30,7 @@ if (window.location.href.indexOf("splash.html") > -1) {
if (ipcRenderer.sendSync("tabs")) {
injectTabs();
}
sleep(5000).then(async () => {
sleep(5000).then(() => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
@ -46,17 +38,14 @@ 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;
}
});

View file

@ -1,5 +1,5 @@
import {BrowserWindow, shell, ipcMain} from "electron";
import {getConfig, setConfigBulk, Settings, getLang} from "../utils";
import {getConfig, setConfigBulk, Settings} from "../utils";
import path from "path";
var settingsWindow: BrowserWindow;
var instance: number = 0;
@ -31,9 +31,6 @@ 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"};
@ -41,7 +38,6 @@ 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;
});

View file

@ -2,10 +2,6 @@ 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;

View file

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

View file

@ -1,7 +1,6 @@
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;
@ -43,7 +42,6 @@ export function setup() {
automaticPatches: false,
mods: "cumcord",
blurType: "acrylic",
performanceMode: "none",
inviteWebsocket: true,
doneSetup: false
};
@ -65,79 +63,7 @@ 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");
}
}
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
export interface Settings {
@ -147,7 +73,6 @@ export interface Settings {
minimizeToTray: boolean;
automaticPatches: boolean;
mods: string;
performanceMode: string;
blurType: string;
inviteWebsocket: boolean;
doneSetup: boolean;

View file

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