From df687263c52903893a9a97017ab411e56f3dca3b Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Fri, 22 Apr 2022 00:35:58 -0400 Subject: [PATCH] Fixed bug that prevented files from being downloaded from the server. Reverted some changes from #528 as they are not needed --- src/app/player/player.component.html | 3 +-- src/app/player/player.component.ts | 18 ------------------ src/app/posts.services.ts | 9 +++------ 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/app/player/player.component.html b/src/app/player/player.component.html index 74c0b1b..0bf510f 100644 --- a/src/app/player/player.component.html +++ b/src/app/player/player.component.html @@ -33,8 +33,7 @@ - - + diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index 1a4e0ca..2bf0d35 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -328,24 +328,6 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { }); } - downloadVideo() { - const filename = this.currentItem.label; - const ext = (this.currentItem.type === 'audio/mp3') ? '.mp3' : '.mp4'; - // const type = this.currentItem.type; - const url = this.currentItem.src; - this.downloading = true; - this.http.get(url, { - responseType: 'blob' - }).subscribe(res => { - const blob: Blob = res; - this.downloading = false; - saveAs(blob, filename + ext); - }, err => { - console.log(err); - this.downloading = false; - }) - } - playlistPostCreationHandler(playlistID) { // changes the route without moving from the current view or // triggering a navigation event diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 6df00e5..5674fec 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -357,15 +357,12 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'getAllFiles', {sort: sort, range: range, text_search: text_search, file_type_filter: file_type_filter}, this.httpOptions); } - downloadFileFromServer(uid: string, uuid: string = null, sub_id: string = null, url: string = null, type: FileType = null) { + downloadFileFromServer(uid: string, uuid: string = null) { const body: DownloadFileRequest = { uid: uid, - uuid: uuid, - sub_id: sub_id, - url: url, - type: type + uuid: uuid }; - return this.http.post(this.path + 'downloadFile', body, {responseType: 'blob', params: this.httpOptions.params}); + return this.http.post(this.path + 'downloadFileFromServer', body, {responseType: 'blob', params: this.httpOptions.params}); } getFullTwitchChat(id, type, uuid = null, sub = null) {