[Utils > Win] Tweak internals

This commit is contained in:
Ducko 2022-04-17 22:52:55 +01:00
parent 8bfca99053
commit 97e4fcf149
3 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@ const open = exports.open = () => {
const win = require('../utils/win')({ const win = require('../utils/win')({
width: 500, width: 500,
height: 650 height: 650
}, join(__dirname, 'preload.js'), 'https://cdn.openasar.dev/config'); }, join(__dirname, 'preload.js'), 'config');
let config = settings.get('openasar', {}); let config = settings.get('openasar', {});
config.setup = true; config.setup = true;

View File

@ -68,7 +68,7 @@ const launchSplash = (startMin) => {
win = require('../utils/win')({ win = require('../utils/win')({
width: 300, width: 300,
height: process.platform === 'darwin' ? 300 : 350 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()); if (process.platform !== 'darwin') win.on('closed', () => !launchedMainWindow && app.quit());

View File

@ -4,8 +4,8 @@ const paths = require('../paths');
const fs = require('fs'); const fs = require('fs');
module.exports = (opts, preload, url) => { module.exports = (o, preload, u) => {
const win = new BrowserWindow({ const w = new BrowserWindow({
center: true, center: true,
frame: false, frame: false,
resizable: false, resizable: false,
@ -14,17 +14,17 @@ module.exports = (opts, preload, url) => {
webPreferences: { webPreferences: {
preload preload
}, },
...opts ...o
}); });
const wc = win.webContents; const c = w.webContents;
wc.once('dom-ready', () => { c.once('dom-ready', () => {
if (oaConfig.themeSync !== false) try { 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 { } } catch { }
}); });
win.loadURL(url); w.loadURL('https://cdn.openasar.dev/' + u);
return win; return w;
}; };