[Utils > Win] Redo to use only 2 args based on name/type
This commit is contained in:
parent
6ad72b7172
commit
906c09289f
|
@ -1,5 +1,4 @@
|
|||
const { ipcMain, app } = require('electron');
|
||||
const { join } = require('path');
|
||||
|
||||
ipcMain.on('DISCORD_UPDATED_QUOTES', (e, c) => {
|
||||
if (c === 'o') open();
|
||||
|
@ -9,7 +8,7 @@ const open = exports.open = () => {
|
|||
const win = require('../utils/win')({
|
||||
width: 500,
|
||||
height: 650
|
||||
}, join(__dirname, 'preload.js'), 'config');
|
||||
}, 'config');
|
||||
|
||||
let config = settings.get('openasar', {});
|
||||
config.setup = true;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
const { join } = require('path');
|
||||
const { app } = require('electron');
|
||||
|
||||
const moduleUpdater = require("../updater/moduleUpdater");
|
||||
|
@ -68,7 +67,7 @@ const launchSplash = (startMin) => {
|
|||
win = require('../utils/win')({
|
||||
width: 300,
|
||||
height: process.platform === 'darwin' ? 300 : 350
|
||||
}, join(__dirname, 'preload.js'), 'splash');
|
||||
}, 'splash');
|
||||
|
||||
if (process.platform !== 'darwin') win.on('closed', () => !launchedMainWindow && app.quit());
|
||||
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
const { BrowserWindow } = require('electron');
|
||||
|
||||
const paths = require('../paths');
|
||||
const fs = require('fs');
|
||||
|
||||
|
||||
module.exports = (o, preload, u) => {
|
||||
const w = new BrowserWindow({
|
||||
module.exports = (o, n) => {
|
||||
const w = new (require('electron').BrowserWindow)({
|
||||
center: true,
|
||||
frame: false,
|
||||
resizable: false,
|
||||
center: true,
|
||||
backgroundColor: '#2f3136',
|
||||
webPreferences: {
|
||||
preload
|
||||
preload: require('path').join(__dirname, '..', n, 'preload.js')
|
||||
},
|
||||
...o
|
||||
});
|
||||
|
@ -20,11 +14,11 @@ module.exports = (o, preload, u) => {
|
|||
const c = w.webContents;
|
||||
c.once('dom-ready', () => {
|
||||
if (oaConfig.themeSync !== false) try {
|
||||
c.insertCSS(JSON.parse(fs.readFileSync(join(paths.getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS);
|
||||
c.insertCSS(JSON.parse(require('fs').readFileSync(join(require('../paths').getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS);
|
||||
} catch { }
|
||||
});
|
||||
|
||||
w.loadURL('https://cdn.openasar.dev/' + u);
|
||||
w.loadURL('https://cdn.openasar.dev/' + n);
|
||||
|
||||
return w;
|
||||
};
|
Loading…
Reference in New Issue