-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added QR Code for public IP #738
base: master
Are you sure you want to change the base?
Conversation
This is interesting, I would never have thought of this! Some concerns:
|
I really appreciate you taking time and reviewing this.
|
I have changed the qrcode package to qrcode-terminal which has around 87% less size. |
I like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to add the new option to doc/http-sever.1
as well
Updated doc/http-server.1 to add --qr-code option Updated portfinder to 1.0.28
So, all the tests are failing in the same way, but without an obvious error message that I can see :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, looks like another package-lock conflict. npm is going crazy changing that differently for everyone lately, so every merge seems to conflict with something
Fixed failing tests Removed -Q option for showQR option
@@ -227,6 +229,7 @@ function listen(port) { | |||
Object.keys(ifaces).forEach(function (dev) { | |||
ifaces[dev].forEach(function (details) { | |||
if (details.family === 'IPv4') { | |||
plainIp = protocol + details.address + ':' + port.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized, this is inside a loop! So it'll only be making a code for the last IP, which is usually the public IP, but I don't believe that's guaranteed. Some thoughts, and I welcome yours:
- We could make a code for each IP (would get to be a lot)
- We could print out which IP is linked next to/under/above the QR code as a label
- I don't even know what else right now, I'm sure there are more options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am out of ideas right now.
But I like the one's you proposed
I'm all onboard with either. We can use device identifier (like --qr-code lo
or --qr-code wlp3s0
) or index (like --qr-code 0
for local and --qr-code 1
, --qr-code 2
... for public) if we are going with that.
Or maybe the other one where we can print IP next to QR. But I have some concerns with this one as this won't give an option for local IP and if we try to make QR for all IPs that will fill up the screen quickly. Personally I like the info as clean as it was with addition of QR optionally.
What are your suggestions?
Please ensure that your pull request fulfills these requirements:
master
branchWhat is the purpose of this pull request? (bug fix, enhancement, new feature,...)
Added a feature to display QR code public IP in the terminal for ease of sharing IP.
What changes did you make?
Fetched the public IP (latter one in the IP list) and used qrcode package to display the qr in the terminal.
Provide some example code that this change will affect, if applicable:
Is there anything you'd like reviewers to focus on?
Usability and ease of sharing IP to other devices in network.
Please provide testing instructions, if applicable:
The library provides the QR code in string format which can be used for testing/display in terminal.