Skip to content
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 #176

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const uploadElement = require('upload-element')
const WebTorrent = require('webtorrent')
const JSZip = require('jszip')
const SimplePeer = require('simple-peer')
const kjua = require('kjua')

const util = require('./util')

Expand Down Expand Up @@ -195,6 +196,13 @@ function onTorrent (torrent) {
'<a href="' + escapeHtml(torrent.torrentFileBlobURL) + '" target="_blank" download="' + escapeHtml(torrentFileName) + '">[Download .torrent]</a>'
)

util.log('<div id="qr-code"></div>')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to util.unsafeLog

Copy link

@kaotisk-hund kaotisk-hund Dec 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to suggestion below we won't need this line

Suggested change
util.log('<div id="qr-code"></div>')


util.log(document.getElementById('qr-code').appendChild(kjua({
text: window.location.origin + '/#' + torrent.infoHash,
crisp: true
})))

function updateSpeed () {
const progress = (100 * torrent.progress).toFixed(1)

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"escape-html": "1.0.3",
"express": "4.18.2",
"jszip": "3.10.1",
"kjua": "0.1.2",
"prettier-bytes": "1.0.4",
"pug": "3.0.2",
"rollbar": "2.25.2",
Expand Down