Compare commits

..

25 commits

Author SHA1 Message Date
smartfrigde
6d951db41d Fix icon generating incorrectly on Debian 2022-06-01 21:58:08 +02:00
theofficialgman
b933ea5580
Fix releases (#127)
* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml
2022-05-31 21:33:42 +02:00
smartfrigde
89df58c1fe e 2022-05-25 20:03:11 +02:00
smartfridge
b62ee16640
e 2022-05-24 20:01:47 +02:00
smartfrigde
a619bd50a2 ls 2022-05-24 13:45:13 +02:00
smartfrigde
3fd9817d4f I forgor 2022-05-24 12:52:15 +02:00
smartfrigde
00ecd5ab46 Ultimate CI fix 2022-05-24 12:39:14 +02:00
smartfrigde
9aaffec54d Add listing all files in dist dir 2022-05-24 12:03:03 +02:00
smartfrigde
713dee231d f 2022-05-23 21:52:10 +02:00
smartfrigde
c1e60574d4 ugh 2022-05-23 20:56:01 +02:00
smartfrigde
ebaa340814 e 2022-05-23 20:35:49 +02:00
smartfrigde
347916f582 fix 2022-05-23 20:09:10 +02:00
smartfrigde
eb94a4c4c9 fix 2022-05-23 19:43:00 +02:00
smartfrigde
7ca079025f it's getting late 2022-05-23 19:07:14 +02:00
smartfrigde
5d0c29c409 oop 2022-05-23 18:42:57 +02:00
smartfrigde
50f9ded9e7 fix 2022-05-23 18:24:07 +02:00
smartfrigde
bde78e1924 ujgh 2022-05-23 18:15:19 +02:00
smartfrigde
aa76171d34 it turns out, it was powershell all along 2022-05-23 18:08:58 +02:00
smartfrigde
bfd874b9a9 Fix deleting unpacked builds in windowns 2022-05-23 18:03:15 +02:00
smartfrigde
e9afff1d92 Fix removing unpacked builds on Windows 2022-05-23 17:52:36 +02:00
smartfrigde
716cfea120 Burn in hell Bill Gates 2022-05-23 16:58:30 +02:00
smartfrigde
b9fb4837db Add release workflow (pls work) 2022-05-23 16:53:16 +02:00
smartfrigde
0ecabaeb36 v3.0.6 2022-05-23 16:08:49 +02:00
smartfrigde
e3b891e636 Correct the version in AC internals 2022-05-23 16:08:26 +02:00
smartfridge
cdfdbc5e2a
Add the release workflow 2022-05-23 16:07:22 +02:00
28 changed files with 322 additions and 531 deletions

View file

@ -138,7 +138,7 @@ jobs:
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
with:
delete_release: true
tag_name: v3.0.7
tag_name: v3.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "file:///home/smartfridge/Documents/ArmCord/.github/workflows/build.yml"
}
}

View file

@ -12,19 +12,17 @@
"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",
"settings-theme-native": "Native",
"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,30 +0,0 @@
{
"loading_screen_start": "Cargando ArmCord…",
"loading_screen_offline": "Parece que no estás conectado a la Internet. Por favor conectate e intentalo de nuevo.",
"loading_screen_update": "Una nueva version de ArmCord está disponible. Por favor actualiza a la última version.",
"setup_question1": "Escoge que tipo de instalación quieres hacer:",
"yes": "Sí",
"setup_question2": "Escoge tu version de Discord:",
"setup_question3": "Dejar que ArmCord se encargue de la instalacion de modificaciones?",
"setup_question1_answer1": "Instalación rápida",
"setup_question1_answer2": "Instalación completa",
"setup_offline": "Parece que no estás conectado a la Internet. Por favor conectate a la Internet e reinicia el instalador de ArmCord.",
"no": "No",
"next": "Siguiente",
"setup_question4": "Selecciona una modificación que te gustaría instalar:",
"setup_question4_clientmodnotice": "Por qué no instalar todas las modificaciones? Tener varias modificaciones a la vez puede causar problemas. Si realmente quieres hacerlo, puedes unirte a nuestro Discord.",
"settings-theme": "Tema de ArmCord:",
"settings-theme-default": "Por Defecto",
"settings-theme-native": "Nativa",
"settings-tray": "Minimizar a la barra de tareas",
"settings-patches": "Automatizar Parches",
"settings-channel": "Version de Discord:",
"settings-invitewebsocket": "Websocket de Invitación",
"settings-mod": "Modificación:",
"settings-prfmMode": "Modo de Rendimiento:",
"settings-prfmMode-performance": "Rendimiento",
"settings-prfmMode-battery": "Batería",
"settings-none": "Ninguna",
"settings-save": "Guardar ajustes",
"settings-updater": "Buscar una actualización"
}

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,21 +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,30 +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-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

@ -19,12 +19,10 @@
"settings-updater": "Controlla gli aggiornamenti",
"settings-mod": "Client mod:",
"settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)",
"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

@ -19,12 +19,10 @@
"settings-save": "Save settings",
"settings-updater": "Check for updates",
"settings-theme": "ArmCord Theme:",
"settings-theme-glasstron": "Glasstron (experimental)",
"settings-theme-tabs": "Tabs (experimental)",
"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

@ -20,11 +20,9 @@
"settings-updater": "Check voor updates",
"settings-patches": "Automatische Patches",
"settings-theme": "ArmCord Thema:",
"settings-theme-glasstron": "Glasstron (experimenteel)",
"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",
@ -19,12 +19,10 @@
"settings-save": "Zapisz ustawienia",
"settings-mod": "Modyfikacja klienta:",
"settings-theme": "Motyw ArmCord:",
"settings-theme-glasstron": "Glasstron (eksperymentalne)",
"settings-theme-tabs": "Karty (eksperymentalne)",
"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"
}

View file

@ -1,30 +0,0 @@
{
"loading_screen_start": "เริ่มต้น ArmCord…",
"loading_screen_offline": "ดูเหมือนว่าคุณออฟไลน์อยู่ โปรดเชื่อมต่ออินเทอร์เน็ตและลองใหม่อีกครั้ง",
"loading_screen_update": "ArmCord เวอร์ชันใหม่พร้อมใช้งานแล้ว โปรดอัปเดตเป็นเวอร์ชันล่าสุด",
"setup_question1": "เลือกประเภทการติดตั้งที่คุณต้องการ:",
"setup_question1_answer1": "ติดตั้งแบบรวดเร็ว",
"setup_question1_answer2": "การตั้งค่าเต็มรูปแบบ",
"setup_offline": "ดูเหมือนว่าคุณออฟไลน์อยู่ โปรดเชื่อมต่ออินเทอร์เน็ตและลองใหม่อีกครั้ง",
"setup_question2": "เลือกช่อง/อินสแตนส์ Discord:",
"setup_question3": "ต้องการให้ ArmCord จัดการการติดตั้งมอดของไคลเอนต์หรือไม่?",
"yes": "ใช่",
"no": "ไม่",
"next": "ถัดไป",
"setup_question4": "เลือกไคลเอนต์มอดที่ต้องการติดตั้ง:",
"settings-prfmMode-battery": "แบตเตอรี่",
"setup_question4_clientmodnotice": "ทำไมไม่ใช้ทั้งหมดล่ะ? การมีไคลเอนต์มอดหลายตัวพร้อมกันอาจทำให้เกิดปัญหาได้ หากต้องการที่จะทำจริงๆ ให้ไปดูใน Discord ของเรา",
"settings-theme": "ธีม ArmCord:",
"settings-theme-default": "ค่าเริ่มต้น",
"settings-theme-native": "ดั้งเดิม",
"settings-tray": "ย่อลงไปในถาดงาน",
"settings-patches": "แพทช์อัตโนมัติ",
"settings-channel": "ช่อง Discord:",
"settings-invitewebsocket": "ใช้ Websocket สำหรับการเชิญ",
"settings-prfmMode": "โหมดประสิทธิภาพ:",
"settings-prfmMode-performance": "ประสิทธิภาพ",
"settings-mod": "ไคลแอนต์มอด:",
"settings-none": "ไม่มี",
"settings-save": "บันทึกการตั้งค่า",
"settings-updater": "ตรวจหาการอัปเดต"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,6 @@
{
"name": "ArmCord",
"version": "3.0.7",
"version": "3.0.6",
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
"main": "ts-out/main.js",
"scripts": {
@ -23,20 +23,19 @@
},
"homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": {
"@types/node": "^17.0.42",
"@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.7.0",
"typescript": "^4.7.3"
"prettier": "^2.5.1",
"typescript": "^4.6.3"
},
"dependencies": {
"electron-context-menu": "github:ArmCord/electron-context-menu",
"os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0",
"ws": "^8.8.0"
"ws": "^8.6.0"
},
"build": {
"appId": "com.smartfridge.armcord",

46
src/content/css/tabs.css Normal file
View file

@ -0,0 +1,46 @@
.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

@ -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,7 @@
automaticPatches: false,
mods: "cumcord",
inviteWebsocket: true,
performanceMode: "none"
blurType: "acrylic"
});
setTimeout(() => window.armcordinternal.restart(), 5000);
});
@ -152,9 +130,9 @@
autoLaunch: true,
minimizeToTray: true,
automaticPatches: false,
performanceMode: "none",
mods: options.mod,
inviteWebsocket: true
inviteWebsocket: true,
blurType: "acrylic"
});
setTimeout(() => window.armcordinternal.restart(), 500);
});
@ -167,8 +145,8 @@
automaticPatches: false,
autoLaunch: true,
mods: "none",
performanceMode: "none",
inviteWebsocket: true
inviteWebsocket: true,
blurType: "acrylic"
});
setTimeout(() => window.armcordinternal.restart(), 500);
}

View file

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

View file

@ -1,18 +1,15 @@
//ipc stuff
import {app, ipcMain, shell, desktopCapturer} from "electron";
import {mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig, setLang, getLang, getWindowState} from "./utils";
import {customTitlebar} from "./main";
import {createTabsGuest, mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig} from "./utils";
import {customTitlebar, tabs} from "./main";
import {createSettingsWindow} from "./settings/main";
export function registerIpc() {
ipcMain.on("get-app-path", (event, arg) => {
event.reply("app-path", app.getAppPath());
});
ipcMain.on("setLang", (event, lang: string) => {
setLang(lang);
});
ipcMain.handle("getLang", (event, toGet: string) => {
return getLang(toGet);
ipcMain.on("openTab", (event, number: number) => {
createTabsGuest(number);
});
ipcMain.on("open-external-link", (event, href: string) => {
shell.openExternal(href);
@ -41,22 +38,8 @@ export function registerIpc() {
ipcMain.on("get-app-version", (event) => {
event.returnValue = getVersion();
});
ipcMain.on("splashEnd", async (event, arg) => {
try {
var width = await getWindowState("width") ?? 800;
var height= await getWindowState("height") ?? 600;
var isMaximized = await getWindowState("isMaximized") ?? false;
} catch (e) {
console.log("No window state file found. Fallbacking to default values.")
ipcMain.on("splashEnd", (event, arg) => {
mainWindow.setSize(800, 600);
}
if (isMaximized) {
mainWindow.setSize(800, 600); //just so the whole thing doesn't cover whole screen
mainWindow.maximize()
} else {
mainWindow.setSize(width, height);
console.log("Not maximized.")
}
});
ipcMain.on("restart", (event, arg) => {
app.relaunch();
@ -77,6 +60,9 @@ export function registerIpc() {
ipcMain.on("titlebar", (event, arg) => {
event.returnValue = customTitlebar;
});
ipcMain.on("tabs", (event, arg) => {
event.returnValue = tabs;
});
ipcMain.on("shouldPatch", async (event, arg) => {
event.returnValue = await getConfig("automaticPatches");
});

View file

@ -1,15 +1,16 @@
// Modules to control application life and create native browser window
import {app, BrowserWindow, session} from "electron";
import {app, BrowserWindow, session, dialog} from "electron";
import "v8-compile-cache";
import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
import {getConfig, setup, checkIfConfigExists} from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import {createCustomWindow, createNativeWindow} from "./window";
import {createCustomWindow, createNativeWindow, createTabsHost} from "./window";
import "./shortcuts";
export var settings: any;
export var customTitlebar: boolean;
export var tabs: boolean;
if (process.platform == "linux") {
if (process.env.$XDG_SESSION_TYPE == "wayland") {
@ -23,7 +24,7 @@ if (process.platform == "linux") {
}
}
checkIfConfigExists();
injectElectronFlags();
app.whenReady().then(async () => {
switch (await getConfig("windowStyle")) {
case "default":
@ -36,6 +37,17 @@ app.whenReady().then(async () => {
case "discord":
createNativeWindow();
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:
createCustomWindow();
customTitlebar = true;
@ -60,8 +72,16 @@ app.whenReady().then(async () => {
case "native":
createNativeWindow();
break;
case "discord":
createNativeWindow();
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:
createCustomWindow();

View file

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

View file

@ -4,18 +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;
@ -28,16 +21,16 @@ const clientMods = {
};
console.log("ArmCord");
ipcRenderer.on("themeLoader", (event, message) => {
addStyle(message);
});
if (window.location.href.indexOf("splash.html") > -1) {
console.log("Skipping titlebar injection and client mod injection.");
} else {
if (ipcRenderer.sendSync("titlebar")) {
injectTitlebar();
}
sleep(5000).then(async () => {
if (ipcRenderer.sendSync("tabs")) {
injectTabs();
}
sleep(5000).then(() => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
@ -45,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;
}
});

26
src/preload/tabs.ts Normal file
View file

@ -0,0 +1,26 @@
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,8 +38,10 @@ export function injectTitlebar() {
maximize!.addEventListener("click", () => {
if (ipcRenderer.sendSync("win-isMaximized") == true) {
ipcRenderer.send("win-unmaximize");
document.body.removeAttribute("isMaximized");
} else {
ipcRenderer.send("win-maximize");
document.body.setAttribute("isMaximized", "");
}
});
@ -52,3 +54,6 @@ export function injectTitlebar() {
});
});
}
export function removeTitlebar() {
document.querySelector("#titlebar")!.remove();
}

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;

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,10 @@
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,
channel: document.getElementById("channel").value,
@ -111,8 +82,8 @@
minimizeToTray: document.getElementById("tray").checked,
automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value,
blurType: "acrylic",
inviteWebsocket: document.getElementById("websocket").checked,
performanceMode: document.getElementById("prfmMode").value,
doneSetup: true
});
});

View file

@ -1,15 +1,10 @@
import { app, Menu, Tray } from "electron";
import { mainWindow } from "./window";
import { getConfig, setWindowState } from "./utils";
import {app, Menu, Tray} from "electron";
import {mainWindow} from "./window";
import {getConfig} from "./utils";
import * as path from "path";
import { createSettingsWindow } from "./settings/main";
import { platform } from "process";
import {createSettingsWindow} from "./settings/main";
let tray: any = null;
let defaultIcon = "ac_plug_colored";
app.whenReady().then(async () => {
if (platform == "darwin") {
defaultIcon = "macos"
}
if ((await getConfig("windowStyle")) == "discord") {
tray = new Tray(path.join(__dirname, "../", "/assets/dsc-tray.png"));
const contextMenu = Menu.buildFromTemplate([
@ -22,12 +17,6 @@ app.whenReady().then(async () => {
{
label: "Quit ArmCord",
click: function () {
let [width, height] = mainWindow.getSize()
setWindowState({
width: width,
height: height,
isMaximized: mainWindow.isMaximized()
})
app.quit();
}
}
@ -36,7 +25,7 @@ app.whenReady().then(async () => {
tray.setToolTip("Discord");
tray.setContextMenu(contextMenu);
} else {
var trayIcon = (await getConfig("trayIcon")) ?? defaultIcon;
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
const contextMenu = Menu.buildFromTemplate([
{
@ -70,12 +59,6 @@ app.whenReady().then(async () => {
{
label: "Quit ArmCord",
click: function () {
let [width, height] = mainWindow.getSize()
setWindowState({
width: width,
height: height,
isMaximized: mainWindow.isMaximized()
})
app.quit();
}
}

View file

@ -1,7 +1,6 @@
import * as fs from "fs";
import { app, dialog } from "electron";
import {app, dialog} from "electron";
import path from "path";
import { defaultMaxListeners } from "events";
export var firstRun: boolean;
export var isSetup: boolean;
export var contentPath: string;
@ -42,7 +41,7 @@ export function setup() {
minimizeToTray: true,
automaticPatches: false,
mods: "cumcord",
performanceMode: "none",
blurType: "acrylic",
inviteWebsocket: true,
doneSetup: false
};
@ -53,7 +52,7 @@ export function setup() {
export function getVersion() {
//to-do better way of doing this
return "3.0.7";
return "3.0.6";
}
export async function injectJS(inject: string) {
const js = await (await fetch(`${inject}`)).text();
@ -64,111 +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) {
try {
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"];
} catch (e) {
console.log("Language config file doesn't exist. Fallback to English.")
language = "en-US"
}
}
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 Window State manager
export interface WindowState {
width: number;
height: number;
isMaximized: boolean;
}
export async function setWindowState(object: WindowState) {
const userDataPath = app.getPath("userData");
const storagePath = path.join(userDataPath, "/storage/");
const saveFile = storagePath + "window.json";
if (!fs.existsSync(saveFile)) {
fs.writeFileSync(saveFile, "{}", "utf-8");
}
let toSave = JSON.stringify(object);
fs.writeFileSync(saveFile, toSave, "utf-8");
}
export async function getWindowState(object: string) {
const userDataPath = app.getPath("userData");
const storagePath = path.join(userDataPath, "/storage/");
const settingsFile = storagePath + "window.json";
let rawdata = fs.readFileSync(settingsFile, "utf-8");
let returndata = JSON.parse(rawdata);
console.log(object + ": " + returndata[object]);
return returndata[object];
}
//ArmCord Settings/Storage manager
export interface Settings {
@ -178,7 +73,7 @@ export interface Settings {
minimizeToTray: boolean;
automaticPatches: boolean;
mods: string;
performanceMode: string;
blurType: string;
inviteWebsocket: boolean;
doneSetup: boolean;
}

View file

@ -2,18 +2,17 @@
// 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
// I'm sorry for this mess but I'm not sure how to fix it.
import { BrowserWindow, shell, app, dialog } from "electron";
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
import path from "path";
import { checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang, setWindowState } from "./utils";
import { registerIpc } from "./ipc";
import * as fs from "fs";
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup} from "./utils";
import {registerIpc} from "./ipc";
import startServer from "./socket";
import contextMenu from "electron-context-menu";
import os from "os";
export var icon: string;
export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow;
var osType = os.type()
let guestWindows: BrowserWindow[] = [];
contextMenu({
showSaveImageAs: true,
@ -22,82 +21,18 @@ contextMenu({
});
async function doAfterDefiningTheWindow() {
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
checkIfConfigIsBroken();
registerIpc();
// A little sloppy but it works :p
if (osType == 'Windows_NT') {
osType = "Windows " + os.release().split('.')[0] + " (" + os.release() + ")";
}
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${os.type()} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
mainWindow.webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url);
} else {
if (ignoreProtocolWarning) {
shell.openExternal(url);
} else {
const options = {
type: "question",
buttons: ["Yes, please", "No, I don't"],
defaultId: 1,
title: url,
message: `Do you want to open ${url}?`,
detail: "This url was detected to not use normal browser protocols. It could mean that this url leads to a local program on your computer. Please check if you recognise it, before proceeding!",
checkboxLabel: "Remember my answer and ignore this warning for future sessions",
checkboxChecked: false
};
dialog.showMessageBox(mainWindow, options).then(({ response, checkboxChecked }) => {
console.log(response, checkboxChecked);
if (checkboxChecked) {
if (response == 0) {
setConfig("ignoreProtocolWarning", true);
} else {
setConfig("ignoreProtocolWarning", false);
}
}
if (response == 0) {
shell.openExternal(url);
} else {
return;
}
});
}
}
return { action: "deny" };
return {action: "deny"};
});
mainWindow.webContents.session.webRequest.onBeforeRequest((details, callback) => {
if (/api\/v\d\/science$/g.test(details.url)) return callback({ cancel: true });
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
return callback({});
});
const userDataPath = app.getPath("userData");
const themesFolder = userDataPath + "/themes/";
if (!fs.existsSync(themesFolder)) {
fs.mkdirSync(themesFolder);
console.log("Created missing theme folder");
}
mainWindow.webContents.on('did-finish-load', () => {
fs.readdirSync(themesFolder).forEach((file) => {
try {
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
var themeFile = JSON.parse(manifest);
mainWindow.webContents.send("themeLoader", fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8"))
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
} catch (err) {
console.error(err);
}
});
});
mainWindow.on("close", async (e) => {
let [width, height] = mainWindow.getSize()
setWindowState({
width: width,
height: height,
isMaximized: mainWindow.isMaximized()
})
if (await getConfig("minimizeToTray")) {
e.preventDefault();
mainWindow.hide();
@ -106,20 +41,14 @@ async function doAfterDefiningTheWindow() {
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);
if ((await getConfig("inviteWebsocket")) == true) {
startServer();
}
try {
mainWindow.loadFile(contentPath);
if (isSetup) {
await setLang(Intl.DateTimeFormat().resolvedOptions().locale)
mainWindow.setSize(390, 470);
}
} catch (e) {
@ -129,7 +58,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 {
@ -137,7 +65,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 {
@ -152,7 +79,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: {
@ -168,7 +95,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: {
@ -179,13 +106,84 @@ export function createNativeWindow() {
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/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/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() {
inviteWindow = new BrowserWindow({
width: 800,
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: {