mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-14 08:40:57 +03:00
Getting current download refactored to work and display less errors
Player component now sends jwt token if logged in
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user