From 97e4fcf1495b8225df4bd692bb31cae53296d980 Mon Sep 17 00:00:00 2001 From: Oj Date: Sun, 17 Apr 2022 22:52:55 +0100 Subject: [PATCH] [Utils > Win] Tweak internals --- src/config/index.js | 2 +- src/splash/index.js | 2 +- src/utils/win.js | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config/index.js b/src/config/index.js index 78c4a14..1676e88 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -9,7 +9,7 @@ const open = exports.open = () => { const win = require('../utils/win')({ width: 500, height: 650 - }, join(__dirname, 'preload.js'), 'https://cdn.openasar.dev/config'); + }, join(__dirname, 'preload.js'), 'config'); let config = settings.get('openasar', {}); config.setup = true; diff --git a/src/splash/index.js b/src/splash/index.js index 0e0ca35..418492c 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -68,7 +68,7 @@ const launchSplash = (startMin) => { win = require('../utils/win')({ width: 300, height: process.platform === 'darwin' ? 300 : 350 - }, join(__dirname, 'preload.js'), 'https://cdn.openasar.dev/splash'); + }, join(__dirname, 'preload.js'), 'splash'); if (process.platform !== 'darwin') win.on('closed', () => !launchedMainWindow && app.quit()); diff --git a/src/utils/win.js b/src/utils/win.js index 5760092..4963a3c 100644 --- a/src/utils/win.js +++ b/src/utils/win.js @@ -4,8 +4,8 @@ const paths = require('../paths'); const fs = require('fs'); -module.exports = (opts, preload, url) => { - const win = new BrowserWindow({ +module.exports = (o, preload, u) => { + const w = new BrowserWindow({ center: true, frame: false, resizable: false, @@ -14,17 +14,17 @@ module.exports = (opts, preload, url) => { webPreferences: { preload }, - ...opts + ...o }); - const wc = win.webContents; - wc.once('dom-ready', () => { + const c = w.webContents; + c.once('dom-ready', () => { if (oaConfig.themeSync !== false) try { - wc.insertCSS(JSON.parse(fs.readFileSync(join(paths.getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS); + c.insertCSS(JSON.parse(fs.readFileSync(join(paths.getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS); } catch { } }); - win.loadURL(url); + w.loadURL('https://cdn.openasar.dev/' + u); - return win; + return w; }; \ No newline at end of file