fix formatting and linter warnings
This commit is contained in:
parent
c0eb4129ac
commit
60dbbde2af
5 changed files with 38 additions and 31 deletions
|
|
@ -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",
|
||||
|
|
|
|||
4
src/hackfix.d.ts
vendored
Normal file
4
src/hackfix.d.ts
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
declare module "*?asset" {
|
||||
export const assetURL: string;
|
||||
export default assetURL;
|
||||
}
|
||||
21
src/main.ts
21
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 */
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -48,14 +48,18 @@ export function createMainWindow() {
|
|||
height: 720,
|
||||
backgroundColor: "#191919",
|
||||
frame: !config.customFrame,
|
||||
...(config.customFrame && config.customFrameNativeMenu ? {
|
||||
...(config.customFrame && config.customFrameNativeMenu
|
||||
? {
|
||||
// remove the default titlebar
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarStyle: "hidden",
|
||||
// expose window controls in Windows/Linux
|
||||
...(process.platform !== 'darwin' ? {
|
||||
titleBarOverlay: true
|
||||
} : {})
|
||||
} : {}),
|
||||
...(process.platform !== "darwin"
|
||||
? {
|
||||
titleBarOverlay: true,
|
||||
}
|
||||
: {}),
|
||||
}
|
||||
: {}),
|
||||
icon: windowIcon,
|
||||
show: !startHidden,
|
||||
webPreferences: {
|
||||
|
|
@ -158,8 +162,7 @@ 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) {
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue