fix: last torrent loading on android

This commit is contained in:
ThaUnknown 2023-12-26 13:58:00 +01:00
parent 541dc831e6
commit 42e345f095
2 changed files with 9 additions and 1 deletions

View file

@ -144,6 +144,7 @@ export function binarySearch (arr, el) {
}
export const defaults = {
volume: 1,
playerAutoplay: true,
playerPause: true,
playerAutocomplete: true,

View file

@ -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')))
}