Compare commits

..

No commits in common. "7f53710d6af56e2c1b7b2c90511f66667b8d6d87" and "994ab5f5b05808a1070d07894eea92e5d1766ebb" have entirely different histories.

6 changed files with 12 additions and 48 deletions

View file

@ -34,7 +34,6 @@
}, },
"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,14 +12,12 @@
<body> <body>
<div class="container"> <div class="container">
<div id="warning" class="hidden"> <div id="warning" class="hidden">
<p id="setup_offline"> <p>You appear to be offline. Please connect to the internet and restart ArmCord Setup.</p>
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 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"> <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>
@ -27,7 +25,7 @@
</div> </div>
<div id="page2" class="hidden"> <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"> <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>
@ -36,9 +34,7 @@
<option value="foss">Fosscord</option> <option value="foss">Fosscord</option>
</select> </select>
</div> </div>
<p class="text-center setup-ask" id="setup_question3"> <p class="text-center setup-ask">Should ArmCord handle client mods installation?</p>
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>
@ -51,7 +47,7 @@
</div> </div>
<div id="page3" class="hidden"> <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"> <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>
@ -59,7 +55,7 @@
<option value="flicker">Flicker (Heavily WIP)</option> <option value="flicker">Flicker (Heavily WIP)</option>
</select> </select>
</div> </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 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 Discord ;)
</p> </p>
@ -69,25 +65,7 @@
</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");

View file

@ -60,9 +60,6 @@ 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

@ -17,10 +17,6 @@ contextBridge.exposeInMainWorld("armcord", {
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), 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

@ -9,13 +9,9 @@ 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() { async function updateLang() {
if (window.location.href.indexOf("setup.html") > -1) { addScript(`function getDiscordLang() {
console.log("Setup, skipping lang update"); {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}}
} else { getDiscordLang();`);
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 {

View file

@ -4,7 +4,7 @@
// 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, setLang} from "./utils"; import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig} from "./utils";
import {registerIpc} from "./ipc"; import {registerIpc} from "./ipc";
import startServer from "./socket"; import startServer from "./socket";
import contextMenu from "electron-context-menu"; import contextMenu from "electron-context-menu";
@ -85,10 +85,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,7 +98,6 @@ 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 {
@ -106,7 +105,6 @@ 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 {