mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-18 00:31:27 +03:00
Fixed bug that prevented files from being downloaded from the server. Reverted some changes from #528 as they are not needed
This commit is contained in:
@@ -33,8 +33,7 @@
|
|||||||
<button *ngIf="(!postsService.isLoggedIn || postsService.permissions.includes('sharing')) && !auto" (click)="openShareDialog()" mat-icon-button><mat-icon>share</mat-icon></button>
|
<button *ngIf="(!postsService.isLoggedIn || postsService.permissions.includes('sharing')) && !auto" (click)="openShareDialog()" mat-icon-button><mat-icon>share</mat-icon></button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="db_file">
|
<ng-container *ngIf="db_file">
|
||||||
<button (click)="downloadVideo()" [disabled]="downloading" mat-icon-button><mat-icon>cloud_download</mat-icon><mat-spinner *ngIf="downloading" class="spinner" [diameter]="35"></mat-spinner></button>
|
<button (click)="downloadFile()" [disabled]="downloading" mat-icon-button><mat-icon>cloud_download</mat-icon><mat-spinner *ngIf="downloading" class="spinner" [diameter]="35"></mat-spinner></button>
|
||||||
<button (click)="downloadFile()" [disabled]="downloading" mat-icon-button><mat-icon>save</mat-icon><mat-spinner *ngIf="downloading" class="spinner" [diameter]="35"></mat-spinner></button>
|
|
||||||
<button *ngIf="type !== 'subscription' && (!postsService.isLoggedIn || postsService.permissions.includes('sharing'))" (click)="openShareDialog()" mat-icon-button><mat-icon>share</mat-icon></button>
|
<button *ngIf="type !== 'subscription' && (!postsService.isLoggedIn || postsService.permissions.includes('sharing'))" (click)="openShareDialog()" mat-icon-button><mat-icon>share</mat-icon></button>
|
||||||
<button (click)="openFileInfoDialog()" *ngIf="db_file" mat-icon-button><mat-icon>info</mat-icon></button>
|
<button (click)="openFileInfoDialog()" *ngIf="db_file" mat-icon-button><mat-icon>info</mat-icon></button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@@ -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) {
|
playlistPostCreationHandler(playlistID) {
|
||||||
// changes the route without moving from the current view or
|
// changes the route without moving from the current view or
|
||||||
// triggering a navigation event
|
// triggering a navigation event
|
||||||
|
|||||||
@@ -357,15 +357,12 @@ export class PostsService implements CanActivate {
|
|||||||
return this.http.post<GetAllFilesResponse>(this.path + 'getAllFiles', {sort: sort, range: range, text_search: text_search, file_type_filter: file_type_filter}, this.httpOptions);
|
return this.http.post<GetAllFilesResponse>(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 = {
|
const body: DownloadFileRequest = {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
uuid: uuid,
|
uuid: uuid
|
||||||
sub_id: sub_id,
|
|
||||||
url: url,
|
|
||||||
type: type
|
|
||||||
};
|
};
|
||||||
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) {
|
getFullTwitchChat(id, type, uuid = null, sub = null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user