Getting current download refactored to work and display less errors

Player component now sends jwt token if logged in
pull/67/head
Isaac Grynsztein 6 years ago
parent a7c810136b
commit 912a419bd4

@ -1137,18 +1137,15 @@ export class MainComponent implements OnInit {
}
getCurrentDownload() {
this.postsService.getCurrentDownload(this.postsService.session_id,
this.current_download['ui_uid'] ? this.current_download['ui_uid'] : this.current_download['uid']).subscribe(res => {
const ui_uid = this.current_download['ui_uid'] ? this.current_download['ui_uid'] : this.current_download['uid'];
const ui_uid = this.current_download['ui_uid'] ? this.current_download['ui_uid'] : this.current_download['uid'];
this.postsService.getCurrentDownload(this.postsService.session_id, ui_uid).subscribe(res => {
if (res['download']) {
console.log('got new download');
if (ui_uid === res['download']['ui_uid']) {
this.current_download = res['download'];
this.percentDownloaded = this.current_download.percent_complete;
console.log(this.percentDownloaded);
}
} else {
console.log('failed to get new download');
// console.log('failed to get new download');
}
});
}

@ -183,6 +183,11 @@ export class PlayerComponent implements OnInit {
fullLocation = this.baseStreamPath + baseLocation + encodeURIComponent(fileName) + '?subName=' + this.subscriptionName +
'&subPlaylist=' + this.subPlaylist;
}
// adds user token if in multi-user-mode
if (this.postsService.isLoggedIn) {
fullLocation += '?jwt=' + this.postsService.token;
}
// if it has a slash (meaning it's in a directory), only get the file name for the label
let label = null;
const decodedName = decodeURIComponent(fileName);

Loading…
Cancel
Save