Skip to content

Commit 290d463

Browse files
committed
Speed improvements
1 parent 8d506c0 commit 290d463

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

main.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
const { app, BrowserWindow, Menu, Tray, shell, dialog, clipboard, globalShortcut, nativeTheme, Notification } = require("electron")
2-
const contextmenu = require("electron-context-menu")
1+
const { app, BrowserWindow, Menu, Tray, shell, dialog, clipboard, globalShortcut, nativeTheme, ipcMain: ipc } = require("electron")
32
const logger = require("@levminer/lib/logger/main")
43
const { version, tag } = require("./package.json")
54
const { number, date } = require("./build.json")
65
const remote = require("@electron/remote/main")
7-
const { markdown } = require("@levminer/lib")
8-
const AutoLaunch = require("auto-launch")
96
const debug = require("electron-debug")
10-
const electron = require("electron")
7+
const axios = require("axios").default
118
const path = require("path")
129
const fs = require("fs")
1310
const os = require("os")
14-
const axios = require("axios").default
15-
const ipc = electron.ipcMain
1611

1712
// ? crash report
1813
process.on("uncaughtException", (error) => {
@@ -615,6 +610,9 @@ const createWindow = () => {
615610
}
616611
})
617612

613+
/**
614+
* Show animations and focus searchbar on windows focus
615+
*/
618616
window_application.on("focus", () => {
619617
window_application.webContents.executeJavaScript("focusSearch()")
620618
})
@@ -671,13 +669,17 @@ const createWindow = () => {
671669
}
672670

673671
// ? init auto launch
672+
const AutoLaunch = require("auto-launch")
673+
674674
const authme_launcher = new AutoLaunch({
675675
name: "Authme",
676676
path: app.getPath("exe"),
677677
isHidden: true,
678678
})
679679

680680
// ? context menu
681+
const contextmenu = require("electron-context-menu")
682+
681683
contextmenu({
682684
menu: (actions) => [
683685
actions.separator(),
@@ -948,13 +950,14 @@ ipc.on("abort", () => {
948950
}
949951
})
950952

951-
window_landing.destroy()
952953
window_application.destroy()
953954
window_settings.destroy()
955+
window_import.destroy()
954956
window_export.destroy()
957+
window_edit.destroy()
955958

956959
process.on("uncaughtException", (error) => {
957-
logger.error("Execution aborted", error)
960+
logger.error("Execution aborted", error.stack)
958961
})
959962
})
960963

@@ -1112,6 +1115,8 @@ const about = () => {
11121115

11131116
// ? release notes
11141117
const releaseNotes = () => {
1118+
const { markdown } = require("@levminer/lib")
1119+
11151120
axios
11161121
.get("https://api.levminer.com/api/v1/authme/releases")
11171122
.then((res) => {
@@ -1216,12 +1221,11 @@ app.whenReady()
12161221
})
12171222

12181223
window_splash.loadFile("./app/splash/index.html")
1219-
12201224
window_splash.setProgressBar(10)
12211225

1222-
window_splash.show()
1223-
12241226
window_splash.once("ready-to-show", () => {
1227+
window_splash.show()
1228+
12251229
if (dev === true) {
12261230
setTimeout(() => {
12271231
createWindow()
@@ -1235,11 +1239,11 @@ app.whenReady()
12351239
setTimeout(() => {
12361240
createWindow()
12371241
quickShortcuts()
1238-
}, 2000)
1242+
}, 1500)
12391243

12401244
setTimeout(() => {
12411245
window_splash.destroy()
1242-
}, 2500)
1246+
}, 2000)
12431247
}
12441248
})
12451249

0 commit comments

Comments
 (0)