Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

fix tor-related webtorrent issues #14529

Merged
merged 1 commit into from
Jun 23, 2018
Merged
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
2 changes: 1 addition & 1 deletion app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ let generateTorrentManifest = () => {
48: 'img/webtorrent-48.png',
16: 'img/webtorrent-16.png'
},
incognito: 'not_allowed',
incognito: 'split',
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWl+wMvL0wZX3JUs7GeZAvxMP+LWEh2bwMV1HyuBra/lGZIq3Fmh0+AFnvFPXz1NpQkbLS3QWyqhdIn/lepGwuc2ma0glPzzmieqwctUurMGSGManApGO1MkcbSPhb+R1mx8tMam5+wbme4WoW37PI3oATgOs2NvHYuP60qol3U7b/zB3IWuqtwtqKe2Q1xY17btvPuz148ygWWIHneedt0jwfr6Zp+CSLARB9Heq/jqGXV4dPSVZ5ebBHLQ452iZkHxS6fm4Z+IxjKdYs3HNj/s8xbfEZ2ydnArGdJ0lpSK9jkDGYyUBugq5Qp3FH6zV89WqBvoV1dqUmL9gxbHsQIDAQAB'
}
}
Expand Down
16 changes: 11 additions & 5 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function registerForBeforeRequest (session, partition) {
}

if ((isMagnetURL(details)) && partition === appConfig.tor.partition) {
showTorrentBlockedInTorWarning(details)
showTorrentBlockedInTorWarning(details, muonCb)
return
}

Expand Down Expand Up @@ -357,13 +357,16 @@ function registerForBeforeSendHeaders (session, partition) {
})
}

function showTorrentBlockedInTorWarning (details) {
function showTorrentBlockedInTorWarning (details, muonCb) {
const cb = () => muonCb({cancel: true})
if (details.tabId) {
tabMessageBox.show(details.tabId, {
message: `${locale.translation('torrentBlockedInTor')}`,
title: 'Brave',
buttons: [locale.translation('torrentWarningOk')]
})
}, cb)
} else {
cb()
}
}

Expand All @@ -381,7 +384,7 @@ function registerForHeadersReceived (session, partition) {
return
}
if ((isTorrentFile(details)) && partition === appConfig.tor.partition) {
showTorrentBlockedInTorWarning(details)
showTorrentBlockedInTorWarning(details, muonCb)
return
}
const firstPartyUrl = module.exports.getMainFrameUrl(details)
Expand Down Expand Up @@ -670,7 +673,10 @@ function registerForDownloadListener (session) {
})
}

function registerForMagnetHandler (session) {
function registerForMagnetHandler (session, partition) {
if (partition === appConfig.tor.partition) {
return
}
const webtorrentUrl = appUrlUtil.getTorrentExtUrl('webtorrent.html')
try {
if (getSetting(settings.TORRENT_VIEWER_ENABLED)) {
Expand Down