-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added qr code generation #104
Conversation
@@ -166,6 +167,10 @@ function onTorrent (torrent) { | |||
'<a href="' + torrent.magnetURI + '" target="_blank">[Magnet URI]</a> ' + | |||
'<a href="' + torrent.torrentFileBlobURL + '" target="_blank" download="' + torrentFileName + '">[Download .torrent]</a>' | |||
) | |||
|
|||
util.log( | |||
'QR Code: <img class="qr" src="data:image/png;base64,' + qr.imageSync(location.href + '#' + torrent.infoHash, { type: 'png' }).toString('base64') + '">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small bug: If there's already a hash in the URL, this will add a second one.
You don't need to commit the |
One thing that's a bit of a bummer is that this single dependency almost doubles the size of the JS bundle.
|
Other than my comments, this looks good! If you know another dependency that's a bit lighter weight than this, let's swap it in. |
Actually that js file shouldn't even be there. My bad. That was for another
|
No problem if you can't find one. We can still merge this. But there's no way that QR generation can require that much code. |
It looks like most of the size of |
Woops, forgot this was here. I'll take care of this and fix what needs to be fixed this week. |
Hey @joshterrill, no pressure, just wondering if you plan to finish up this PR? If not, no worries. Just let me know. |
Sure I can do it. What do you think about using something like this? https://github.com/alexeyten/qr-image |
Looks like a good library to me. |
Related to #94, added qr code generation upon torrent file selection. Maybe we want to make the QR code larger? Or position it somewhere else? I figured this was fine for right now.