From 14201fb9cdd44466d35ab0d81573cf26c8984a20 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Sun, 16 Oct 2022 18:41:53 +0200 Subject: [PATCH] fix layout --- app.js | 26 +++++++++++++++++++++++--- html/index.html | 11 ++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 78326a5..53f839d 100644 --- a/app.js +++ b/app.js @@ -2,6 +2,10 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron'); const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main'); const windowManager = require('./ui/windowManager'); const osuUtil = require('./osuUtil'); +const config = require('./config'); +const fs = require('fs'); + +let tempOsuPath; const run = () => { const gotTheLock = app.requestSingleInstanceLock() @@ -9,12 +13,24 @@ const run = () => { app.quit(); return; } + setupTitlebar(); let mainWindow; app.whenReady().then(() => { - mainWindow = createWindow() + mainWindow = createWindow(); + mainWindow.on('show', async () => { + const osuPath = await config.get("osuPath", ""); + if(fs.existsSync(osuPath)){ + tempOsuPath = osuPath; + const osuConfig = await osuUtil.getLatestConfig(tempOsuPath); + console.log(osuConfig); + const lastVersion = await osuConfig.get("LastVersion"); + console.log(lastVersion); + //Do update check + } + }) app.on('activate', function () { if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow(); }) @@ -28,14 +44,18 @@ const run = () => { if (yes.filePaths.length <= 0) return undefined; const folderPath = yes.filePaths[0]; - return osuUtil.isValidOsuFolder(folderPath); + const validOsuDir = osuUtil.isValidOsuFolder(folderPath); + + if (validOsuDir) await config.set("osuPath", folderPath); + + return validOsuDir; }) }) } function createWindow() { // Create the browser window. - const win = windowManager.createWindow(480, 420); + const win = windowManager.createWindow(480, 350); win.loadFile('./html/index.html'); diff --git a/html/index.html b/html/index.html index f623410..d74c9fd 100644 --- a/html/index.html +++ b/html/index.html @@ -17,7 +17,7 @@ -
+
@@ -28,18 +28,19 @@
-
+
EZPPLauncher
-
Launch osu! with connection to the EZPPFarm server
+ type="button" style="background-color:#d6016f" + disabled>Launch
-