From ef6f6580df6e8fbce913eecc1fe7e0f8caf1315b Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Mon, 22 May 2023 22:33:19 +0200 Subject: Update electron version to v14.2.9 (#2214) Authored-by: rejbasket Co-authored-by: Kaalleen Co-authored-by: Lex Neva --- electron/service/utils/getLocalIP.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 electron/service/utils/getLocalIP.js (limited to 'electron/service/utils/getLocalIP.js') diff --git a/electron/service/utils/getLocalIP.js b/electron/service/utils/getLocalIP.js new file mode 100644 index 00000000..14926ee2 --- /dev/null +++ b/electron/service/utils/getLocalIP.js @@ -0,0 +1,17 @@ +'use strict' + +const os = require('os') + +module.exports = function getLocalIP() { + const interfaces = os.networkInterfaces() + + for (const devName in interfaces) { + const iface = interfaces[devName] + for (let i = 0; i < iface.length; i++) { + const alias = iface[i] + if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) { + return alias.address + } + } + } +} -- cgit v1.2.3