Giter Club home page Giter Club logo

Comments (11)

svenstaro avatar svenstaro commented on April 27, 2024

Yeah, I think that'd be cool and helpful.

from miniserve.

 avatar commented on April 27, 2024

That's a cool idea. How would we decide on which IP the QR-code would target ? An argument like --qr-code=my.public.ip.address maybe ?

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

Maybe we can figure out the local domain (from /etc/resolv.conf domain) and hostname and construct the full local hostname that way?

from miniserve.

whmountains avatar whmountains commented on April 27, 2024

I think we could borrow a lot from Quair. Specifically local IP address detection and how to display a QR code in the terminal. EDIT: we can't actually copy-paste code because it's MPL2 and miniserve is MIT. But we can see what libraries they use, and things like that. Also maybe the quair developer would like to join forces with us, since they seem to have similar goals.

qrcodegen looks like a great option for generating the SVG version of the code for use in the web interface.

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

Yeah, quair seems really neat. I wish it were a library. The IP stuff seems easy enough.

from miniserve.

H-M-H avatar H-M-H commented on April 27, 2024

There also is https://github.com/kennytm/qrcode-rust which does image, svg and text encoding of QR-codes.

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

We now have a QR code in the HTML. We don't yet have one on the terminal but I'd be open for that option, too.

from miniserve.

wyhaya avatar wyhaya commented on April 27, 2024

@svenstaro

If the user uses the -i option, the content of the QR code should be http://{-i}:{-p}.

If the user does not use the -i option, then search for interfaces, then the content of the QR code should be http://{interface}:{-p}.

Looks like this:

miniserve v0.7.0
Serving path .../miniserve at http://[::]:8080, 
http://127.0.0.1:8080
██████████████      ██  ██████████  ██████████████
██          ██  ██  ██  ██  ██      ██          ██
██  ██████  ██        ██  ██████    ██  ██████  ██
██  ██████  ██  ██        ██  ██    ██  ██████  ██
██  ██████  ██  ██  ██████      ██  ██  ██████  ██
██          ██  ████████      ████  ██          ██
██████████████  ██  ██  ██  ██  ██  ██████████████
                  ██  ██  ████
  ██  ████  ██████████        ██  ██  ██████  ██
██    ██  ██      ████          ██    ████  ██████
██  ████    ██    ██  ██      ██    ██████  ██  ██
██  ██    ██  ██  ██  ██████            ██      ██
██        ████  ██  ████    ████  ██      ██    ██
██████  ████    ██      ████    ██  ██      ██████
████████  ████████████████    ██  ██    ████    ██
████  ████      ████████  ████  ████    ██      ██
      ██    ██    ██    ██  ██████████████  ██  ██
                ████    ██  ██  ██      ██    ████
██████████████  ██  ██  ██      ██  ██  ████  ████
██          ██            ██    ██      ████  ██
██  ██████  ██  ████      ██  ████████████  ████
██  ██████  ██  ████████    ██      ██  ████    ██
██  ██████  ██    ██  ██    ██████          ████
██          ██  ████  ██  ████  ████      ██████
██████████████      ██████  ████    ██████████████
Quit by pressing CTRL-C

It should be noted that how to print the QR code when using multiple -i? Or print multiple QR codes?

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

Hm yeah, I wonder. I think multiple QR codes would be weird. Maybe only print the IPv4 QR code to be safe?

from miniserve.

wyhaya avatar wyhaya commented on April 27, 2024

If only one QR code is printed, then when we run:
miniserve . -i 127.0.0.1 -i 192.168.0.40
What should be the content of the QR code?

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

Haha, good point! Well, maybe it does make a good deal of sense to print one QR code per listening interface, then.

from miniserve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.