diff --git a/index.html b/index.html
index 173089c..3c43cf5 100644
--- a/index.html
+++ b/index.html
@@ -27,6 +27,7 @@
+
diff --git a/main.js b/main.js
index a8f7f6d..57ab437 100644
--- a/main.js
+++ b/main.js
@@ -1,11 +1,4 @@
-const {
- app,
- BrowserWindow,
- Menu,
- ipcMain,
- nativeTheme,
- dialog,
-} = require('electron');
+const { app, BrowserWindow, Menu, ipcMain, nativeTheme, dialog } = require('electron');
const { autoUpdater } = require('electron-updater');
const path = require('path');
@@ -16,6 +9,7 @@ let autoUpdate = false;
let manualUpdateCheck = false;
let menuObj;
let mainWindow;
+let networkInfoWindow;
const menuTemplate = [
...(isMac ? [{ role: 'appMenu' }] : []),
@@ -95,10 +89,7 @@ const menuTemplate = [
id: 'devicePin',
enabled: false,
click(menuItem, window, event) {
- mainWindow.webContents.send(
- 'setActiveDevicePinned',
- menuItem.checked
- );
+ mainWindow.webContents.send('setActiveDevicePinned', menuItem.checked);
},
},
{
@@ -166,6 +157,18 @@ const windowWin = {
},
};
+const networkInfoWin = {
+ width: 700,
+ height: 350,
+ backgroundColor: '#333333',
+ show: false,
+ webPreferences: {
+ contextIsolation: false,
+ nodeIntegration: true,
+ preload: path.join(__dirname, 'networkInterfaces.js'),
+ },
+};
+
if (isWin) {
app.setAppUserModelId(app.name);
}
@@ -236,13 +239,19 @@ ipcMain.on('setAutoUpdate', (event, _autoUpdate) => {
autoUpdate = _autoUpdate;
// update menu item for enabling/disabling auto update
- menuTemplate[menuTemplate.length - 1].submenu[2].label = autoUpdate
- ? 'Disable Auto Update'
- : 'Enable Auto Update';
+ menuTemplate[menuTemplate.length - 1].submenu[2].label = autoUpdate ? 'Disable Auto Update' : 'Enable Auto Update';
menuObj = Menu.buildFromTemplate(menuTemplate);
Menu.setApplicationMenu(menuObj);
});
+ipcMain.on('openNetworkInfoWindow', (event, arg) => {
+ if (!networkInfoWindow || (networkInfoWindow && networkInfoWindow.isDestroyed())) {
+ networkInfoWindow = new BrowserWindow(networkInfoWin);
+ networkInfoWindow.loadFile('networkInterfaces.html');
+ }
+ networkInfoWindow.show();
+});
+
// this can be set to true to bypass the download update dialog and skip straight to install prompt
autoUpdater.autoDownload = false;
diff --git a/networkInterfaces.html b/networkInterfaces.html
new file mode 100644
index 0000000..c9f0a6a
--- /dev/null
+++ b/networkInterfaces.html
@@ -0,0 +1,86 @@
+
+
+
Network Information
+
+
+
+
Attached Network Interfaces:
+
+
+
+ | ID |
+ IP Address |
+ Subnet Mask |
+ Searchable Addresses |
+
+
+
+
+
diff --git a/networkInterfaces.js b/networkInterfaces.js
new file mode 100644
index 0000000..9551fc7
--- /dev/null
+++ b/networkInterfaces.js
@@ -0,0 +1,20 @@
+const SEARCH = require('./src/search.js');
+
+window.init = function init() {
+ const networkInterfaces = SEARCH.getNetworkInterfaces();
+ let html = '';
+
+ for (let i = 0; i < Object.keys(networkInterfaces).length; i++) {
+ const interfaceID = Object.keys(networkInterfaces)[i];
+ const interfaceObj = networkInterfaces[interfaceID];
+ console.log(interfaceObj);
+
+ html += `
| ${interfaceID} | `;
+ html += `${interfaceObj[0].address} | `;
+ html += `${interfaceObj[0].netmask} | `;
+ html += `${interfaceObj[0].firstSearchAddress} - ${interfaceObj[0].lastSearchAddress} | `;
+ html += `
`;
+
+ document.getElementById('network-interfaces').innerHTML = html;
+ }
+};
diff --git a/preload.js b/preload.js
index c29576b..11937c8 100644
--- a/preload.js
+++ b/preload.js
@@ -106,6 +106,11 @@ window.init = function init() {
SAVESLOTS.saveAll();
};
+ document.getElementById('network-info-button').onclick = function fooBar(e) {
+ ipcRenderer.send('openNetworkInfoWindow');
+ console.log('FOO');
+ };
+
document.onkeyup = function keyUp(e) {
if (e.key === 'ArrowUp') {
VIEW.selectPreviousDevice();
diff --git a/src/img/outline_info_white_18dp.png b/src/img/outline_info_white_18dp.png
new file mode 100644
index 0000000..b4ad5dd
Binary files /dev/null and b/src/img/outline_info_white_18dp.png differ
diff --git a/src/index.css b/src/index.css
index ab27245..127ed43 100644
--- a/src/index.css
+++ b/src/index.css
@@ -27,6 +27,9 @@ a {
.left {
float: left;
}
+.right {
+ float: right;
+}
#main {
box-sizing: border-box;
@@ -133,7 +136,7 @@ a {
/* position: absolute;
bottom: 210px;
left: 0px;*/
- width: 100%;
+ width: 262px;
height: 30px;
padding-right: 10px;
/*background: linear-gradient(#2f2f2f 0%, #2c2c2c 100%);*/
diff --git a/src/search.js b/src/search.js
index 3d94c0f..57fe5da 100644
--- a/src/search.js
+++ b/src/search.js
@@ -28,6 +28,8 @@ function getServers() {
const last = ip.toLong(subnet.lastAddress) - 1;
// console.log(`range ${subnet.firstAddress} - ${subnet.lastAddress}`);
address.broadcastAddress = subnet.broadcastAddress;
+ address.firstSearchAddress = subnet.firstAddress;
+ address.lastSearchAddress = subnet.lastAddress;
if (!validInterfaces[key]) {
validInterfaces[key] = [];