diff --git a/instance/index.html b/instance/index.html index 89eda1f68167fd25e37cdc9eac345dce79c1d6e8..216db049920f9fb59abad24e3bea738306b5001e 100644 --- a/instance/index.html +++ b/instance/index.html @@ -7,7 +7,7 @@ <link rel="stylesheet" href="../style/bootstrap-4.5.2-dist/css/bootstrap.min.css"> <script src="../style/jquery/jquery-3.5.1.js"></script> <script src="../style/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script> - <script src="./index.js"></script> + <script src="./main.js"></script> </head> <body> <div class="card"> diff --git a/instance/index.js b/instance/index.js deleted file mode 100644 index eb0e3e1dfc4a9ffb9d34f89da4d0777685f73e88..0000000000000000000000000000000000000000 --- a/instance/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const {ipcRenderer} = require('electron'); - - -window.onload = function(){ - const closeApp = document.getElementById("closeButton"); - closeApp.addEventListener('click', () => { - ipcRenderer.send('close-app') - }); -} \ No newline at end of file diff --git a/instance/main.js b/instance/main.js index 36f9258ceba31537dd1abef2636b8703279ff063..eb0e3e1dfc4a9ffb9d34f89da4d0777685f73e88 100644 --- a/instance/main.js +++ b/instance/main.js @@ -1,55 +1,9 @@ -const electron = require('electron') -const { app, BrowserWindow } = require('electron') -const {ipcMain} = require('electron') +const {ipcRenderer} = require('electron'); -/** Creates the main window and process for the admin interface - * - */ -function createInstanceWindow () { - // Create the browser window. - const win = new BrowserWindow({ - width: 800, - height: 600, - frame: false, - webPreferences: { - nodeIntegration: true - } - }) - - // and load the index.html of the app. - win.loadFile('instance/index.html'); - -} - -/** Creates the main process for the Express app - * which runs the local server and handles public - * clients - */ -function createExpressClient (){ - const win = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true - } - }); - - win.loadFile('client/index.html'); - - // Useful for debugging, use with "show: true" - //win.webContents.openDevTools(); -} - - - - -ipcMain.on('close-app', (evt, arg) => { - app.quit() -}) - - -app.on('ready', () => { - console.log('Ready'); - createInstanceWindow(); - createExpressClient(); -}); +window.onload = function(){ + const closeApp = document.getElementById("closeButton"); + closeApp.addEventListener('click', () => { + ipcRenderer.send('close-app') + }); +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e62b5dde6188bd480e7653e87434f480e0ab6f9c --- /dev/null +++ b/main.js @@ -0,0 +1,55 @@ +const electron = require('electron') +const { app, BrowserWindow } = require('electron') +const {ipcMain} = require('electron') + + +/** Creates the main window and process for the admin interface + * + */ +function createInstanceWindow () { + // Create the browser window. + const win = new BrowserWindow({ + width: 800, + height: 600, + frame: false, + webPreferences: { + nodeIntegration: true + } + }) + + // and load the index.html of the app. + win.loadFile('instance/index.html'); + +} + +/** Creates the main process for the Express app + * which runs the local server and handles public + * clients + */ +function createExpressClient (){ + const win = new BrowserWindow({ + show: false, + webPreferences: { + nodeIntegration: true + } + }); + + win.loadFile('client/index.html'); + + // Useful for debugging, use with "show: true" + //win.webContents.openDevTools(); +} + + + + +ipcMain.on('close-app', (evt, arg) => { + app.quit() +}) + + +app.on('ready', () => { + console.log('Ready'); + createInstanceWindow(); + createExpressClient(); +}); diff --git a/package.json b/package.json index 1c878c229805690a5e5a57a1463c5972c0194849..cc174ac0e2766328c1a8e00e1b35cb15c8fe0ba5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lektor-app", "version": "0.1.0", - "main": "instance/main.js", + "main": "main.js", "description": "A lektord manipulation tool, an 'instance'", "repository": "git@git.iiens.net:bakaclub/lektor-app.git", "author": "Kubat <mael.martin31@gmail.com>",