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

new protocol handler: stream-magnet #640

Merged
merged 2 commits into from
Jun 24, 2016
Merged

new protocol handler: stream-magnet #640

merged 2 commits into from
Jun 24, 2016

Conversation

anonymlol
Copy link
Contributor

@anonymlol anonymlol commented Jun 14, 2016

Related to #83

Only tested on Windows.

@anonymlol anonymlol changed the title New Handler: stream-magnet new protocol handler: stream-magnet Jun 14, 2016
@@ -549,7 +549,7 @@ function onOpen (files) {
function isTorrent (file) {
var name = typeof file === 'string' ? file : file.name
var isTorrentFile = path.extname(name).toLowerCase() === '.torrent'
var isMagnet = typeof file === 'string' && /^magnet:/.test(file)
var isMagnet = typeof file === 'string' && /^magnet:/.test(file) || /^stream-magnet:/.test(file)
Copy link
Member

@feross feross Jun 24, 2016

Choose a reason for hiding this comment

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

I would put parens around the magnet regexes for clarity -- I can never remember the order of ops of || and &&.

Copy link

Choose a reason for hiding this comment

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

This also could be like var isMagnet = typeof file === 'string' && /^(stream-)?magnet:/.test(file)

@feross
Copy link
Member

feross commented Jun 24, 2016

LGTM, with a couple of exceptions inline. I'll fix them up after merge.

Thanks for the contribution!

@feross feross merged commit b2d2a6a into webtorrent:master Jun 24, 2016
@feross
Copy link
Member

feross commented Jun 24, 2016

I also had to add support for stream-magnet: to parse-torrent.

feross added a commit that referenced this pull request Jun 24, 2016
djjorjinho pushed a commit to djjorjinho/webtorrent-desktop that referenced this pull request Jun 30, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants