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

QR code presenting server address upon startup for better mobile development experience #13

Closed
tiagostutz opened this issue May 8, 2020 · 8 comments · Fixed by #16
Closed

Comments

@tiagostutz
Copy link
Contributor

Related issue: lwsjs/local-web-server#148

@tiagostutz
Copy link
Contributor Author

Small or Big?

Captura de Tela 2020-05-08 às 15 56 22

@75lb
Copy link
Member

75lb commented May 8, 2020

small.. if the user has a 40x20 terminal window open, the large one won't fit..

tiagostutz added a commit to tiagostutz/lws that referenced this issue May 8, 2020
@tiagostutz
Copy link
Contributor Author

Currently, the behavior is as follows:

  • If the user does not specify the --qr arg, we search for the most suitable private address to use to print the QRCode
  • if the user specifies the --qr arg, we use it to print the QRCode

So, it will always present the QRCode. Maybe we should consider some changes in the args because as the default behavior now is to always print the QRCode, the args should be to hide or configure it. I mean, the user could pass a --no-qr arg to hide it and/or change the used interface using --qr-address (or something like) to specify the network interface.

or

we could keep to --qr using a convention like --qr default automatically choose the privately addressed network interface and if the user does not pass the --qr param the QRCode won't be print.

What do you think?

@75lb
Copy link
Member

75lb commented May 8, 2020

Hi, it should only print the QR code if the user asked for it.

Regular behaviour (no QR):

$ ws

Regular behaviour plus print a QR code with the default network interface:

$ ws --qr

or with a specific interface:

$ ws --qr en1

Does that sound ok?

@tiagostutz
Copy link
Contributor Author

tiagostutz commented May 8, 2020

I tried this at first, but as the —qr is a String param, if there is no arg for it, it will not come in the config object and hence the user won’t be able to pass only —qr. This way, he/she will have to know the network interface...

Maybe —qr auto to leave the system automatically choose the network interface with private IP address could be an option.

Or is there a way to use —qr as String and Boolean flag at the same time that I’m missing?

@75lb
Copy link
Member

75lb commented May 8, 2020

if --qr was specified, you should receive qr: null in the config object (you can can interpret null to mean "use the default interface").

If the qr property does not exist at all on the config object, then --qr was not set. Clear?

@75lb
Copy link
Member

75lb commented May 8, 2020

The documentation for the type property in the option definition specifies that null is returned, if the option was set but no value was passed.. if this is not the case let me know.

@tiagostutz
Copy link
Contributor Author

That's correct. I was making a wrong verification here.
Sorry about that.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants