Skip to content
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

Add option to display the URL as a QR code #148

Closed
larryw3i opened this issue May 7, 2020 · 7 comments
Closed

Add option to display the URL as a QR code #148

larryw3i opened this issue May 7, 2020 · 7 comments

Comments

@larryw3i
Copy link

larryw3i commented May 7, 2020

Maybe generating qrcode is been needed, it's convenient if get my laptop files just scan the qrcode

image

@tiagostutz
Copy link

tiagostutz commented May 8, 2020

Interesting... for development porpuses this could be really useful.
This could be one of the "View options", right?

What do you think @75lb ?

@75lb
Copy link
Member

75lb commented May 8, 2020

yes, ws --qr would be a useful feature. 👍

Which URL should the QR encode? When you run ws, three URLs are printed: the hostname, local IP and one or more network interface IP addresses.

$ ws
Listening on http://mba4.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000

Which of these URLs should the QR represent? We need to pass in an argument which identifies which URL to display as QR.

$ ws --qr en0
<print QR code for network interface with name 'en0'>

Please implement in lws. You'll need to update the built-in cli-view.

  1. Clone the latest lws code.
  2. Add a list-network-interfaces option here. Make it a boolean flag. OptionDefinition objects are documented here.
  3. At this point, if config.listNetworkInterfaces is set, print value (the address list) to the console so the user can see the network interface names.
  4. Next, add a qr option definition here with type String. The value passed to --vr should be an interface name (the user will first run ws --list-network-interfaces to see the interface names).
  5. At this point, check if config.vr is set. If so, search value (an array of objects) for the object with a name matching the supplied config.vr value. Print a QR code for this object's url value.

@tiagostutz
Copy link

tiagostutz commented May 8, 2020

Nice! I'm going to work on this.

If the user does not pass any argument we could print by default the URL that matches one of the IETF private address because that's probably the address the user is looking for when scanning with an external device that is in the same private (wi-fi) network. Right?

@75lb
Copy link
Member

75lb commented May 8, 2020

Yes, that sounds like a sensible default - using a mobile device on the same LAN is a common use case.

Would that default also work when both your laptop and mobile device are connected to a mobile network? Would be a bonus if so.

@tiagostutz
Copy link

Like the laptop using the mobile as a hotspot, right?
If so, it would work.

@tiagostutz
Copy link

@larryw3i this issue is being built and discussed here lwsjs/lws#13

@75lb 75lb changed the title Generating qrcode is been needed Add option to display the URL as a QR code May 17, 2020
@75lb
Copy link
Member

75lb commented May 17, 2020

Released in v4.1.0. Cheers! 👍

@75lb 75lb closed this as completed May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants