[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')({
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;

View File

@ -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());

View File

@ -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;
};