Compare commits

..

4 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
4cbad1fccd 0.17.2 2016-10-10 22:44:08 -07:00
Feross Aboukhadijeh
f818564dd1 package.json: Add {"private": true}
To prevent accidental publishing to npm.
2016-10-10 22:41:17 -07:00
Feross Aboukhadijeh
8be690a26e v0.17.2 changelog 2016-10-10 22:37:24 -07:00
Feross Aboukhadijeh
8081d42477 Attempt to fix "TypeError: Cannot read property 'startPiece' of undefined"
It wasn't clear what was causing this error, and I couldn't reproduce
it.

This PR attempts to resolve the issue by just guarding against the
exception.
2016-10-10 22:31:33 -07:00
4 changed files with 51 additions and 42 deletions

View File

@@ -1,5 +1,13 @@
# WebTorrent Desktop Version History # WebTorrent Desktop Version History
## v0.17.2 - 2016-10-10
### Fixed
- Windows: Fix impossible-to-delete "Wired CD" default torrent
- Throttle browser-window 'move' and 'resize' events
- Fix crash ("Cannot read property 'files' of null" error)
- Fix crash ("TypeError: Cannot read property 'startPiece' of undefined")
## v0.17.1 - 2016-10-03 ## v0.17.1 - 2016-10-03
### Changed ### Changed

View File

@@ -1,7 +1,7 @@
{ {
"name": "webtorrent-desktop", "name": "webtorrent-desktop",
"description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.", "description": "WebTorrent, the streaming torrent client. For Mac, Windows, and Linux.",
"version": "0.17.1", "version": "0.17.2",
"author": { "author": {
"name": "WebTorrent, LLC", "name": "WebTorrent, LLC",
"email": "feross@webtorrent.io", "email": "feross@webtorrent.io",
@@ -90,6 +90,7 @@
"optionalDependencies": { "optionalDependencies": {
"appdmg": "^0.4.3" "appdmg": "^0.4.3"
}, },
"private": true,
"productName": "WebTorrent", "productName": "WebTorrent",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -182,51 +182,47 @@ module.exports = class TorrentListController {
openTorrentContextMenu (infoHash) { openTorrentContextMenu (infoHash) {
const torrentSummary = TorrentSummary.getByKey(this.state, infoHash) const torrentSummary = TorrentSummary.getByKey(this.state, infoHash)
const torrentStarted = !!(torrentSummary.files && torrentSummary.progress) const menu = new electron.remote.Menu()
const menuTemplate = [ menu.append(new electron.remote.MenuItem({
{ label: 'Remove From List',
label: 'Remove From List', click: () => dispatch('confirmDeleteTorrent', torrentSummary.infoHash, false)
click: () => dispatch('confirmDeleteTorrent', torrentSummary.infoHash, false) }))
},
{ menu.append(new electron.remote.MenuItem({
label: 'Remove Data File', label: 'Remove Data File',
enabled: torrentStarted, click: () => dispatch('confirmDeleteTorrent', torrentSummary.infoHash, true)
click: () => dispatch('confirmDeleteTorrent', torrentSummary.infoHash, true) }))
},
{ menu.append(new electron.remote.MenuItem({
type: 'separator' type: 'separator'
}, }))
{
if (torrentSummary.files) {
menu.append(new electron.remote.MenuItem({
label: process.platform === 'darwin' ? 'Show in Finder' : 'Show in Folder', label: process.platform === 'darwin' ? 'Show in Finder' : 'Show in Folder',
enabled: torrentStarted,
click: () => showItemInFolder(torrentSummary) click: () => showItemInFolder(torrentSummary)
}, }))
{ menu.append(new electron.remote.MenuItem({
type: 'separator' type: 'separator'
}, }))
{ }
label: 'Copy Magnet Link to Clipboard',
click: () => electron.clipboard.writeText(torrentSummary.magnetURI) menu.append(new electron.remote.MenuItem({
}, label: 'Copy Magnet Link to Clipboard',
{ click: () => electron.clipboard.writeText(torrentSummary.magnetURI)
label: 'Copy Instant.io Link to Clipboard', }))
click: () => electron.clipboard.writeText(`https://instant.io/#${torrentSummary.infoHash}`)
}, menu.append(new electron.remote.MenuItem({
{ label: 'Copy Instant.io Link to Clipboard',
label: 'Save Torrent File As...', click: () => electron.clipboard.writeText(`https://instant.io/#${torrentSummary.infoHash}`)
click: () => dispatch('saveTorrentFileAs', torrentSummary.torrentKey) }))
},
{ menu.append(new electron.remote.MenuItem({
type: 'separator' label: 'Save Torrent File As...',
}, click: () => dispatch('saveTorrentFileAs', torrentSummary.torrentKey)
{ }))
label: 'Paste Torrent Address',
role: 'paste'
}
]
const menu = electron.remote.Menu.buildFromTemplate(menuTemplate)
menu.popup(electron.remote.getCurrentWindow()) menu.popup(electron.remote.getCurrentWindow())
} }

View File

@@ -599,12 +599,15 @@ function renderLoadingBar (state) {
const torrentSummary = state.getPlayingTorrentSummary() const torrentSummary = state.getPlayingTorrentSummary()
if (!torrentSummary.progress) { if (!torrentSummary.progress) {
return [] return null
} }
// Find all contiguous parts of the torrent which are loaded // Find all contiguous parts of the torrent which are loaded
const prog = torrentSummary.progress const prog = torrentSummary.progress
const fileProg = prog.files[state.playing.fileIndex] const fileProg = prog.files[state.playing.fileIndex]
if (!fileProg) return null
const parts = [] const parts = []
let lastPiecePresent = false let lastPiecePresent = false
for (let i = fileProg.startPiece; i <= fileProg.endPiece; i++) { for (let i = fileProg.startPiece; i <= fileProg.endPiece; i++) {
@@ -626,6 +629,7 @@ function renderLoadingBar (state) {
return (<div key={i} className='loading-bar-part' style={style} />) return (<div key={i} className='loading-bar-part' style={style} />)
}) })
return (<div key='loading-bar' className='loading-bar'>{loadingBarElems}</div>) return (<div key='loading-bar' className='loading-bar'>{loadingBarElems}</div>)
} }