server: print multiple qrcodes if multiple network interfaces are available and prevent printing a qrcode for the localhost address
This commit is contained in:
parent
afcd9787db
commit
a93d27f08e
2 changed files with 23 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Changelog
|
||||
|
||||
## 1.23.1
|
||||
## 1.24.0
|
||||
|
||||
- bug fixes
|
||||
- widgets: circular value feedback issues
|
||||
|
|
@ -14,6 +14,9 @@
|
|||
- custom module
|
||||
- add optional `errorCallback` argument to`loadJSON` and `saveJSON`
|
||||
|
||||
- server
|
||||
- print multiple qrcodes if multiple network interfaces are available and prevent printing a qrcode for the localhost address
|
||||
|
||||
- misc
|
||||
- add linux rpm packages
|
||||
|
||||
|
|
|
|||
|
|
@ -86,17 +86,27 @@ function openClient() {
|
|||
|
||||
function showQRCode(){
|
||||
|
||||
var QRCode = require('qrcode')
|
||||
var QRCode = require('qrcode'),
|
||||
addresses = settings.appAddresses().filter(a=>!a.includes('127.0.0.1') && !a.includes('localhost'))
|
||||
|
||||
if (launcher) {
|
||||
QRCode.toString(settings.appAddresses().pop(),{type:'svg', small: true, margin: 1}, (err, qr)=>{
|
||||
launcher.webContents.send('stdout', '<div class="qrcode">' + qr + '</div>')
|
||||
})
|
||||
} else {
|
||||
QRCode.toString(settings.appAddresses().pop(),{type:'terminal', small: true}, (err, qr)=>{
|
||||
console.log('\n' + qr.replace(/^/gm, ' '))
|
||||
})
|
||||
for (var add of addresses) {
|
||||
if (launcher) {
|
||||
QRCode.toString(add,{type:'svg', small: true, margin: 1}, (err, qr)=>{
|
||||
launcher.webContents.send('stdout', '<div class="qrcode">' + qr + '</div>')
|
||||
})
|
||||
if (addresses.length > 1) {
|
||||
launcher.webContents.send('stdout', '(' + add + ')')
|
||||
}
|
||||
} else {
|
||||
QRCode.toString(add,{type:'terminal', small: true}, (err, qr)=>{
|
||||
console.log('\n' + qr.replace(/^/gm, ' '))
|
||||
})
|
||||
if (addresses.length > 1) {
|
||||
console.log(' (' + add + ')')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function startServerProcess() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue