Compare commits

...

12 commits

Author SHA1 Message Date
Anonymous
72c35cb2f3
Translated using Weblate (Spanish (Latin America))
Currently translated at 100.0% (0 of 0 strings)

Translation: ArmCord/ArmCord
Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/es_419/
2022-06-14 19:12:41 +02:00
smartfridge
4cf0187ef8
Added translation using Weblate (Spanish (Latin America)) 2022-06-14 19:12:34 +02:00
Hosted Weblate
f677b0e4fb
Update translation files
Updated by "Cleanup translation files" hook in Weblate.

Translation: ArmCord/ArmCord
Translate-URL: https://hosted.weblate.org/projects/armcord/armcord/
2022-06-14 17:55:22 +02:00
smartfrigde
7f9b93dc79 Remove unused translation string 2022-06-14 17:55:14 +02:00
smartfrigde
a29cb2a6a5 Add translation loading to splash 2022-06-14 17:54:50 +02:00
smartfrigde
c979328aee Remove glasstron and tabs completely 2022-06-14 17:02:37 +02:00
smartfrigde
8d85591e1c Change default tray icon for macOS to avoid issues 2022-06-14 16:49:12 +02:00
smartfrigde
c6e2244ce8 Move attribute logic to main 2022-06-14 16:30:18 +02:00
smartfrigde
9ab08b16d8 Update dependencies 2022-06-14 16:07:33 +02:00
smartfrigde
e86b1a8924 Don't remove the getLang handler 2022-06-14 14:55:47 +02:00
smartfrigde
ef73af66c4 Move the getLang handler to main ipc module instead of storing it in settings 2022-06-14 14:54:34 +02:00
smartfrigde
bdb09bb912 Remove unwanted getLang handlers 2022-06-14 14:53:26 +02:00
24 changed files with 104 additions and 261 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -14,8 +14,6 @@
"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 Discord.", "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-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",
"settings-tray": "Minimize to tray", "settings-tray": "Minimize to tray",

30
assets/lang/es-419.json Normal file
View file

@ -0,0 +1,30 @@
{
"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:",
"yes": "Yes",
"setup_question2": "Choose your Discord channel/instance:",
"setup_question3": "Should ArmCord handle client mods installation?",
"setup_question1_answer1": "Express setup",
"setup_question1_answer2": "Full setup",
"setup_offline": "You appear to be offline. Please connect to the Internet and restart the ArmCord setup.",
"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:",
"settings-theme-default": "Default",
"settings-theme-native": "Native",
"settings-tray": "Minimize to tray",
"settings-patches": "Automatic Patches",
"settings-channel": "Discord channel:",
"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"
}

View file

@ -19,9 +19,7 @@
"settings-save": "Save settings", "settings-save": "Save settings",
"settings-updater": "Check for updates", "settings-updater": "Check for updates",
"settings-theme": "Thème ArmCord :", "settings-theme": "Thème ArmCord :",
"settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-native": "Native", "settings-theme-native": "Native",
"settings-patches": "Automatic Patches", "settings-patches": "Automatic Patches",
"settings-invitewebsocket": "Lien discord.gg", "settings-invitewebsocket": "Lien discord.gg",

View file

@ -14,7 +14,6 @@
"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 documentation.",
"settings-theme": "ArmCord Theme:", "settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)", "settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",

View file

@ -19,7 +19,6 @@
"settings-updater": "Controlla gli aggiornamenti", "settings-updater": "Controlla gli aggiornamenti",
"settings-mod": "Client mod:", "settings-mod": "Client mod:",
"settings-theme": "ArmCord Theme:", "settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)", "settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",

View file

@ -19,7 +19,6 @@
"settings-save": "Save settings", "settings-save": "Save settings",
"settings-updater": "Check for updates", "settings-updater": "Check for updates",
"settings-theme": "ArmCord Theme:", "settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)", "settings-theme-tabs": "Tabs (experimental)",
"settings-theme-default": "Default", "settings-theme-default": "Default",
"settings-theme-native": "Native", "settings-theme-native": "Native",

View file

@ -20,7 +20,6 @@
"settings-updater": "Check voor updates", "settings-updater": "Check voor updates",
"settings-patches": "Automatische Patches", "settings-patches": "Automatische Patches",
"settings-theme": "ArmCord Thema:", "settings-theme": "ArmCord Thema:",
"settings-theme-glasstron": "Glasstron (experimenteel)",
"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",

View file

@ -19,7 +19,6 @@
"settings-save": "Zapisz ustawienia", "settings-save": "Zapisz ustawienia",
"settings-mod": "Modyfikacja klienta:", "settings-mod": "Modyfikacja klienta:",
"settings-theme": "Motyw ArmCord:", "settings-theme": "Motyw ArmCord:",
"settings-theme-glasstron": "Glasstron (eksperymentalne)",
"settings-theme-tabs": "Karty (eksperymentalne)", "settings-theme-tabs": "Karty (eksperymentalne)",
"settings-theme-default": "Domyślny", "settings-theme-default": "Domyślny",
"settings-theme-native": "Natywny", "settings-theme-native": "Natywny",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

@ -23,20 +23,20 @@
}, },
"homepage": "https://github.com/armcord/armcord#readme", "homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": { "devDependencies": {
"@types/node": "^17.0.33", "@types/node": "^17.0.42",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"electron": "^19.0.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.7.0",
"typescript": "^4.6.3" "typescript": "^4.7.3"
}, },
"dependencies": { "dependencies": {
"electron-context-menu": "github:ArmCord/electron-context-menu", "electron-context-menu": "github:ArmCord/electron-context-menu",
"os-locale": "^6.0.2", "os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0", "v8-compile-cache": "^2.3.0",
"ws": "^8.6.0" "ws": "^8.8.0"
}, },
"build": { "build": {
"appId": "com.smartfridge.armcord", "appId": "com.smartfridge.armcord",

View file

@ -1,46 +0,0 @@
.tabs {
display: block;
top: 0;
left: 0;
right: 0;
flex-shrink: 0;
overflow: hidden;
zoom: 1;
box-sizing: border-box;
width: 100%;
clear: both;
height: 30px;
line-height: 30px;
background-color: #202225;
-webkit-app-region: drag;
width: 100%;
user-select: none;
-webkit-user-select: none;
position: fixed;
z-index: 99999;
}
.tabs #tabs-controls-container {
float: left;
width: 150px;
height: 100%;
line-height: 30px;
background-color: #202225;
-webkit-app-region: no-drag;
}
.tabs-buttons {
color: white;
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
transition: 0.3s;
font-size: 20px;
}
.tabs-buttons:hover {
background-color: #4e515a;
}
.withFrame-haYltI {
height: 30px !important;
}

View file

@ -123,8 +123,7 @@
automaticPatches: false, automaticPatches: false,
mods: "cumcord", mods: "cumcord",
inviteWebsocket: true, inviteWebsocket: true,
performanceMode: "none", performanceMode: "none"
blurType: "acrylic"
}); });
setTimeout(() => window.armcordinternal.restart(), 5000); setTimeout(() => window.armcordinternal.restart(), 5000);
}); });
@ -155,8 +154,7 @@
automaticPatches: false, automaticPatches: false,
performanceMode: "none", performanceMode: "none",
mods: options.mod, mods: options.mod,
inviteWebsocket: true, inviteWebsocket: true
blurType: "acrylic"
}); });
setTimeout(() => window.armcordinternal.restart(), 500); setTimeout(() => window.armcordinternal.restart(), 500);
}); });
@ -170,8 +168,7 @@
autoLaunch: true, autoLaunch: true,
mods: "none", mods: "none",
performanceMode: "none", performanceMode: "none",
inviteWebsocket: true, inviteWebsocket: true
blurType: "acrylic"
}); });
setTimeout(() => window.armcordinternal.restart(), 500); setTimeout(() => window.armcordinternal.restart(), 500);
} }

View file

@ -17,52 +17,53 @@
</div> </div>
</body> </body>
<script> <script>
const text = document.getElementById("text-splashscreen"); async function loadLang() {
if (window.navigator.onLine === false) { const text = document.getElementById("text-splashscreen");
text.innerHTML = "You appear to be offline. Please connect to the internet and try again."; if (window.navigator.onLine === false) {
} else { text.innerHTML = await armcord.getLang("loading_screen_offline");
text.innerHTML = "Starting ArmCord...";
if (window.armcord.version === "DEV") {
console.log("Running a development build of ArmCord. Skipping updater.");
} else { } else {
fetch("https://armcord.xyz/latest.json") text.innerHTML = await armcord.getLang("loading_screen_start");
.then((response) => response.json()) if (window.armcord.version === "DEV") {
.then((data) => { console.log("Running a development build of ArmCord. Skipping updater.");
if (data.version !== window.armcord.version) { } else {
var elem = document.createElement("img"); const response = await fetch("https://armcord.xyz/latest.json");
elem.classList.add("logo"); const data = await response.json();
elem.src = "https://armcord.smartfridge.space/update.webp"; if (data.version !== window.armcord.version) {
document.body.prepend(elem); var elem = document.createElement("img");
document.getElementById("splashscreen-armcord").remove(); elem.classList.add("logo");
text.innerHTML = elem.src = "https://armcord.smartfridge.space/update.webp";
"A new version of ArmCord is available. Please update to the latest version."; document.body.prepend(elem);
} else { document.getElementById("splashscreen-armcord").remove();
console.log("ArmCord is up to date."); text.innerHTML = await armcord.getLang("loading_screen_update");
} } else {
}); console.log("ArmCord is up to date.");
} }
setTimeout(() => {
window.armcordinternal.splashEnd();
switch (window.armcord.channel) {
case "stable":
window.location.replace("https://discord.com/app");
break;
case "canary":
window.location.replace("https://canary.discord.com/app");
break;
case "ptb":
window.location.replace("https://ptb.discord.com/app");
break;
case "foss":
window.location.replace("https://dev.fosscord.com/app");
break;
case undefined:
window.location.replace("https://discord.com/app");
break;
default:
window.location.replace("https://discord.com/app");
} }
}, 5000); setTimeout(() => {
window.armcordinternal.splashEnd();
switch (window.armcord.channel) {
case "stable":
window.location.replace("https://discord.com/app");
break;
case "canary":
window.location.replace("https://canary.discord.com/app");
break;
case "ptb":
window.location.replace("https://ptb.discord.com/app");
break;
case "foss":
window.location.replace("https://dev.fosscord.com/app");
break;
case undefined:
window.location.replace("https://discord.com/app");
break;
default:
window.location.replace("https://discord.com/app");
}
}, 5000);
}
} }
loadLang();
</script> </script>
</html> </html>

View file

@ -1,21 +1,18 @@
//ipc stuff //ipc stuff
import {app, ipcMain, shell, desktopCapturer} from "electron"; import {app, ipcMain, shell, desktopCapturer} from "electron";
import {createTabsGuest, mainWindow} from "./window"; import {mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils"; import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils";
import {customTitlebar, tabs} from "./main"; import {customTitlebar} from "./main";
import {createSettingsWindow} from "./settings/main"; import {createSettingsWindow} from "./settings/main";
export function registerIpc() { export function registerIpc() {
ipcMain.on("get-app-path", (event, arg) => { ipcMain.on("get-app-path", (event, arg) => {
event.reply("app-path", app.getAppPath()); event.reply("app-path", app.getAppPath());
}); });
ipcMain.on("openTab", (event, number: number) => {
createTabsGuest(number);
});
ipcMain.on("setLang", (event, lang: string) => { ipcMain.on("setLang", (event, lang: string) => {
setLang(lang); setLang(lang);
}); });
ipcMain.on("getLang", (event, object: string) => { ipcMain.handle("getLang", (event, toGet: string) => {
getLang(object); return getLang(toGet);
}); });
ipcMain.on("open-external-link", (event, href: string) => { ipcMain.on("open-external-link", (event, href: string) => {
shell.openExternal(href); shell.openExternal(href);
@ -60,18 +57,12 @@ 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");
}); });
ipcMain.on("titlebar", (event, arg) => { ipcMain.on("titlebar", (event, arg) => {
event.returnValue = customTitlebar; event.returnValue = customTitlebar;
}); });
ipcMain.on("tabs", (event, arg) => {
event.returnValue = tabs;
});
ipcMain.on("shouldPatch", async (event, arg) => { ipcMain.on("shouldPatch", async (event, arg) => {
event.returnValue = await getConfig("automaticPatches"); event.returnValue = await getConfig("automaticPatches");
}); });

View file

@ -1,16 +1,15 @@
// 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} from "electron";
import "v8-compile-cache"; import "v8-compile-cache";
import {getConfig, setup, checkIfConfigExists, injectElectronFlags} from "./utils"; import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
import "./extensions/mods"; import "./extensions/mods";
import "./extensions/plugin"; import "./extensions/plugin";
import "./tray"; import "./tray";
import {createCustomWindow, createNativeWindow, createTabsHost} from "./window"; import {createCustomWindow, createNativeWindow} from "./window";
import "./shortcuts"; import "./shortcuts";
export var settings: any; export var settings: any;
export var customTitlebar: boolean; export var customTitlebar: boolean;
export var tabs: boolean;
if (process.platform == "linux") { if (process.platform == "linux") {
@ -38,17 +37,6 @@ app.whenReady().then(async () => {
case "discord": case "discord":
createNativeWindow(); createNativeWindow();
break; break;
case "glasstron":
dialog.showErrorBox(
"Glasstron is unsupported.",
"This build doesn't include Glasstron functionality, please edit windowStyle value in your settings.json to something different (default for example)"
);
app.quit();
break;
case "tabs":
createTabsHost();
tabs = true;
break;
default: default:
createCustomWindow(); createCustomWindow();
customTitlebar = true; customTitlebar = true;
@ -73,16 +61,8 @@ app.whenReady().then(async () => {
case "native": case "native":
createNativeWindow(); createNativeWindow();
break; break;
case "glasstron": case "discord":
dialog.showErrorBox( createNativeWindow();
"Glasstron is unsupported.",
"This build doesn't include Glasstron functionality, please edit windowStyle value in your settings.json to something different (default for example)"
);
app.quit();
break;
case "tabs":
createTabsHost();
tabs = true;
break; break;
default: default:
createCustomWindow(); createCustomWindow();

View file

@ -6,7 +6,6 @@ import * as path from "path";
import {injectTitlebar} from "./titlebar"; import {injectTitlebar} from "./titlebar";
import {sleep, addStyle, injectJS, addScript} from "../utils"; import {sleep, addStyle, injectJS, addScript} from "../utils";
import {ipcRenderer} from "electron"; import {ipcRenderer} from "electron";
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) { if (window.location.href.indexOf("setup.html") > -1) {
@ -35,9 +34,6 @@ if (window.location.href.indexOf("splash.html") > -1) {
if (ipcRenderer.sendSync("titlebar")) { if (ipcRenderer.sendSync("titlebar")) {
injectTitlebar(); injectTitlebar();
} }
if (ipcRenderer.sendSync("tabs")) {
injectTabs();
}
sleep(5000).then(async () => { 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"));

View file

@ -1,26 +0,0 @@
import {addStyle} from "../utils";
import * as fs from "fs";
import * as path from "path";
export function injectTabs() {
document.addEventListener("DOMContentLoaded", function (event) {
var elem = document.createElement("div");
elem.innerHTML = `<nav class="tabs">
<div id="tabs-controls-container">
<button class="tabs-buttons" onclick="armcord.openTab(1)">1</button>
<button class="tabs-buttons" onclick="armcord.openTab(2)">2</button>
<button class="tabs-buttons" onclick="armcord.openTab(3)">3</button>
<button class="tabs-buttons" onclick="armcord.openTab(4)">4</button>
<button class="tabs-buttons" onclick="armcord.openTab(5)">5</button>
<p class="experimental">Experimental</p>
</div>
</nav>`;
elem.classList.add("withFrame-haYltI");
if (document.getElementById("app-mount") == null) {
document.body.appendChild(elem);
} else {
document.getElementById("app-mount")!.prepend(elem);
}
const cssPath = path.join(__dirname, "../", "/content/css/tabs.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
});
}

View file

@ -38,10 +38,8 @@ export function injectTitlebar() {
maximize!.addEventListener("click", () => { maximize!.addEventListener("click", () => {
if (ipcRenderer.sendSync("win-isMaximized") == true) { if (ipcRenderer.sendSync("win-isMaximized") == true) {
ipcRenderer.send("win-unmaximize"); ipcRenderer.send("win-unmaximize");
document.body.removeAttribute("isMaximized");
} else { } else {
ipcRenderer.send("win-maximize"); ipcRenderer.send("win-maximize");
document.body.setAttribute("isMaximized", "");
} }
}); });

View file

@ -31,9 +31,6 @@ 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"};
@ -41,7 +38,6 @@ 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

@ -104,7 +104,6 @@
} }
loadSettings(); loadSettings();
document.getElementById("settings-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)
settings.save({ settings.save({
windowStyle: document.getElementById("theme").value, windowStyle: document.getElementById("theme").value,
channel: document.getElementById("channel").value, channel: document.getElementById("channel").value,
@ -112,7 +111,6 @@
minimizeToTray: document.getElementById("tray").checked, minimizeToTray: document.getElementById("tray").checked,
automaticPatches: document.getElementById("patches").checked, automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value, mods: document.getElementById("mod").value,
blurType: "acrylic",
inviteWebsocket: document.getElementById("websocket").checked, inviteWebsocket: document.getElementById("websocket").checked,
performanceMode: document.getElementById("prfmMode").value, performanceMode: document.getElementById("prfmMode").value,
doneSetup: true doneSetup: true

View file

@ -3,8 +3,13 @@ import {mainWindow} from "./window";
import {getConfig} from "./utils"; import {getConfig} from "./utils";
import * as path from "path"; import * as path from "path";
import {createSettingsWindow} from "./settings/main"; import {createSettingsWindow} from "./settings/main";
import {platform} from "process";
let tray: any = null; let tray: any = null;
let defaultIcon = "ac_plug_colored";
app.whenReady().then(async () => { app.whenReady().then(async () => {
if (platform == "darwin") {
defaultIcon = "macos"
}
if ((await getConfig("windowStyle")) == "discord") { if ((await getConfig("windowStyle")) == "discord") {
tray = new Tray(path.join(__dirname, "../", "/assets/dsc-tray.png")); tray = new Tray(path.join(__dirname, "../", "/assets/dsc-tray.png"));
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
@ -25,7 +30,7 @@ app.whenReady().then(async () => {
tray.setToolTip("Discord"); tray.setToolTip("Discord");
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);
} else { } else {
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored"; var trayIcon = (await getConfig("trayIcon")) ?? defaultIcon;
tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`)); tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
{ {

View file

@ -42,7 +42,6 @@ export function setup() {
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
mods: "cumcord", mods: "cumcord",
blurType: "acrylic",
performanceMode: "none", performanceMode: "none",
inviteWebsocket: true, inviteWebsocket: true,
doneSetup: false doneSetup: false
@ -148,7 +147,6 @@ export interface Settings {
automaticPatches: boolean; automaticPatches: boolean;
mods: string; mods: string;
performanceMode: string; performanceMode: string;
blurType: string;
inviteWebsocket: boolean; inviteWebsocket: boolean;
doneSetup: boolean; doneSetup: boolean;
} }

View file

@ -2,7 +2,7 @@
// I had to add most of the window creation code here to split both into seperete functions // I had to add most of the window creation code here to split both into seperete functions
// WHY? Because I can't use the same code for both due to annoying bug with value `frame` not responding to variables // WHY? Because I can't use the same code for both due to annoying bug with value `frame` not responding to variables
// 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, dialog} 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, setLang} from "./utils";
import {registerIpc} from "./ipc"; import {registerIpc} from "./ipc";
@ -12,7 +12,6 @@ import os from "os";
export var icon: string; export var icon: string;
export let mainWindow: BrowserWindow; export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow; export let inviteWindow: BrowserWindow;
let guestWindows: BrowserWindow[] = [];
var osType = os.type() var osType = os.type()
contextMenu({ contextMenu({
@ -81,6 +80,12 @@ async function doAfterDefiningTheWindow() {
app.quit(); app.quit();
} }
}); });
mainWindow.on('maximize',() =>{
mainWindow.webContents.executeJavaScript(`document.body.setAttribute("isMaximized", "");`)
})
mainWindow.on('unmaximize',() =>{
mainWindow.webContents.executeJavaScript(`document.body.removeAttribute("isMaximized");`)
})
console.log(contentPath); console.log(contentPath);
if ((await getConfig("inviteWebsocket")) == true) { if ((await getConfig("inviteWebsocket")) == true) {
startServer(); startServer();
@ -148,77 +153,6 @@ export function createNativeWindow() {
doAfterDefiningTheWindow(); doAfterDefiningTheWindow();
} }
export function createTabsHost() {
dialog.showErrorBox(
"READ THIS BEFORE USING THE APP",
"ArmCord Tabs are highly experimental and should be only used for strict testing purposes. Please don't ask for support, however you can still report bugs!"
);
guestWindows[1] = mainWindow;
mainWindow = new BrowserWindow({
width: 300,
height: 350,
title: "ArmCord",
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js")
}
});
doAfterDefiningTheWindow();
}
export function createTabsGuest(number: number) {
console.log(guestWindows);
if (guestWindows[number] !== undefined || null) {
try {
console.log("Showing Guest Window " + number);
mainWindow.hide();
guestWindows[number].show();
mainWindow = guestWindows[number];
} catch (e) {
console.error(e);
}
} else {
console.log("Creating Guest Window " + number);
mainWindow.hide();
guestWindows[number] = new BrowserWindow({
width: 800,
height: 600,
title: "ArmCord Guest Window " + number,
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js")
}
});
mainWindow = guestWindows[number];
ipcMain.on("tab" + number, (event) => {
event.returnValue = true; //return true so we know the tab exists
});
guestWindows[number].webContents.userAgent =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"; //fake useragent for screenshare to work
guestWindows[number].webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url);
return {action: "deny"};
});
guestWindows[number].webContents.session.webRequest.onBeforeRequest(
(details: {url: string}, callback: (arg0: {cancel?: boolean}) => any) => {
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
return callback({});
}
);
guestWindows[number].loadURL("https://discord.com/app");
}
}
export function createInviteWindow() { export function createInviteWindow() {
inviteWindow = new BrowserWindow({ inviteWindow = new BrowserWindow({
width: 800, width: 800,