forked from cdgco/01V-Web-Controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
window2.js
40 lines (31 loc) · 1.09 KB
/
window2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var address, os = require('os'),
ifaces = os.networkInterfaces();
const { ipcMain, BrowserWindow, app, dialog } = require('electron')
for (var dev in ifaces) {
var iface = ifaces[dev].filter(function(details) {
return details.family === 'IPv4' && details.internal === false;
});
if (iface.length > 0) address = iface[0].address;
}
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const port = urlParams.get('port')
var remoteControl = address + ":" + port;
$("#address-output").val(remoteControl);
document.getElementById('openButton').addEventListener('click', (evt) => {
createBrowserWindow();
});
function createBrowserWindow() {
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
const win = new BrowserWindow({
height: 576,
width: 1024,
minHeight: 450,
minWidth: 900,
webPreferences: { devTools: false },
icon: 'assets/homescreen512.png'
});
win.setMenuBarVisibility(false)
win.loadURL('http://' + remoteControl);
}