diff --git a/assets/ping.png b/assets/ping.png deleted file mode 100644 index 1d0762a..0000000 Binary files a/assets/ping.png and /dev/null differ diff --git a/package.json b/package.json index a49192b..cea8d12 100644 --- a/package.json +++ b/package.json @@ -28,13 +28,13 @@ "devDependencies": { "@types/node": "^17.0.42", "@types/ws": "^8.5.3", - "chalk-cli": "^5.0.0", "copyfiles": "^2.4.1", - "electron": "^20.1.0", + "electron": "^19.0.8", "electron-builder": "^23.0.3", "husky": "^8.0.1", "prettier": "^2.7.0", - "typescript": "^4.7.3" + "typescript": "^4.7.3", + "chalk-cli": "^5.0.0" }, "dependencies": { "electron-context-menu": "github:ArmCord/electron-context-menu", diff --git a/src/content/setup.html b/src/content/setup.html index 14e11de..9a00dd0 100644 --- a/src/content/setup.html +++ b/src/content/setup.html @@ -122,7 +122,7 @@ mods: "cumcord", inviteWebsocket: true, mobileMode: false, - trayIcon: "default", + trayIcon: "ac_plug_colored", performanceMode: "none" }); setTimeout(() => window.armcordinternal.restart(), 5000); @@ -154,7 +154,7 @@ automaticPatches: false, performanceMode: "none", alternativePaste: false, - trayIcon: "default", + trayIcon: "ac_plug_colored", mods: options.mod, inviteWebsocket: true }); @@ -171,7 +171,7 @@ mods: "none", alternativePaste: false, performanceMode: "none", - trayIcon: "default", + trayIcon: "ac_plug_colored", inviteWebsocket: true }); setTimeout(() => window.armcordinternal.restart(), 500); diff --git a/src/ipc.ts b/src/ipc.ts index 21ff712..045314e 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -1,5 +1,5 @@ //ipc stuff -import {app, ipcMain, shell, desktopCapturer,nativeImage} from "electron"; +import {app, ipcMain, shell, desktopCapturer} from "electron"; import {mainWindow} from "./window"; import { setConfigBulk, @@ -12,8 +12,6 @@ import { } from "./utils"; import {customTitlebar} from "./main"; import {createSettingsWindow} from "./settings/main"; -import os from "os"; -import path from "path"; export function registerIpc() { ipcMain.on("get-app-path", (event, arg) => { event.reply("app-path", app.getAppPath()); @@ -27,21 +25,6 @@ export function registerIpc() { ipcMain.on("open-external-link", (event, href: string) => { 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) => { mainWindow.maximize(); }); diff --git a/src/menu.ts b/src/menu.ts index a76e838..f405455 100644 --- a/src/menu.ts +++ b/src/menu.ts @@ -59,13 +59,6 @@ export async function setMenu() { createSettingsWindow(); } }, - { - label: "Reload", - accelerator: "CmdOrCtrl+R", - click: function () { - mainWindow.reload() - } - }, { label: "Quit", accelerator: "CmdOrCtrl+Q", diff --git a/src/preload/bridge.ts b/src/preload/bridge.ts index 1365f1e..3870c4f 100644 --- a/src/preload/bridge.ts +++ b/src/preload/bridge.ts @@ -16,8 +16,6 @@ contextBridge.exposeInMainWorld("armcord", { electron: process.versions.electron, channel: ipcRenderer.sendSync("channel"), setLang: (lang: string) => ipcRenderer.send("setLang", lang), - setPingCount: (pingCount: number) => ipcRenderer.send("setPing", pingCount), - setTrayIcon: (favicon: string) => ipcRenderer.send("sendTrayIcon", favicon), getLang: (toGet: string) => ipcRenderer.invoke("getLang", toGet).then((result) => { return result; diff --git a/src/settings/hummus.html b/src/settings/hummus.html index 010ba50..ba2cfb9 100644 --- a/src/settings/hummus.html +++ b/src/settings/hummus.html @@ -124,8 +124,7 @@
- - + diff --git a/src/tray.ts b/src/tray.ts index bf46cdf..3a0b87f 100644 --- a/src/tray.ts +++ b/src/tray.ts @@ -4,15 +4,12 @@ import {mainWindow} from "./window"; import {getConfig, getConfigLocation, setWindowState} from "./utils"; import * as path from "path"; import {createSettingsWindow} from "./settings/main"; -export let tray: any = null; +let tray: any = null; app.whenReady().then(async () => { let finishedSetup = await getConfig("doneSetup"); var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored"; - if (trayIcon = "default") { - trayIcon = "dsc-tray" - } 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") { var clientName = (await getConfig("clientName")) ?? "ArmCord"; tray = new Tray(trayPath); diff --git a/src/utils.ts b/src/utils.ts index bb802fc..e4e3a71 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -45,7 +45,7 @@ export function setup() { skipSplash: false, inviteWebsocket: true, mobileMode: false, - trayIcon: "default", + trayIcon: "ac_plug_colored", doneSetup: false }; setConfigBulk({ diff --git a/src/window.ts b/src/window.ts index 429a466..c0b12ba 100644 --- a/src/window.ts +++ b/src/window.ts @@ -2,7 +2,7 @@ // 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, nativeImage} from "electron"; +import {BrowserWindow, shell, app, dialog} from "electron"; import path from "path"; import { checkIfConfigIsBroken, @@ -19,7 +19,6 @@ import * as fs from "fs"; import startServer from "./socket"; import contextMenu from "electron-context-menu"; import os from "os"; -import {tray} from "./tray"; export var icon: string; export let mainWindow: BrowserWindow; export let inviteWindow: BrowserWindow; @@ -87,31 +86,6 @@ async function doAfterDefiningTheWindow() { if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true}); 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 themesFolder = userDataPath + "/themes/"; if (!fs.existsSync(themesFolder)) { @@ -207,7 +181,6 @@ export function createCustomWindow() { frame: false, autoHideMenuBar: true, webPreferences: { - sandbox: false, preload: path.join(__dirname, "preload/preload.js"), spellcheck: true } @@ -224,7 +197,6 @@ export function createNativeWindow() { frame: true, autoHideMenuBar: true, webPreferences: { - sandbox: false, preload: path.join(__dirname, "preload/preload.js"), spellcheck: true } @@ -242,7 +214,6 @@ export function createInviteWindow() { frame: true, autoHideMenuBar: true, webPreferences: { - sandbox: false, spellcheck: true } });