diff --git a/common/modules/util.js b/common/modules/util.js index 972e326..0818c43 100644 --- a/common/modules/util.js +++ b/common/modules/util.js @@ -144,6 +144,7 @@ export function binarySearch (arr, el) { } export const defaults = { + volume: 1, playerAutoplay: true, playerPause: true, playerAutocomplete: true, diff --git a/common/modules/webtorrent.js b/common/modules/webtorrent.js index d062942..1363bb3 100644 --- a/common/modules/webtorrent.js +++ b/common/modules/webtorrent.js @@ -96,7 +96,14 @@ export default class TorrentClient extends WebTorrent { loadLastTorrent (t) { if (!localStorage.getItem('torrent') && !t) return - const torrent = new Uint8Array(JSON.parse(localStorage.getItem('torrent'))) || t + let torrent = localStorage.getItem('torrent') && new Uint8Array(JSON.parse(localStorage.getItem('torrent'))) + if (!torrent) { + try { + torrent = new Uint8Array(JSON.parse(t)) + } catch (e) { + torrent = t + } + } if (torrent) this.addTorrent(torrent, JSON.parse(localStorage.getItem('lastFinished'))) }