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

Add WebTorrent support #5342

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
402fd53
webtorrent integration demo
dcposch Nov 2, 2016
4d00744
magnet link demo styling
dcposch Nov 2, 2016
2795001
appUrlUtil jsdoc
dcposch Nov 2, 2016
0c29397
follow magnet links
dcposch Nov 2, 2016
e5d76bf
Address code review feedback
feross Nov 3, 2016
5eebaec
Force add WebTorrent community trackers
feross Nov 3, 2016
8f3f6a3
link to individual files in a torrent
dcposch Nov 4, 2016
0683dee
make normalizeURL handle magnet links
dcposch Nov 9, 2016
fea269e
move webtorrent to its own extension
dcposch Nov 7, 2016
9d96b33
move webtorrent to the browser process
dcposch Nov 9, 2016
9d3cf42
use webtorrent-remote
dcposch Nov 10, 2016
adfb9e3
show torrent content in an iframe
dcposch Nov 11, 2016
a28c0a4
address pr comments
dcposch Nov 11, 2016
1282132
Add torrent view extension key for deterministic extension ID
feross Nov 11, 2016
b6a4a8e
webtorrent over http
dcposch Nov 11, 2016
fb160c3
size the <iframe>. next step: remove <iframe>s
dcposch Nov 11, 2016
b0b3e11
webtorrent-remote dependency
dcposch Nov 11, 2016
3c010a3
WebTorrent extension progress
feross Nov 9, 2016
b70c589
webtorrent extension fixes
dcposch Nov 12, 2016
76e8077
Torrent Viewer UI bugfixes
dcposch Nov 12, 2016
dacc323
refresh magnet page: don't open external app
dcposch Nov 12, 2016
8d63b8e
webtorrent-remote 0.0.1
dcposch Nov 12, 2016
5ef40ac
magnet-uri 5.1.5
dcposch Nov 14, 2016
a1108a2
auto start, fix ix=0 bug, refactor
dcposch Nov 15, 2016
1ea3d34
webtorrent-remote 0.0.2
dcposch Nov 15, 2016
c7daf09
change ordering of stats
feross Nov 14, 2016
75fb5de
More UI polish
feross Nov 15, 2016
a5a6eab
Lots of UI tweaks
feross Nov 15, 2016
75c46f3
auto stop, clean up torrents
dcposch Nov 15, 2016
120dc10
Put media viewer into its own component
feross Nov 15, 2016
86d55c4
shortcut icon
dcposch Nov 15, 2016
129da50
fix crash when closing a window containing a magnet tab
dcposch Nov 15, 2016
e223300
webtorrent-remote 0.0.4
dcposch Nov 15, 2016
3f53179
torrent ipc: direct webview-to-browser, don't relay thru frame.js
dcposch Nov 15, 2016
7e13a2e
fix Torrent Viewer extension CSP
dcposch Nov 15, 2016
fcdcbce
Torrent Viewer localization
dcposch Nov 15, 2016
61d951f
webtorrent-remote 0.0.5
dcposch Nov 16, 2016
50346e6
add torrent and create server simultaneously
dcposch Nov 16, 2016
61d5f28
webtorrent server trace
dcposch Nov 16, 2016
e12629e
torrentStatus: always show error message
dcposch Nov 17, 2016
f31f9b6
automatically allow openExternal only for PDFJS, not all extensions
dcposch Nov 17, 2016
a9ed691
pref to enable or disable Torrent Viewer
dcposch Nov 18, 2016
3b7f552
webtorrent-remote 0.0.7
dcposch Nov 18, 2016
2997c7a
appUrlUtilTest
dcposch Nov 18, 2016
2e1d29f
fix web_accessible_resources
dcposch Nov 18, 2016
f4c92b5
Torrent Viewer: support fullscreen
dcposch Nov 18, 2016
d8a8f55
Torrent Viewer: add download links
dcposch Nov 19, 2016
725acea
webtorrent-remote 0.0.8
dcposch Nov 19, 2016
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ win64-dist
Brave.tar.bz2

app/extensions/brave/gen
app/extensions/torrent/gen
*.pfx
buildConfig.js

Expand Down
4 changes: 2 additions & 2 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {app, BrowserWindow, session, webContents} = require('electron')
const extensions = process.atomBinding('extension')
const { getIndexHTML } = require('../../js/lib/appUrlUtil')
const { getBraveExtIndexHTML } = require('../../js/lib/appUrlUtil')

let currentWebContents = {}
let activeTab = null
Expand All @@ -13,7 +13,7 @@ const tabs = {
init: () => {
app.on('web-contents-created', function (event, tab) {
// TODO(bridiver) - also exclude extension action windows??
if (extensions.isBackgroundPage(tab) || tab.getURL() === getIndexHTML()) {
if (extensions.isBackgroundPage(tab) || tab.getURL() === getBraveExtIndexHTML()) {
return
}
let tabId = tab.getId()
Expand Down
42 changes: 42 additions & 0 deletions app/browser/webtorrent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const electron = require('electron')
const ipc = electron.ipcMain
const messages = require('../../js/constants/messages')
const WebTorrentRemoteServer = require('webtorrent-remote/server')

module.exports = {init}

// Set to see communication between WebTorrent and torrent viewer tabs
const DEBUG_IPC = false
if (DEBUG_IPC) console.log('WebTorrent IPC debugging enabled')

// Connects to the BitTorrent network
// Communicates with the WebTorrentRemoteClients via message passing
let server = null
let channels = {}

// Receive messages via the window process, ultimately from the UI in a <webview> process
function init () {
if (DEBUG_IPC) console.log('WebTorrent IPC init')
server = new WebTorrentRemoteServer(send, {trace: DEBUG_IPC})
ipc.on(messages.TORRENT_MESSAGE, function (e, msg) {
if (DEBUG_IPC) console.log('Received IPC: ' + JSON.stringify(msg))
channels[msg.clientKey] = e.sender
server.receive(msg)
})
}

// Send messages from the browser process (here), thru the window process, to the <webview>
function send (msg) {
if (DEBUG_IPC) console.log('Sending IPC: ' + JSON.stringify(msg))
const channel = channels[msg.clientKey]
if (!channel) {
if (DEBUG_IPC) console.error('Ignoring unrecognized clientKey ' + msg.clientKey)
return
}
if (channel.isDestroyed()) {
if (DEBUG_IPC) console.log('Removing destroyed channel, clientKey ' + msg.clientKey)
delete channels[msg.clientKey]
return
}
channel.send(messages.TORRENT_MESSAGE, msg)
}
98 changes: 78 additions & 20 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const extensionActions = require('./common/actions/extensionActions')
const config = require('../js/constants/config')
const appConfig = require('../js/constants/appConfig')
const {fileUrl} = require('../js/lib/appUrlUtil')
const {getAppUrl, getExtensionsPath, getIndexHTML} = require('../js/lib/appUrlUtil')
const {getExtensionsPath, getBraveExtUrl, getBraveExtIndexHTML} = require('../js/lib/appUrlUtil')
const {getSetting} = require('../js/settings')
const settings = require('../js/constants/settings')
const extensionStates = require('../js/constants/extensionStates')
Expand All @@ -15,7 +15,21 @@ const appActions = require('../js/actions/appActions')
const fs = require('fs')
const path = require('path')

// Takes Content Security Policy flags, for example { 'default-src': '*' }
// Returns a CSP string, for example 'default-src: *;'
let concatCSP = (cspDirectives) => {
let csp = ''
for (let directive in cspDirectives) {
csp += directive + ' ' + cspDirectives[directive] + '; '
}
return csp.trim()
}

// Returns the Chromium extension manifest for the braveExtension
// The braveExtension handles about: pages, ad blocking, and a few other things
let generateBraveManifest = () => {
const indexHTML = getBraveExtIndexHTML()

let baseManifest = {
name: 'brave',
manifest_version: 2,
Expand All @@ -32,7 +46,7 @@ let generateBraveManifest = () => {
'http://*/*', 'https://*/*', 'file://*', 'data:*', 'about:srcdoc'
],
exclude_globs: [
getIndexHTML()
indexHTML
],
match_about_blank: true,
js: [
Expand All @@ -55,7 +69,7 @@ let generateBraveManifest = () => {
'http://*/*', 'https://*/*', 'file://*', 'data:*', 'about:srcdoc'
],
exclude_globs: [
getIndexHTML()
indexHTML
],
js: [
'content/scripts/adInsertion.js',
Expand All @@ -70,13 +84,13 @@ let generateBraveManifest = () => {
matches: ['<all_urls>'],
include_globs: [
'http://*/*', 'https://*/*', 'file://*', 'data:*', 'about:srcdoc',
getIndexHTML(),
getAppUrl('about-*.html'),
getAppUrl('about-*.html') + '#*'
indexHTML,
getBraveExtUrl('about-*.html'),
getBraveExtUrl('about-*.html') + '#*'
],
exclude_globs: [
getAppUrl('about-blank.html'),
getAppUrl('about-blank.html') + '#*'
getBraveExtUrl('about-blank.html'),
getBraveExtUrl('about-blank.html') + '#*'
],
js: [
'content/scripts/spellCheck.js',
Expand All @@ -93,13 +107,13 @@ let generateBraveManifest = () => {
'<all_urls>'
],
include_globs: [
getIndexHTML(),
getAppUrl('about-*.html'),
getAppUrl('about-*.html') + '#*'
indexHTML,
getBraveExtUrl('about-*.html'),
getBraveExtUrl('about-*.html') + '#*'
],
exclude_globs: [
getAppUrl('about-blank.html'),
getAppUrl('about-blank.html') + '#*'
getBraveExtUrl('about-blank.html'),
getBraveExtUrl('about-blank.html') + '#*'
]
}
],
Expand Down Expand Up @@ -137,15 +151,52 @@ let generateBraveManifest = () => {
cspDirectives['style-src'] = '\'self\' \'unsafe-inline\' http://' + devServer
}

var csp = ''
for (var directive in cspDirectives) {
csp += directive + ' ' + cspDirectives[directive] + '; '
}
baseManifest.content_security_policy = csp.trim()
baseManifest.content_security_policy = concatCSP(cspDirectives)

return baseManifest
}

// Returns the Chromium extension manifest for the torrentExtension
// The torrentExtension handles magnet: URLs
// Analagous to the PDFJS extension, it shows a special UI for that type of resource
let generateTorrentManifest = () => {
let cspDirectives = {
'default-src': '\'self\'',
'media-src': '\'self\' http://localhost:*',
'frame-src': 'http://localhost:*',
'form-action': '\'none\'',
'referrer': 'no-referrer',
'style-src': '\'self\' \'unsafe-inline\''
}

return {
name: 'Torrent Viewer',
manifest_version: 2,
version: '1.0',
content_security_policy: concatCSP(cspDirectives),
content_scripts: [],
permissions: [
'externally_connectable.all_urls', 'tabs', '<all_urls>'
],
externally_connectable: {
matches: [
'<all_urls>'
]
},
icons: {
128: 'img/webtorrent-128.png',
48: 'img/webtorrent-48.png',
16: 'img/webtorrent-16.png'
},
web_accessible_resources: [
'img/favicon.ico',
'img/webtorrent-128.png'
],
incognito: 'split',
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWl+wMvL0wZX3JUs7GeZAvxMP+LWEh2bwMV1HyuBra/lGZIq3Fmh0+AFnvFPXz1NpQkbLS3QWyqhdIn/lepGwuc2ma0glPzzmieqwctUurMGSGManApGO1MkcbSPhb+R1mx8tMam5+wbme4WoW37PI3oATgOs2NvHYuP60qol3U7b/zB3IWuqtwtqKe2Q1xY17btvPuz148ygWWIHneedt0jwfr6Zp+CSLARB9Heq/jqGXV4dPSVZ5ebBHLQ452iZkHxS6fm4Z+IxjKdYs3HNj/s8xbfEZ2ydnArGdJ0lpSK9jkDGYyUBugq5Qp3FH6zV89WqBvoV1dqUmL9gxbHsQIDAQAB'
}
}

const extensionInfo = {
isEnabled: function (extensionId) {
return this.extensionState[extensionId] === extensionStates.ENABLED
Expand Down Expand Up @@ -246,7 +297,7 @@ module.exports.init = () => {
let loadExtension = (extensionId, extensionPath, manifest = {}, manifestLocation = 'unpacked') => {
if (!extensionInfo.isLoaded(extensionId) && !extensionInfo.isLoading(extensionId)) {
extensionInfo.setState(extensionId, extensionStates.LOADING)
if (extensionId === config.braveExtensionId) {
if (extensionId === config.braveExtensionId || extensionId === config.torrentExtensionId) {
session.defaultSession.extensions.load(extensionPath, manifest, manifestLocation)
return
}
Expand Down Expand Up @@ -289,9 +340,16 @@ module.exports.init = () => {
}
}

// Manually install only the braveExtension
// Manually install the braveExtension and torrentExtension
extensionInfo.setState(config.braveExtensionId, extensionStates.REGISTERED)
loadExtension(config.braveExtensionId, getExtensionsPath('brave'), generateBraveManifest(), 'component')
if (getSetting(settings.TORRENT_VIEWER_ENABLED)) {
extensionInfo.setState(config.torrentExtensionId, extensionStates.REGISTERED)
loadExtension(config.torrentExtensionId, getExtensionsPath('torrent'), generateTorrentManifest(), 'component')
} else {
extensionInfo.setState(config.torrentExtensionId, extensionStates.DISABLED)
extensionActions.extensionDisabled(config.torrentExtensionId)
}

let registerComponents = () => {
if (getSetting(settings.PDFJS_ENABLED)) {
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/bn-BD/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/bn-IN/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/cs/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave je váš výchozí prohlížeč.
notDefaultBrowser=Brave není váš výchozí prohlížeč.
setAsDefault=Nastavit jako výchozí...
checkDefaultOnStartup=Vždy prověřit při spuštění
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/de-DE/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave ist ihr Standardbrowser.
notDefaultBrowser=Brave ist nicht Ihr Standardbrowser.
setAsDefault=Als Standard festlegen...
checkDefaultOnStartup=Bei jedem Start überprüfen
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/es/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave es tu navegador predeterminado.
notDefaultBrowser=Brave no es tu navegador predeterminado.
setAsDefault=Establecer como predeterminado...
checkDefaultOnStartup=Comprobar siempre al inicio
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/eu/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Lehenetsiz ezarri...
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/fr-FR/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave est votre navigateur par défaut.
notDefaultBrowser=Brave n'est pas votre navigateur par défaut.
setAsDefault=Définir par défaut…
checkDefaultOnStartup=Toujours vérifier au démarrage
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/hi-IN/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/id-ID/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave adalah peramban bawaan Anda.
notDefaultBrowser=Brave bukan peramban bawaan Anda.
setAsDefault=Atur sebagai bawaan...
checkDefaultOnStartup=Selalu periksa saat memulai
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/it-IT/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave è il tuo browser predefinito.
notDefaultBrowser=Brave non è il tuo browser predefinito
setAsDefault=Imposta come predefinito
checkDefaultOnStartup=Controlla sempre all'avvio
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/ja-JP/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Braveは既定のブラウザーです。
notDefaultBrowser=Braveは既定のブラウザーではありません。
setAsDefault=既定にする
checkDefaultOnStartup=起動時に常に確認する
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/ko-KR/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/ms-MY/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave ialah pelayar piawai anda.
notDefaultBrowser=Brave bukan pelayar piawai anda.
setAsDefault=Tetapkan sebagai piawai...
checkDefaultOnStartup=Sentiasa semak semasa permulaan
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/nl-NL/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/pl-PL/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/pt-BR/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=O Brave é o seu navegador padrão.
notDefaultBrowser=O Brave não é o seu navegador padrão.
setAsDefault=Definir como padrão...
checkDefaultOnStartup=Sempre verificar na inicialização
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/ru/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave является браузером по умолчанию
notDefaultBrowser=Brave не является браузером по умолчанию.
setAsDefault=Установить по умолчанию…
checkDefaultOnStartup=Всегда проверять при запуске
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/sl/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave je vaš privzeti brskalnik:
notDefaultBrowser=Brave ni vaš privzeti brskalnik:
setAsDefault=Določi kot privzeto ...
checkDefaultOnStartup=Vedno preveri ob zagonu
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/ta/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/te/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/tr-TR/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave is your default browser.
notDefaultBrowser=Brave is not your default browser.
setAsDefault=Set as default…
checkDefaultOnStartup=Always check on startup
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/uk/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave є вашим типовим браузером.
notDefaultBrowser=Brave не є вашим типовим браузером.
setAsDefault=Встановити типовим…
checkDefaultOnStartup=Завжди перевіряти при запуску
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
1 change: 1 addition & 0 deletions app/extensions/brave/locales/zh-CN/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,4 @@ defaultBrowser=Brave 是您的默认浏览器。
notDefaultBrowser=Brave 不是您的默认浏览器。
setAsDefault=设置为默认值...
checkDefaultOnStartup=总是在启动时检查
useTorrentViewer=Enable Torrent Viewer (requires browser restart)
3 changes: 3 additions & 0 deletions app/extensions/torrent/ext/l20n.min.js

Large diffs are not rendered by default.

Binary file added app/extensions/torrent/img/favicon.ico
Binary file not shown.
Binary file added app/extensions/torrent/img/webtorrent-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/torrent/img/webtorrent-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/torrent/img/webtorrent-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/torrent/img/webtorrent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions app/extensions/torrent/js/webtorrent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function () {
let webtorrentEntryPage = 'gen/webtorrentPage.entry.js'

chrome.ipc.on('language', (e, detail) => {
document.l10n.requestLanguages([detail.langCode])
document.getElementsByName('availableLanguages')[0].content = detail.languageCodes.join(', ')
})

window.addEventListener('load', function () {
var po = document.createElement('script')
po.async = true
po.src = webtorrentEntryPage
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(po, s)
chrome.ipc.send('request-language')
})
})()
21 changes: 21 additions & 0 deletions app/extensions/torrent/locales/en-US/app.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
startPrompt=Start Downloading "{{name}}"?
startPromptUntitled=Start Downloading?
startDownload=Start Download
saveTorrentFile=Save Torrent File
legalNotice=When you start a torrent, its data will be made available to others by means of upload. You are responsible for abiding by your local laws.
missingFilesList=Click "Start Download" to load the torrent file list.
loadingFilesList=Loading the torrent file list...
name=Name
size=Size
poweredByWebTorrent=Powered By WebTorrent.
seeding=Seeding
seedingTorrent=Seeding Torrent
downloading=Downloading
downloadingTorrent=Downloading Torrent
files=Files
num=#
downloadFile=Download
torrentStatus=Torrent Status
torrentLoadingInfo=Loading torrent info...
torrentUntitled=Untitled torrent
torrentLoadingMedia=Loading...
Loading