Skip to content

Commit

Permalink
fix: last torrent loading on android
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Dec 26, 2023
1 parent 541dc83 commit 42e345f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/modules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export function binarySearch (arr, el) {
}

export const defaults = {
volume: 1,
playerAutoplay: true,
playerPause: true,
playerAutocomplete: true,
Expand Down
9 changes: 8 additions & 1 deletion common/modules/webtorrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')))
}

Expand Down

0 comments on commit 42e345f

Please sign in to comment.