openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.23k stars 2.49k forks source link

luci-mod-network: Share WiFi access credential with QRcode #2433

Open pgaufillet opened 5 years ago

pgaufillet commented 5 years ago

Hi LuCI team!

It would be great if the Wifi module of LuCI could display a QRcode for sharing Wifi credentials. See Qifi for example.

Thanks for your great job!

leonghui commented 5 years ago

Interesting suggestion. Instead of Javascript, qrencode is currently used by 3 LuCI packages to generate QR codes:

greyltc commented 5 years ago

This would be great. Android Q and above has joining wifi via qr code baked into the os in a prominent way.

feckert commented 5 years ago

What format/config file should the QR-Code have?

WIFI:S:\<ssid>;T:\<encryption>;P:\<password>;H:\<hide>

plm commented 4 years ago

Travelmate has an example of the qrencode arguments required to generate a QR code for the Wifi credentials.

hmh commented 3 years ago

This would be great. Android Q and above has joining wifi via qr code baked into the os in a prominent way.

Also iOS 11+, in the built-in camera application.

OW87 commented 2 years ago

I would also like to see this feature for the Wifi networks.

If we could add a QR Code on the line for every wifi like this and it pop when we click on it : image

@feckert : Are you working on this feature ? Thank you.

jonathan-annett commented 2 years ago

If it helps the luci developers, here is a simple page i wrote for creating QR codes (it uses a few libs - it's pure javascript, happens client side in browser )

you might need to host these on the router so i'm not sure if size constraints prevent using this approach.

I don't suggest you use it like this for security reasons but a working sample QR can be generated by appending a string to the url https://qr.1mb.site/?code= : sample link

To implement it in the luci ui, have a look at this source https://qr.1mb.site/index.js (it parses the passed in url as a string and displays it verbatim. wifi QR codes have a specific syntax, which you can see after "code=" in the url - which for simplity in this demo isn't urlencoded. as you'll be generating it locally in the browser url encoding is irrelevant, i mention it here as obviously complex passwords can't be demoed via this generic site without url ecoding)

the specific syntax for the qr to pass into the library function is documented here however for a wpa2 protected ssid it is basically WIFI:S:ssid;T:WPA;P:password;;

in a nutshell, i'm pulling in a few files via a cdn:

https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js - link - info - github

https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js - link - library used by qrcode - info

and calling them from index.js

hmh commented 2 years ago

fwknock support already generates QRcodes from within Luci, whatever is done should be shared between the two packages for space savings.