From 60dbbde2afd06acf993df0a72a2894a7e05af8df Mon Sep 17 00:00:00 2001 From: Amelia Frost Date: Tue, 31 Mar 2026 01:22:15 -0700 Subject: [PATCH] fix formatting and linter warnings --- forge.config.ts | 5 ++--- src/hackfix.d.ts | 4 ++++ src/main.ts | 21 ++++++++++++--------- src/native/tray.ts | 12 +++++------- src/native/window.ts | 27 +++++++++++++++------------ 5 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 src/hackfix.d.ts diff --git a/forge.config.ts b/forge.config.ts index 8392134..cf527ef 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -10,8 +10,7 @@ import { VitePluginBuildConfig } from "@electron-forge/plugin-vite/dist/Config"; import { PublisherGithub } from "@electron-forge/publisher-github"; import type { ForgeConfig } from "@electron-forge/shared-types"; import { FuseV1Options, FuseVersion } from "@electron/fuses"; - -import * as fs from "fs" +import * as fs from "fs"; const STRINGS = { author: "Revolt Platforms LTD", @@ -114,7 +113,7 @@ fs.readdir("avia_core", (err: NodeJS.ErrnoException, files: string[]) => { if (err) return; for (const file of files) { - if (["js", "ts", "tsx"].includes(file.split('.').pop().toLowerCase())) { + if (["js", "ts", "tsx"].includes(file.split(".").pop().toLowerCase())) { customVitePluginBuild.push({ entry: `avia_core/${file}`, config: "vite.main.config.ts", diff --git a/src/hackfix.d.ts b/src/hackfix.d.ts new file mode 100644 index 0000000..3c41417 --- /dev/null +++ b/src/hackfix.d.ts @@ -0,0 +1,4 @@ +declare module "*?asset" { + export const assetURL: string; + export default assetURL; +} diff --git a/src/main.ts b/src/main.ts index 6bcdca5..1620e1d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,6 @@ -import { IUpdateInfo, updateElectronApp } from "update-electron-app"; +import * as fs from "fs"; +import * as path from "path"; +import { updateElectronApp } from "update-electron-app"; import { BrowserWindow, Notification, app, shell } from "electron"; import started from "electron-squirrel-startup"; @@ -9,17 +11,16 @@ import { initDiscordRpc } from "./native/discordRpc"; import { initTray } from "./native/tray"; import { BUILD_URL, createMainWindow, mainWindow } from "./native/window"; -import * as fs from "fs"; -import * as path from "path"; - const applyAppName = () => { try { app.setName("AviaClient"); - (app as any).name = "AviaClient"; + app.name = "AviaClient"; if (process.platform === "win32") { app.setAppUserModelId("AviaClient"); } - } catch {} + } catch { + /* empty */ + } }; if (started) { @@ -32,7 +33,7 @@ if (!config.hardwareAcceleration) { const acquiredLock = app.requestSingleInstanceLock(); -const onNotifyUser = (_info: IUpdateInfo) => { +const onNotifyUser = () => { const notification = new Notification({ title: "Update Available", body: "Restart the app to install the update.", @@ -61,7 +62,7 @@ const loadInject = () => { "aviadesktopversion.js", "customFrameNativeMenu.js", "disableTrayIcon.js", - "clientBackup.js" + "clientBackup.js", ]; for (const plugin of plugins) { @@ -69,7 +70,9 @@ const loadInject = () => { const pluginCode: string = fs.readFileSync(pluginPath, "utf8"); await mainWindow.webContents.executeJavaScript(pluginCode, true); } - } catch {} + } catch { + /* empty */ + } }); }; diff --git a/src/native/tray.ts b/src/native/tray.ts index 792c4e9..bbe86cb 100644 --- a/src/native/tray.ts +++ b/src/native/tray.ts @@ -1,12 +1,10 @@ -import { Menu, Tray, nativeImage, app } from "electron"; +import { Menu, Tray, app, nativeImage } from "electron"; -// eslint-disable-next-line import/no-unresolved import trayIconAsset from "../../avia_assets/icon.png?asset"; -// eslint-disable-next-line import/no-unresolved import macOsTrayIconAsset from "../../avia_assets/iconTemplate.png?asset"; import { version } from "../../package.json"; -import { config } from "./config"; +import { config } from "./config"; import { mainWindow, quitApp } from "./window"; // internal tray state @@ -34,10 +32,10 @@ export function initTray() { config.sync(); if (config.disableTrayClick) { return; } if (mainWindow.isVisible()) { - mainWindow.hide(); + mainWindow.hide(); } else { - mainWindow.show(); - mainWindow.focus(); + mainWindow.show(); + mainWindow.focus(); } }); } diff --git a/src/native/window.ts b/src/native/window.ts index ca2dd9d..5c76156 100644 --- a/src/native/window.ts +++ b/src/native/window.ts @@ -48,14 +48,18 @@ export function createMainWindow() { height: 720, backgroundColor: "#191919", frame: !config.customFrame, - ...(config.customFrame && config.customFrameNativeMenu ? { - // remove the default titlebar - titleBarStyle: 'hidden', - // expose window controls in Windows/Linux - ...(process.platform !== 'darwin' ? { - titleBarOverlay: true - } : {}) - } : {}), + ...(config.customFrame && config.customFrameNativeMenu + ? { + // remove the default titlebar + titleBarStyle: "hidden", + // expose window controls in Windows/Linux + ...(process.platform !== "darwin" + ? { + titleBarOverlay: true, + } + : {}), + } + : {}), icon: windowIcon, show: !startHidden, webPreferences: { @@ -158,9 +162,8 @@ export function createMainWindow() { // on macOS add margin to the title, and hide custom controls // We only use initial values other the menu can disappear - if (process.platform === 'darwin' && - initialCustomFrame && initialCFNM) { - mainWindow.webContents.insertCSS(` + if (process.platform === "darwin" && initialCustomFrame && initialCFNM) { + mainWindow.webContents.insertCSS(` #root > div[style="display: flex; flex-direction: column; height: 100%;"] > div > div.h_29px { &> div.d_flex:first-child { margin-left: 75px; @@ -170,7 +173,7 @@ export function createMainWindow() { } } `); - } + } }); // configure spellchecker context menu