diff --git a/renderer/index.css b/renderer/index.css index 38552636..f0fe4654 100644 --- a/renderer/index.css +++ b/renderer/index.css @@ -396,7 +396,7 @@ input { position: absolute; top: 20px; left: 20px; - width: calc(100% - 100px); + width: calc(100% - 150px); text-shadow: rgba(0, 0, 0, 0.5) 0 0 4px; } diff --git a/renderer/index.js b/renderer/index.js index a0e12396..51081f85 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -453,6 +453,7 @@ function addTorrentEvents (torrent) { torrentSummary.ready = true torrentSummary.name = torrentSummary.displayName || torrent.name torrentSummary.infoHash = torrent.infoHash + torrentSummary.files = torrent.files.map(summarizeFileInTorrent) saveTorrentFile(torrentSummary, torrent) @@ -493,6 +494,15 @@ function generateTorrentPoster (torrent, torrentSummary) { }) } +// Produces a JSON saveable summary of a file in a torrent +function summarizeFileInTorrent (file) { + return { + name: file.name, + length: file.length, + isDownloaded: false + } +} + // Every time we resolve a magnet URI, save the torrent file so that we never // have to download it again. Never ask the DHT the same question twice. function saveTorrentFile (torrentSummary, torrent) { diff --git a/renderer/views/torrent-list.js b/renderer/views/torrent-list.js index 1bdbfdd6..9e8ae857 100644 --- a/renderer/views/torrent-list.js +++ b/renderer/views/torrent-list.js @@ -131,8 +131,11 @@ function TorrentList (state, dispatch) { // Show files, per-file download status and play buttons, and so on function renderTorrentDetails (torrent, torrentSummary) { + // If we're currently torrenting, show details directly from WebTorrent, including % downloaded + // Otherwise, show a summary of files in the torrent, if available + var files = (torrent && torrent.files) || torrentSummary.files var filesElement - if (!torrent || !torrent.files) { + if (!files) { // We don't know what files this torrent contains var message = torrent ? 'Downloading torrent data using magnet link...' @@ -140,7 +143,7 @@ function TorrentList (state, dispatch) { filesElement = hx`