miniserve icon indicating copy to clipboard operation
miniserve copied to clipboard

Switch to `qrcode` lib

Open cyqsimon opened this issue 2 years ago • 3 comments

As mentioned in #846 , there is a clear mistake but I'm unsure how to fix.

cyqsimon avatar Jul 20 '22 09:07 cyqsimon

Seems like VSCode auto-sorted Cargo.toml. Looks okay though.

cyqsimon avatar Jul 20 '22 09:07 cyqsimon

Please rebase, sorry, I updated some deps. Won't update deps anymore until this is merged.

svenstaro avatar Jul 22 '22 16:07 svenstaro

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.

cyqsimon avatar Jul 26 '22 07:07 cyqsimon

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 avatar Aug 11 '22 03:08 svenstaro

@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.

cyqsimon avatar Aug 11 '22 10:08 cyqsimon

No worries!

svenstaro avatar Aug 11 '22 11:08 svenstaro

Rebased.

cyqsimon avatar Aug 22 '22 10:08 cyqsimon

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.

cyqsimon avatar Aug 22 '22 10:08 cyqsimon

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: flameshot-20220901-203755 ... 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.

cyqsimon avatar Sep 01 '22 12:09 cyqsimon

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.

cyqsimon avatar Sep 01 '22 12:09 cyqsimon

Thanks, this is great!

svenstaro avatar Sep 18 '22 03:09 svenstaro