From c1d8582ab86992fd2a871c6ae2cc60918e4f7313 Mon Sep 17 00:00:00 2001 From: Aiden Date: Sat, 14 Sep 2024 22:31:15 -0400 Subject: [PATCH] prune things I don't want --- electron.vite.config.js | 4 +- eslint.config.js | 2 +- package.json | 1 - pnpm-lock.yaml | 92 +++++++++++++++++++++++++------ src/@types/config.d.ts | 1 - src/main/discord/discordWindow.ts | 2 +- src/main/tray.ts | 9 ++- src/renderer/index.html | 0 src/renderer/index.ts | 0 src/shared/config.ts | 1 - 10 files changed, 85 insertions(+), 27 deletions(-) delete mode 100644 src/renderer/index.html delete mode 100644 src/renderer/index.ts diff --git a/electron.vite.config.js b/electron.vite.config.js index 820e469..135f6ad 100644 --- a/electron.vite.config.js +++ b/electron.vite.config.js @@ -1,3 +1,4 @@ +// @ts-check import { defineConfig } from "electron-vite"; export default defineConfig(() => { @@ -10,9 +11,6 @@ export default defineConfig(() => { entry: "src/preload/preload.mts", } } - }, - renderer: { - } } }) \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index ef95d14..0ba07fd 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,7 +12,7 @@ export default tseslint.config( languageOptions: { parserOptions: { project: true, - tsconfigRootDir: import.meta.dirname + tsconfigRootDir: "./tsconfig.json" } }, rules: { diff --git a/package.json b/package.json index e1de0e5..f488a95 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "electron-builder": "^25.0.5", "electron-vite": "^2.3.0", "eslint": "^9.10.0", - "eslint-config-prettier": "^9.1.0", "prettier": "^3.3.3", "typescript": "^5.6.2", "typescript-eslint": "^8.5.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e0fbcb..28117f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,13 +22,10 @@ importers: version: 25.0.5(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)) electron-vite: specifier: ^2.3.0 - version: 2.3.0(vite@5.4.5(@types/node@22.5.5)) + version: 2.3.0(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)) eslint: specifier: ^9.10.0 version: 9.10.0 - eslint-config-prettier: - specifier: ^9.1.0 - version: 9.1.0(eslint@9.10.0) prettier: specifier: ^3.3.3 version: 3.3.3 @@ -645,6 +642,10 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + app-builder-bin@5.0.0-alpha.7: resolution: {integrity: sha512-ww2mK4ITUvqisnqOuUWAeHzokpPidyZ7a0ZkwW+V7sF5/Pdi2OldkRjAWqEzn6Xtmj3SLVT84as4wB59A6jJ4g==} @@ -706,6 +707,10 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} @@ -780,6 +785,10 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + chownr@2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} @@ -1035,12 +1044,6 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - eslint-scope@8.0.2: resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1313,6 +1316,9 @@ packages: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} + immutable@4.3.7: + resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==} + import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -1339,6 +1345,10 @@ packages: resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==} engines: {node: '>= 12'} + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + is-ci@3.0.1: resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} hasBin: true @@ -1789,6 +1799,10 @@ packages: readdir-glob@1.1.3: resolution: {integrity: sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==} + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -1848,6 +1862,11 @@ packages: sanitize-filename@1.6.3: resolution: {integrity: sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==} + sass@1.78.0: + resolution: {integrity: sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==} + engines: {node: '>=14.0.0'} + hasBin: true + sax@1.4.1: resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} @@ -2779,6 +2798,12 @@ snapshots: ansi-styles@6.2.1: {} + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + optional: true + app-builder-bin@5.0.0-alpha.7: {} app-builder-lib@25.0.5(dmg-builder@25.0.5(electron-builder-squirrel-windows@25.0.5))(electron-builder-squirrel-windows@25.0.5(dmg-builder@25.0.5)): @@ -2881,6 +2906,9 @@ snapshots: base64-js@1.5.1: {} + binary-extensions@2.3.0: + optional: true + bl@4.1.0: dependencies: buffer: 5.7.1 @@ -3005,6 +3033,19 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 + chokidar@3.6.0: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + optional: true + chownr@2.0.0: {} chromium-pickle-js@0.2.0: {} @@ -3226,7 +3267,7 @@ snapshots: electron-to-chromium@1.5.23: {} - electron-vite@2.3.0(vite@5.4.5(@types/node@22.5.5)): + electron-vite@2.3.0(vite@5.4.5(@types/node@22.5.5)(sass@1.78.0)): dependencies: '@babel/core': 7.25.2 '@babel/plugin-transform-arrow-functions': 7.24.7(@babel/core@7.25.2) @@ -3234,7 +3275,7 @@ snapshots: esbuild: 0.21.5 magic-string: 0.30.11 picocolors: 1.1.0 - vite: 5.4.5(@types/node@22.5.5) + vite: 5.4.5(@types/node@22.5.5)(sass@1.78.0) transitivePeerDependencies: - supports-color @@ -3306,10 +3347,6 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@9.1.0(eslint@9.10.0): - dependencies: - eslint: 9.10.0 - eslint-scope@8.0.2: dependencies: esrecurse: 4.3.0 @@ -3658,6 +3695,9 @@ snapshots: ignore@5.3.2: {} + immutable@4.3.7: + optional: true + import-fresh@3.3.0: dependencies: parent-module: 1.0.1 @@ -3681,6 +3721,11 @@ snapshots: jsbn: 1.1.0 sprintf-js: 1.1.3 + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + optional: true + is-ci@3.0.1: dependencies: ci-info: 3.9.0 @@ -4113,6 +4158,11 @@ snapshots: dependencies: minimatch: 5.1.6 + readdirp@3.6.0: + dependencies: + picomatch: 2.3.1 + optional: true + require-directory@2.1.1: {} resedit@1.7.1: @@ -4186,6 +4236,13 @@ snapshots: dependencies: truncate-utf8-bytes: 1.0.2 + sass@1.78.0: + dependencies: + chokidar: 3.6.0 + immutable: 4.3.7 + source-map-js: 1.2.1 + optional: true + sax@1.4.1: {} semver-compare@1.0.0: @@ -4398,7 +4455,7 @@ snapshots: extsprintf: 1.4.1 optional: true - vite@5.4.5(@types/node@22.5.5): + vite@5.4.5(@types/node@22.5.5)(sass@1.78.0): dependencies: esbuild: 0.21.5 postcss: 8.4.47 @@ -4406,6 +4463,7 @@ snapshots: optionalDependencies: '@types/node': 22.5.5 fsevents: 2.3.3 + sass: 1.78.0 wcwidth@1.0.1: dependencies: diff --git a/src/@types/config.d.ts b/src/@types/config.d.ts index 31ed10e..f35d10f 100644 --- a/src/@types/config.d.ts +++ b/src/@types/config.d.ts @@ -3,6 +3,5 @@ export interface Config { channel: "stable" | "ptb" | "canary"; multiInstance: boolean; mods: "vencord"[]; - autoHideMenuBar: boolean; tray: boolean; } diff --git a/src/main/discord/discordWindow.ts b/src/main/discord/discordWindow.ts index 8bcce8d..ea7a346 100644 --- a/src/main/discord/discordWindow.ts +++ b/src/main/discord/discordWindow.ts @@ -9,7 +9,7 @@ export async function createDiscordWindow() { preload: join(import.meta.dirname, "../preload/preload.mjs"), nodeIntegration: true }, - autoHideMenuBar: getConfig("autoHideMenuBar") + autoHideMenuBar: true }); const channel = getConfig("channel"); diff --git a/src/main/tray.ts b/src/main/tray.ts index 20dc3a9..5c687b9 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -2,6 +2,7 @@ import {app, Menu, nativeImage, Tray, type WebContents} from "electron"; import icon from "../../resources/placeholderTrayIcon.png?asset"; export function startTray(pageData: WebContents) { + // Strange ESLint and TSC fighting here // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion const tray = new Tray(icon as string); tray.setToolTip("Acorn"); @@ -17,9 +18,13 @@ export function startTray(pageData: WebContents) { ); pageData.on("page-favicon-updated", (_, favicons) => { try { - tray.setImage(nativeImage.createFromDataURL(favicons[0]!)); + let favicon = nativeImage.createFromDataURL(favicons[0]!); + if (process.platform === "win32") { + favicon = favicon.resize({height: 32}); // Windows scaling disaster + } + tray.setImage(favicon); } catch { - return; // NOTE - Discord will send a URL before fully loaded + return; // Discord will send a URL before fully loaded } }); } diff --git a/src/renderer/index.html b/src/renderer/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/src/renderer/index.ts b/src/renderer/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/shared/config.ts b/src/shared/config.ts index 51f9a58..4840254 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -10,7 +10,6 @@ function makeConfig() { channel: "stable", multiInstance: false, mods: ["vencord"], - autoHideMenuBar: true, tray: true } as Config; writeFileSync(configLocation, JSON.stringify(config, null, 2), {encoding: "utf8", flag: "w"});