Add QR code to comment - #98
Conversation
lredoban
commented
Jan 10, 2025
|
Oh, this is a really good idea. I'm into this. I changed how the comment looks in #97 which will add a bit more space for the image, but I'd still like to make it a bit smaller, plus maybe some sort of size optimisation based on how long the URL is (the example size you've given could probably be smaller for short URLs, maybe it's too small for really big URLs). https://goqr.me/api/ seems to be the operating site for qrserver.com, and their ToS is nonexistent so I'm not comfortable including it in this project. But it could be worth finding an alternative or just generating it on the runner. |
|
You're totally right for qrserver.com, I've made some changes to generate the QR code with https://github.com/unjs/uqr. Let me know if I need to make some changes
|
|
I was taking another look at this... I just don't like the code block presentation, it feels messy to me, even though it results in a functional QR code. I tried braille (https://kbravh.dev/encoding-qr-codes-in-braille) and box-drawing characters (https://brhfl.com/2017/11/qr-codes/) too and I couldn't get anything to look good in a github.qkg1.topment. I found like 50 API services offering a similar thing to goqr.me, and they fall into two camps which are a) free and suspiciously lacking in ToS, b) expensive enough that they're transparently some grifter using a free local generator to make a quick buck. At the end of the day I don't think I trust a single one of them not to eventually replace the images they serve with something terrible that at that point would be out of my control, already hardcoded into thousands of pull requests. That leaves me with two options:
Not sure what the right approach is. But the idea of QR codes in preview comments has been stuck in my head ever since you initially raised this. |
That wasn't too difficult |
|
I think this format works quite well
Passable on mobile, better if the URL isn't just a bunch of numbers, also looks better on the app but not as good as desktop. But if you're on your phone you don't need the qr code anyway. I'm happy with this layout (but feel free to suggest an alternative @anyone reading this) |
