miniserve
miniserve copied to clipboard
Switch to `qrcode` lib
As mentioned in #846 , there is a clear mistake but I'm unsure how to fix.
Seems like VSCode auto-sorted Cargo.toml
. Looks okay though.
Please rebase, sorry, I updated some deps. Won't update deps anymore until this is merged.
Also I've noticed an issue in the QR code dropdown menu when run with -q
. Give me some time to fix it. Meanwhile I'll mark this PR as draft.
Hey @cyqsimon, I'd like to cut a new release of miniserve with this in it after I merge the other PRs soon. Do you think you can finish this one up in the coming days? No problem if it's not in the release, just curious.
@svenstaro please go ahead with the release. Life got in the way for me during this past week and I am unable to squeeze out extra time. Sorry about that. I'll try to work on this PR this weekend.
No worries!
Rebased.
Still working on fixing the QR code in the drop-down menu. The previous implementation seems rather jerry-rigged. I'd like to spend some time to do it properly, if I can say so.
Finally I have everything the way I like it. Sorry for the long long wait.
Previously the QR code in the webpage works by having the client send an extra request to the server with the qrcode
param set to the URL, which was very ugly IMO. Now the QR code is generated at once with the rest of the page. The URL is worked out entirely using the info from the request.
Also thanks for the fast_qr
recommendation. It is indeed quite a bit easier to work with than the qrcode
crate. In particular, the ability to set the margin size when building the SVG is very nice. There is however one downside: fast_qr
is much more restrictive than qrcode
when it comes to generating ASCII art. There is no customising the characters used for background/foreground, which makes the previously supported feature of printing an inverted QR code side-by-side basically impossible. That being said, I don't think it's such a deal-breaker, so altogether the benefits outweigh the downsides.
P.s. I did notice some weird artefacting in VScode's integrated terminal. It seems like the background colour was not reset properly by fast_qr
:
... but it's not present in my other terminal emulators (Alacritty, Konsole, Cool Retro Term). Please help me try it out on other terminal emulators if possible.
And finally I think I need some help on writing a test for the webpage QR code. If I understand correctly, the fixtures
crate should be used for this test, but I'm not familiar with the crate at all.
Thanks, this is great!