OpenAsar/src/utils/win.js

24 lines
No EOL
639 B
JavaScript

module.exports = (o, n) => {
const w = new (require('electron').BrowserWindow)({
center: true,
frame: false,
resizable: false,
center: true,
backgroundColor: '#2f3136',
webPreferences: {
preload: require('path').join(__dirname, '..', n, 'preload.js')
},
...o
});
const c = w.webContents;
c.once('dom-ready', () => {
if (oaConfig.themeSync !== false) try {
c.insertCSS(JSON.parse(require('fs').readFileSync(join(require('../paths').getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS);
} catch { }
});
w.loadURL('https://cdn.openasar.dev/' + n);
return w;
};