-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
28 lines (24 loc) · 1.02 KB
/
preload.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
const ip = require('ip');
const { ipcRenderer } = require('electron');
window.addEventListener('DOMContentLoaded', () => {
let openweb = document.getElementById("openweb");
openweb.href = "http://"+ip.address()+":3000";
openweb.addEventListener('click', event => {
event.preventDefault();
require("electron").shell.openExternal(event.target.href);
});
let openinstall = document.getElementById("openinstall");
openinstall.href = "http://"+ip.address()+":3000/install";
openinstall.addEventListener('click', event => {
event.preventDefault();
require("electron").shell.openExternal(event.target.href);
});
let weburl = document.getElementById("weburl");
weburl.innerHTML = "http://"+ip.address()+":3000";
const version = document.getElementById('version');
ipcRenderer.send('app_version');
ipcRenderer.on('app_version', (event, arg) => {
ipcRenderer.removeAllListeners('app_version');
version.innerText = 'Version ' + arg.version;
});
})