mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Compare commits
1 commit
b514df1f01
...
6d4efe854c
Author | SHA1 | Date | |
---|---|---|---|
|
6d4efe854c |
18 changed files with 78 additions and 225 deletions
|
@ -4,18 +4,18 @@
|
||||||
"settings-patches": "Automatic Patches",
|
"settings-patches": "Automatic Patches",
|
||||||
"settings-mod-desc4": "heavily work in progress, doesn't have a working UI.",
|
"settings-mod-desc4": "heavily work in progress, doesn't have a working UI.",
|
||||||
"loading_screen_update": "A new version of ArmCord is available. Please update to the latest version.",
|
"loading_screen_update": "A new version of ArmCord is available. Please update to the latest version.",
|
||||||
"loading_screen_start": "启动ArmCord…",
|
"loading_screen_start": "Starting ArmCord…",
|
||||||
"setup_question1": "Select what kind of setup you want to perform:",
|
"setup_question1": "Select what kind of setup you want to perform:",
|
||||||
"loading_screen_offline": "You appear to be offline. Please connect to the Internet and try again.",
|
"loading_screen_offline": "You appear to be offline. Please connect to the Internet and try again.",
|
||||||
"setup_question1_answer1": "Express Setup",
|
"setup_question1_answer1": "Express Setup",
|
||||||
"setup_question1_answer2": "Full Setup",
|
"setup_question1_answer2": "Full Setup",
|
||||||
"setup_offline": "You appear to be offline. Please connect to the internet and restart ArmCord.",
|
"setup_offline": "You appear to be offline. Please connect to the internet and restart ArmCord.",
|
||||||
"setup_question2": "Choose your Discord channel/instance:",
|
"setup_question2": "Choose your Discord channel/instance:",
|
||||||
"settings-updater": "检查更新",
|
"settings-updater": "Check for updates",
|
||||||
"setup_question3": "Should ArmCord handle client mods installation?",
|
"setup_question3": "Should ArmCord handle client mods installation?",
|
||||||
"yes": "是的",
|
"yes": "Yes",
|
||||||
"no": "不是",
|
"no": "No",
|
||||||
"next": "接下来",
|
"next": "Next",
|
||||||
"setup_question4": "Select a client mod you want to install:",
|
"setup_question4": "Select a client mod you want to install:",
|
||||||
"setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our 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",
|
||||||
|
@ -52,5 +52,5 @@
|
||||||
"settings-themesFolder": "Open themes folder",
|
"settings-themesFolder": "Open themes folder",
|
||||||
"settings-storageFolder": "Open storage folder",
|
"settings-storageFolder": "Open storage folder",
|
||||||
"settings-none": "None",
|
"settings-none": "None",
|
||||||
"settings-save": "保存设置"
|
"settings-save": "Save Settings"
|
||||||
}
|
}
|
||||||
|
|
BIN
assets/ping.png
BIN
assets/ping.png
Binary file not shown.
Before Width: | Height: | Size: 285 B |
|
@ -28,13 +28,13 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.7.13",
|
"@types/node": "^18.7.13",
|
||||||
"@types/ws": "^8.5.3",
|
"@types/ws": "^8.5.3",
|
||||||
"chalk-cli": "^5.0.0",
|
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"electron": "^20.1.0",
|
"electron": "^19.0.8",
|
||||||
"electron-builder": "^23.0.3",
|
"electron-builder": "^23.0.3",
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"prettier": "^2.7.0",
|
"prettier": "^2.7.0",
|
||||||
"typescript": "^4.7.3"
|
"typescript": "^4.7.3",
|
||||||
|
"chalk-cli": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
||||||
|
|
|
@ -254,3 +254,36 @@ select {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
.acTheme {
|
||||||
|
height: 15em !important;
|
||||||
|
}
|
||||||
|
.acCSP {
|
||||||
|
height: 10em !important;
|
||||||
|
}
|
||||||
|
.acPatches {
|
||||||
|
height: 10em !important;
|
||||||
|
}
|
||||||
|
.acWebsocket {
|
||||||
|
height: 10em !important;
|
||||||
|
}
|
||||||
|
.acMobileMode {
|
||||||
|
height: 11em !important;
|
||||||
|
}
|
||||||
|
.acAltPaste {
|
||||||
|
height: 11em !important;
|
||||||
|
}
|
||||||
|
.acChannel {
|
||||||
|
height: 21em !important;
|
||||||
|
}
|
||||||
|
.acClientMod {
|
||||||
|
height: 18em !important;
|
||||||
|
}
|
||||||
|
.acCordwood {
|
||||||
|
height: 8em !important;
|
||||||
|
}
|
||||||
|
.acPrfmMode {
|
||||||
|
height: 10em !important;
|
||||||
|
}
|
||||||
|
.acTray {
|
||||||
|
height: 8em !important;
|
||||||
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
.acTheme {
|
|
||||||
height: 15em !important;
|
|
||||||
}
|
|
||||||
.acCSP {
|
|
||||||
height: 10em !important;
|
|
||||||
}
|
|
||||||
.acPatches {
|
|
||||||
height: 10em !important;
|
|
||||||
}
|
|
||||||
.acWebsocket {
|
|
||||||
height: 10em !important;
|
|
||||||
}
|
|
||||||
.acMobileMode {
|
|
||||||
height: 11em !important;
|
|
||||||
}
|
|
||||||
.acAltPaste {
|
|
||||||
height: 11em !important;
|
|
||||||
}
|
|
||||||
.acChannel {
|
|
||||||
height: 21em !important;
|
|
||||||
}
|
|
||||||
.acClientMod {
|
|
||||||
height: 18em !important;
|
|
||||||
}
|
|
||||||
.acCordwood {
|
|
||||||
height: 8em !important;
|
|
||||||
}
|
|
||||||
.acPrfmMode {
|
|
||||||
height: 10em !important;
|
|
||||||
}
|
|
||||||
.acTray {
|
|
||||||
height: 8em !important;
|
|
||||||
}
|
|
|
@ -122,7 +122,7 @@
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
mobileMode: false,
|
mobileMode: false,
|
||||||
trayIcon: "default",
|
trayIcon: "ac_plug_colored",
|
||||||
performanceMode: "none"
|
performanceMode: "none"
|
||||||
});
|
});
|
||||||
setTimeout(() => window.armcordinternal.restart(), 5000);
|
setTimeout(() => window.armcordinternal.restart(), 5000);
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
alternativePaste: false,
|
alternativePaste: false,
|
||||||
trayIcon: "default",
|
trayIcon: "ac_plug_colored",
|
||||||
mods: options.mod,
|
mods: options.mod,
|
||||||
inviteWebsocket: true
|
inviteWebsocket: true
|
||||||
});
|
});
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
mods: "none",
|
mods: "none",
|
||||||
alternativePaste: false,
|
alternativePaste: false,
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
trayIcon: "default",
|
trayIcon: "ac_plug_colored",
|
||||||
inviteWebsocket: true
|
inviteWebsocket: true
|
||||||
});
|
});
|
||||||
setTimeout(() => window.armcordinternal.restart(), 500);
|
setTimeout(() => window.armcordinternal.restart(), 500);
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.armcord.splashEnd();
|
window.armcordinternal.splashEnd();
|
||||||
switch (window.armcord.channel) {
|
switch (window.armcord.channel) {
|
||||||
case "stable":
|
case "stable":
|
||||||
window.location.replace("https://discord.com/app");
|
window.location.replace("https://discord.com/app");
|
||||||
|
|
34
src/ipc.ts
34
src/ipc.ts
|
@ -1,19 +1,9 @@
|
||||||
//ipc stuff
|
//ipc stuff
|
||||||
import {app, ipcMain, shell, desktopCapturer,nativeImage} from "electron";
|
import {app, ipcMain, shell, desktopCapturer} from "electron";
|
||||||
import {mainWindow} from "./window";
|
import {mainWindow} from "./window";
|
||||||
import {
|
import {setConfigBulk, getVersion, getConfig, setLang, getLang, getWindowState, packageVersion} from "./utils";
|
||||||
setConfigBulk,
|
|
||||||
getVersion,
|
|
||||||
getConfig,
|
|
||||||
setLang,
|
|
||||||
getLang,
|
|
||||||
getWindowState,
|
|
||||||
packageVersion, getDisplayVersion
|
|
||||||
} from "./utils";
|
|
||||||
import {customTitlebar} from "./main";
|
import {customTitlebar} from "./main";
|
||||||
import {createSettingsWindow} from "./settings/main";
|
import {createSettingsWindow} from "./settings/main";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
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());
|
||||||
|
@ -27,21 +17,6 @@ export function registerIpc() {
|
||||||
ipcMain.on("open-external-link", (event, href: string) => {
|
ipcMain.on("open-external-link", (event, href: string) => {
|
||||||
shell.openExternal(href);
|
shell.openExternal(href);
|
||||||
});
|
});
|
||||||
ipcMain.on("setPing", (event, pingCount: number) => {
|
|
||||||
switch (os.platform()) {
|
|
||||||
case "linux" ?? "macos":
|
|
||||||
app.setBadgeCount(pingCount)
|
|
||||||
break;
|
|
||||||
case "win32":
|
|
||||||
if (pingCount > 0) {
|
|
||||||
var image = nativeImage.createFromPath(path.join(__dirname, "../", `/assets/ping.png`))
|
|
||||||
mainWindow.setOverlayIcon(image, "badgeCount")
|
|
||||||
} else {
|
|
||||||
mainWindow.setOverlayIcon(null, "badgeCount")
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ipcMain.on("win-maximize", (event, arg) => {
|
ipcMain.on("win-maximize", (event, arg) => {
|
||||||
mainWindow.maximize();
|
mainWindow.maximize();
|
||||||
});
|
});
|
||||||
|
@ -69,13 +44,10 @@ export function registerIpc() {
|
||||||
ipcMain.on("get-app-version", (event) => {
|
ipcMain.on("get-app-version", (event) => {
|
||||||
event.returnValue = getVersion();
|
event.returnValue = getVersion();
|
||||||
});
|
});
|
||||||
ipcMain.on("displayVersion", (event) => {
|
|
||||||
event.returnValue = getDisplayVersion();
|
|
||||||
});
|
|
||||||
ipcMain.on("get-package-version", (event) => {
|
ipcMain.on("get-package-version", (event) => {
|
||||||
event.returnValue = packageVersion;
|
event.returnValue = packageVersion;
|
||||||
});
|
});
|
||||||
ipcMain.on("splashEnd", async () => {
|
ipcMain.on("splashEnd", async (event, arg) => {
|
||||||
try {
|
try {
|
||||||
var width = (await getWindowState("width")) ?? 800;
|
var width = (await getWindowState("width")) ?? 800;
|
||||||
var height = (await getWindowState("height")) ?? 600;
|
var height = (await getWindowState("height")) ?? 600;
|
||||||
|
|
22
src/menu.ts
22
src/menu.ts
|
@ -1,7 +1,6 @@
|
||||||
import {Menu, app, clipboard, globalShortcut} from "electron";
|
import {Menu, app, clipboard, globalShortcut} from "electron";
|
||||||
import {mainWindow} from "./window";
|
import {mainWindow} from "./window";
|
||||||
import {getConfig} from "./utils";
|
import {getConfig} from "./utils";
|
||||||
import {createSettingsWindow} from "./settings/main";
|
|
||||||
|
|
||||||
function paste(contents: any) {
|
function paste(contents: any) {
|
||||||
const contentTypes = clipboard.availableFormats().toString();
|
const contentTypes = clipboard.availableFormats().toString();
|
||||||
|
@ -52,20 +51,6 @@ export async function setMenu() {
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Open settings",
|
|
||||||
accelerator: "CmdOrCtrl+Shift+'",
|
|
||||||
click: function () {
|
|
||||||
createSettingsWindow();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reload",
|
|
||||||
accelerator: "CmdOrCtrl+R",
|
|
||||||
click: function () {
|
|
||||||
mainWindow.reload()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Quit",
|
label: "Quit",
|
||||||
accelerator: "CmdOrCtrl+Q",
|
accelerator: "CmdOrCtrl+Q",
|
||||||
|
@ -92,13 +77,6 @@ export async function setMenu() {
|
||||||
},
|
},
|
||||||
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
|
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Zoom",
|
|
||||||
submenu: [
|
|
||||||
{label: "Zoom in", accelerator: "CmdOrCtrl+Plus", role: "zoomIn"},
|
|
||||||
{label: "Zoom out", accelerator: "CmdOrCtrl+-", role: "zoomOut"},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ contextBridge.exposeInMainWorld("armcord", {
|
||||||
electron: process.versions.electron,
|
electron: process.versions.electron,
|
||||||
channel: ipcRenderer.sendSync("channel"),
|
channel: ipcRenderer.sendSync("channel"),
|
||||||
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
||||||
setPingCount: (pingCount: number) => ipcRenderer.send("setPing", pingCount),
|
|
||||||
setTrayIcon: (favicon: string) => ipcRenderer.send("sendTrayIcon", favicon),
|
|
||||||
getLang: (toGet: string) =>
|
getLang: (toGet: string) =>
|
||||||
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
||||||
return result;
|
return result;
|
||||||
|
@ -25,13 +23,13 @@ contextBridge.exposeInMainWorld("armcord", {
|
||||||
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
||||||
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
|
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
|
||||||
getDisplayMediaSelector: getDisplayMediaSelector,
|
getDisplayMediaSelector: getDisplayMediaSelector,
|
||||||
splashEnd: () => ipcRenderer.send("splashEnd"),
|
|
||||||
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
||||||
});
|
});
|
||||||
//to be only used inside armcord internal setup/splash etc
|
//to be only used inside armcord internal setup/splash etc
|
||||||
if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) {
|
if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) {
|
||||||
contextBridge.exposeInMainWorld("armcordinternal", {
|
contextBridge.exposeInMainWorld("armcordinternal", {
|
||||||
restart: () => ipcRenderer.send("restart"),
|
restart: () => ipcRenderer.send("restart"),
|
||||||
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args)
|
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
||||||
|
splashEnd: () => ipcRenderer.send("splashEnd")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {injectHummusTitlebar, 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 {injectMobileStuff} from "./mobile";
|
import {injectMobileStuff} from "./mobile";
|
||||||
var version = ipcRenderer.sendSync("displayVersion");
|
var version = ipcRenderer.sendSync("get-app-version", "app-version");
|
||||||
var channel = ipcRenderer.sendSync("channel");
|
var channel = ipcRenderer.sendSync("channel");
|
||||||
async function updateLang() {
|
async function updateLang() {
|
||||||
if (window.location.href.indexOf("setup.html") > -1) {
|
if (window.location.href.indexOf("setup.html") > -1) {
|
||||||
|
|
|
@ -15,23 +15,6 @@
|
||||||
<div class="saveBar">
|
<div class="saveBar">
|
||||||
<button id="settings-save" class="center">Save Settings</button>
|
<button id="settings-save" class="center">Save Settings</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="switch acTheme">
|
|
||||||
<select name="theme" id="theme" class="left dropdown">
|
|
||||||
<option value="default">Default</option>
|
|
||||||
<option value="native">Native</option>
|
|
||||||
</select>
|
|
||||||
<p class="header" id="settings-theme">ArmCord theme</p>
|
|
||||||
<p class="description">
|
|
||||||
ArmCord "themes" manage apps behaviour and looks.
|
|
||||||
<br />
|
|
||||||
<b>Default</b> - this is how ArmCord looks when you first launch it. It includes recreation of Discord's
|
|
||||||
custom titlebar and ArmCord specific styles injected into Discord.
|
|
||||||
<br />
|
|
||||||
<b>Native</b> - uses native titlebar of OS you're currently running (e.g Windows 7/10). Functions more
|
|
||||||
similar to actual Discord app on Linux.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="switch acCSP">
|
<div class="switch acCSP">
|
||||||
<label class="header2">ArmCord CSP</label>
|
<label class="header2">ArmCord CSP</label>
|
||||||
<input class="tgl tgl-light left" id="csp" type="checkbox" />
|
<input class="tgl tgl-light left" id="csp" type="checkbox" />
|
||||||
|
@ -124,8 +107,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div class="switch acTray">
|
<div class="switch acTray">
|
||||||
<select name="trayIcon" id="trayIcon" class="left dropdown">
|
<select name="trayIcon" id="trayIcon" class="left dropdown">
|
||||||
<option value="default">Default (Dynamic)</option>
|
<option value="ac_plug_colored">Default</option>
|
||||||
<option value="ac_plug_colored">Plug colored</option>
|
|
||||||
<option value="dsc-tray">Discord Icon</option>
|
<option value="dsc-tray">Discord Icon</option>
|
||||||
<option value="ac_white_plug">White Icon</option>
|
<option value="ac_white_plug">White Icon</option>
|
||||||
<option value="ac_black_plug">Black Icon</option>
|
<option value="ac_black_plug">Black Icon</option>
|
||||||
|
@ -151,10 +133,17 @@
|
||||||
<script>
|
<script>
|
||||||
async function loadLang() {
|
async function loadLang() {
|
||||||
document.getElementById("settings-save").innerHTML = await settings.getLang("settings-save");
|
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-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-patches").innerHTML = await settings.getLang("settings-patches");
|
||||||
document.getElementById("settings-tray").innerHTML = await settings.getLang("settings-tray");
|
document.getElementById("settings-tray").innerHTML = await settings.getLang("settings-tray");
|
||||||
|
document.getElementById("settings-mobileMode").innerHTML = await settings.getLang("settings-mobileMode");
|
||||||
document.getElementById("settings-theme").innerHTML = await settings.getLang("settings-theme");
|
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[2].text = await settings.getLang("settings-none");
|
||||||
document.getElementById("prfmMode").options[1].text = await settings.getLang("settings-prfmMode-battery");
|
document.getElementById("prfmMode").options[1].text = await settings.getLang("settings-prfmMode-battery");
|
||||||
document.getElementById("prfmMode").options[0].text = await settings.getLang(
|
document.getElementById("prfmMode").options[0].text = await settings.getLang(
|
||||||
|
@ -169,26 +158,18 @@
|
||||||
async function loadSettings() {
|
async function loadSettings() {
|
||||||
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
||||||
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
||||||
|
document.getElementById("websocket").checked = await settings.get("inviteWebsocket");
|
||||||
document.getElementById("alternativePaste").checked = await settings.get("alternativePaste");
|
document.getElementById("alternativePaste").checked = await settings.get("alternativePaste");
|
||||||
|
document.getElementById("mobile").checked = await settings.get("mobileMode");
|
||||||
document.getElementById("patches").value = await settings.get("automaticPatches");
|
document.getElementById("patches").value = await settings.get("automaticPatches");
|
||||||
if ((await settings.get("mods")) == "cordwood") {
|
document.getElementById("mod").value = await settings.get("mods");
|
||||||
document.getElementById("cordwood").checked = true;
|
|
||||||
} else {
|
|
||||||
document.getElementById("cordwood").checked = false;
|
|
||||||
}
|
|
||||||
document.getElementById("channel").value = await settings.get("channel");
|
document.getElementById("channel").value = await settings.get("channel");
|
||||||
document.getElementById("theme").value = await settings.get("windowStyle");
|
document.getElementById("theme").value = await settings.get("windowStyle");
|
||||||
document.getElementById("prfmMode").value = await settings.get("performanceMode");
|
document.getElementById("prfmMode").value = await settings.get("performanceMode");
|
||||||
document.getElementById("trayIcon").value = await settings.get("trayIcon");
|
document.getElementById("trayIcon").value = await settings.get("trayIcon");
|
||||||
}
|
}
|
||||||
loadSettings();
|
loadSettings();
|
||||||
document.getElementById("settings-save").addEventListener("click", async function () {
|
document.getElementById("settings-save").addEventListener("click", function () {
|
||||||
var cordwood;
|
|
||||||
if (document.getElementById("cordwood").checked) {
|
|
||||||
cordwood = true;
|
|
||||||
} else {
|
|
||||||
cordwood = false;
|
|
||||||
}
|
|
||||||
settings.save({
|
settings.save({
|
||||||
windowStyle: document.getElementById("theme").value,
|
windowStyle: document.getElementById("theme").value,
|
||||||
channel: document.getElementById("channel").value,
|
channel: document.getElementById("channel").value,
|
||||||
|
@ -196,25 +177,22 @@
|
||||||
minimizeToTray: document.getElementById("tray").checked,
|
minimizeToTray: document.getElementById("tray").checked,
|
||||||
alternativePaste: document.getElementById("alternativePaste").checked,
|
alternativePaste: document.getElementById("alternativePaste").checked,
|
||||||
automaticPatches: document.getElementById("patches").checked,
|
automaticPatches: document.getElementById("patches").checked,
|
||||||
mods: cordwood,
|
mods: document.getElementById("mod").value,
|
||||||
mobileMode: await settings.get("mobileMode"),
|
mobileMode: document.getElementById("mobile").checked,
|
||||||
inviteWebsocket: await settings.get("inviteWebsocket"),
|
inviteWebsocket: document.getElementById("websocket").checked,
|
||||||
performanceMode: document.getElementById("prfmMode").value,
|
performanceMode: document.getElementById("prfmMode").value,
|
||||||
trayIcon: document.getElementById("trayIcon").value,
|
trayIcon: document.getElementById("trayIcon").value,
|
||||||
doneSetup: true
|
doneSetup: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document.getElementById("settings-pluginsFolder").addEventListener("click", async function () {
|
document.getElementById("settings-pluginsFolder").addEventListener("click", function () {
|
||||||
settings.openPluginsFolder();
|
settings.openPluginsFolder();
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
|
||||||
});
|
});
|
||||||
document.getElementById("settings-themesFolder").addEventListener("click", async function () {
|
document.getElementById("settings-themesFolder").addEventListener("click", function () {
|
||||||
settings.openThemesFolder();
|
settings.openThemesFolder();
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
|
||||||
});
|
});
|
||||||
document.getElementById("settings-storageFolder").addEventListener("click", async function () {
|
document.getElementById("settings-storageFolder").addEventListener("click", function () {
|
||||||
settings.openStorageFolder();
|
settings.openStorageFolder();
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
|
||||||
});
|
});
|
||||||
document.getElementById("settings-copyDebugInfo").addEventListener("click", function () {
|
document.getElementById("settings-copyDebugInfo").addEventListener("click", function () {
|
||||||
settings.copyDebugInfo();
|
settings.copyDebugInfo();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BrowserWindow, shell, ipcMain, app, clipboard} from "electron";
|
import {BrowserWindow, shell, ipcMain, app, clipboard} from "electron";
|
||||||
import {getConfig, setConfigBulk, Settings, getLang, getVersion, getConfigLocation, getLangName} from "../utils";
|
import {getConfig, setConfigBulk, Settings, getLang, getVersion, getConfigLocation} from "../utils";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
@ -26,7 +26,6 @@ export function createSettingsWindow() {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
sandbox: false,
|
|
||||||
preload: path.join(__dirname, "preload.js")
|
preload: path.join(__dirname, "preload.js")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -51,9 +50,6 @@ export function createSettingsWindow() {
|
||||||
ipcMain.on("openPluginsFolder", (event) => {
|
ipcMain.on("openPluginsFolder", (event) => {
|
||||||
shell.openPath(pluginsPath);
|
shell.openPath(pluginsPath);
|
||||||
});
|
});
|
||||||
ipcMain.on("getLangName", async (event) => {
|
|
||||||
event.returnValue = await getLangName();
|
|
||||||
});
|
|
||||||
ipcMain.handle("getSetting", (event, toGet: string) => {
|
ipcMain.handle("getSetting", (event, toGet: string) => {
|
||||||
return getConfig(toGet);
|
return getConfig(toGet);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import {contextBridge, ipcRenderer} from "electron";
|
import {contextBridge, ipcRenderer} from "electron";
|
||||||
import * as path from "path";
|
|
||||||
import {addStyle} from "../utils";
|
|
||||||
import fs from "fs";
|
|
||||||
console.log("ArmCord Settings");
|
console.log("ArmCord Settings");
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("settings", {
|
contextBridge.exposeInMainWorld("settings", {
|
||||||
|
@ -19,7 +16,3 @@ contextBridge.exposeInMainWorld("settings", {
|
||||||
openStorageFolder: () => ipcRenderer.send("openStorageFolder"),
|
openStorageFolder: () => ipcRenderer.send("openStorageFolder"),
|
||||||
copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
|
copyDebugInfo: () => ipcRenderer.send("copyDebugInfo")
|
||||||
});
|
});
|
||||||
if (ipcRenderer.sendSync("getLangName") == "en-US") {
|
|
||||||
const cssPath = path.join(__dirname, "../", "/content/css/settingsEng.css");
|
|
||||||
addStyle(fs.readFileSync(cssPath, "utf8"));
|
|
||||||
}
|
|
||||||
|
|
|
@ -159,8 +159,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div class="switch acTray">
|
<div class="switch acTray">
|
||||||
<select name="trayIcon" id="trayIcon" class="left dropdown">
|
<select name="trayIcon" id="trayIcon" class="left dropdown">
|
||||||
<option value="default">Default (dynamic)</option>
|
<option value="ac_plug_colored">Default</option>
|
||||||
<option value="ac_plug_colored">Plug colored</option>
|
|
||||||
<option value="dsc-tray">Discord Icon</option>
|
<option value="dsc-tray">Discord Icon</option>
|
||||||
<option value="ac_white_plug">White Icon</option>
|
<option value="ac_white_plug">White Icon</option>
|
||||||
<option value="ac_black_plug">Black Icon</option>
|
<option value="ac_black_plug">Black Icon</option>
|
||||||
|
|
|
@ -4,15 +4,12 @@ import {mainWindow} from "./window";
|
||||||
import {getConfig, getConfigLocation, setWindowState} from "./utils";
|
import {getConfig, getConfigLocation, setWindowState} from "./utils";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import {createSettingsWindow} from "./settings/main";
|
import {createSettingsWindow} from "./settings/main";
|
||||||
export let tray: any = null;
|
let tray: any = null;
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
let finishedSetup = await getConfig("doneSetup");
|
let finishedSetup = await getConfig("doneSetup");
|
||||||
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
|
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored";
|
||||||
if (trayIcon = "default") {
|
|
||||||
trayIcon = "dsc-tray"
|
|
||||||
}
|
|
||||||
let trayPath = nativeImage.createFromPath(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
|
let trayPath = nativeImage.createFromPath(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
|
||||||
if (process.platform === "darwin" && trayPath.getSize().height > 22) trayPath = trayPath.resize({height: 22});
|
if (process.platform === "darwin" && trayPath.getSize().height > 22) trayPath = trayIcon.resize({height: 22});
|
||||||
if ((await getConfig("windowStyle")) == "basic") {
|
if ((await getConfig("windowStyle")) == "basic") {
|
||||||
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
var clientName = (await getConfig("clientName")) ?? "ArmCord";
|
||||||
tray = new Tray(trayPath);
|
tray = new Tray(trayPath);
|
||||||
|
|
25
src/utils.ts
25
src/utils.ts
|
@ -45,7 +45,7 @@ export function setup() {
|
||||||
skipSplash: false,
|
skipSplash: false,
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
mobileMode: false,
|
mobileMode: false,
|
||||||
trayIcon: "default",
|
trayIcon: "ac_plug_colored",
|
||||||
doneSetup: false
|
doneSetup: false
|
||||||
};
|
};
|
||||||
setConfigBulk({
|
setConfigBulk({
|
||||||
|
@ -57,9 +57,6 @@ export function setup() {
|
||||||
export var packageVersion = require("../package.json").version;
|
export var packageVersion = require("../package.json").version;
|
||||||
|
|
||||||
export function getVersion() {
|
export function getVersion() {
|
||||||
return packageVersion;
|
|
||||||
}
|
|
||||||
export function getDisplayVersion() {
|
|
||||||
//Checks if the app version # has 4 sections (3.1.0.0) instead of 3 (3.1.0) / Shitty way to check if Kernel Mod is installed
|
//Checks if the app version # has 4 sections (3.1.0.0) instead of 3 (3.1.0) / Shitty way to check if Kernel Mod is installed
|
||||||
if ((app.getVersion() == packageVersion) == false) {
|
if ((app.getVersion() == packageVersion) == false) {
|
||||||
return `${packageVersion} [Kernel Mod]`;
|
return `${packageVersion} [Kernel Mod]`;
|
||||||
|
@ -160,25 +157,7 @@ export async function getLang(object: string) {
|
||||||
return parsed[object];
|
return parsed[object];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function getLangName() {
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
//ArmCord Window State manager
|
//ArmCord Window State manager
|
||||||
export interface WindowState {
|
export interface WindowState {
|
||||||
width: number;
|
width: number;
|
||||||
|
|
|
@ -2,24 +2,15 @@
|
||||||
// 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, dialog, nativeImage} from "electron";
|
import {BrowserWindow, shell, app, dialog} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import {
|
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, setConfig, setLang, setWindowState} from "./utils";
|
||||||
checkIfConfigIsBroken,
|
|
||||||
firstRun,
|
|
||||||
getConfig,
|
|
||||||
contentPath,
|
|
||||||
setConfig,
|
|
||||||
setLang,
|
|
||||||
setWindowState
|
|
||||||
} from "./utils";
|
|
||||||
import {registerIpc} from "./ipc";
|
import {registerIpc} from "./ipc";
|
||||||
import {setMenu} from "./menu";
|
import {setMenu} from "./menu";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import startServer from "./socket";
|
import startServer from "./socket";
|
||||||
import contextMenu from "electron-context-menu";
|
import contextMenu from "electron-context-menu";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import {tray} from "./tray";
|
|
||||||
export var icon: string;
|
export var icon: string;
|
||||||
export let mainWindow: BrowserWindow;
|
export let mainWindow: BrowserWindow;
|
||||||
export let inviteWindow: BrowserWindow;
|
export let inviteWindow: BrowserWindow;
|
||||||
|
@ -87,31 +78,6 @@ async function doAfterDefiningTheWindow() {
|
||||||
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({});
|
return callback({});
|
||||||
});
|
});
|
||||||
if (await getConfig("trayIcon") == "default") {
|
|
||||||
mainWindow.webContents.on("page-favicon-updated", async (event) => {
|
|
||||||
var faviconBase64 = await mainWindow.webContents.executeJavaScript(`
|
|
||||||
var getFavicon = function(){
|
|
||||||
var favicon = undefined;
|
|
||||||
var nodeList = document.getElementsByTagName("link");
|
|
||||||
for (var i = 0; i < nodeList.length; i++)
|
|
||||||
{
|
|
||||||
if((nodeList[i].getAttribute("rel") == "icon")||(nodeList[i].getAttribute("rel") == "shortcut icon"))
|
|
||||||
{
|
|
||||||
favicon = nodeList[i].getAttribute("href");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return favicon;
|
|
||||||
}
|
|
||||||
getFavicon()
|
|
||||||
`)
|
|
||||||
console.log(app.getPath("temp"))
|
|
||||||
var buf = new Buffer(faviconBase64.replace(/^data:image\/\w+;base64,/, ""), 'base64');
|
|
||||||
fs.writeFileSync(path.join(app.getPath("temp"), "/", "tray.png"), buf, "utf-8");
|
|
||||||
let trayPath = nativeImage.createFromPath(path.join(app.getPath("temp"), "/", "tray.png"));
|
|
||||||
if (process.platform === "darwin" && trayPath.getSize().height > 22) trayPath = trayPath.resize({height: 22});
|
|
||||||
tray.setImage(trayPath)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const userDataPath = app.getPath("userData");
|
const userDataPath = app.getPath("userData");
|
||||||
const themesFolder = userDataPath + "/themes/";
|
const themesFolder = userDataPath + "/themes/";
|
||||||
if (!fs.existsSync(themesFolder)) {
|
if (!fs.existsSync(themesFolder)) {
|
||||||
|
@ -207,7 +173,6 @@ export function createCustomWindow() {
|
||||||
frame: false,
|
frame: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
sandbox: false,
|
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
spellcheck: true
|
spellcheck: true
|
||||||
}
|
}
|
||||||
|
@ -224,7 +189,6 @@ export function createNativeWindow() {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
sandbox: false,
|
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
spellcheck: true
|
spellcheck: true
|
||||||
}
|
}
|
||||||
|
@ -242,7 +206,6 @@ export function createInviteWindow() {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
sandbox: false,
|
|
||||||
spellcheck: true
|
spellcheck: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue