freechat/freechat-client/main.js
shockrah 8e6c90b3c4 Removing superflous css in some jquery
 Messages now has its own properly named type exposed for other modules to use if it's required
 New jquery calls in messages to actually populate the message box with the last 48 hours worth of messages
2021-03-05 17:48:59 -08:00

63 lines
1.4 KiB
JavaScript

const { ipcMain } = require('electron')
const { app, BrowserWindow } = require('electron')
const path = require('path')
const cfg = require('./src/config.js')
let win
let config = cfg.get_config(cfg.load_parser())
// NOTE: this line is only here for demonstration as the current make script exposes this var
// so that we can test against self signed certificates but still use ssl
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = '0'
function createWin() {
win = new BrowserWindow({
width: 800,
height: 600,
minWidth: 640,
minHeight: 480,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname + '/preload.js')
},
autoHideMenuBar: true,
})
win.loadFile('pages/index.html');
win.on('closed', () => {
win = null
});
}
app.on('ready', createWin);
// on mac just because the windows are closed doesn't mean the application is too
// ! The toolbar keeps things alive against its will
app.on('window-all-closed', () => {
if(process.platform !== 'darwin') {
app.quit()
}
});
app.on('activate', () => {
if(win === null) {
createWin();
load_config('./example-dev-config.json'); // for now
}
});
// returns the config
ipcMain.on('config-request', (event, _arg) => {
event.returnValue = config
})
ipcMain.on('config-update', (event, data, target) => {
config = data // update in-memory config-file first
cfg.update_config(data, target)
})