download mp3

test
dan 2020-10-27 19:46:43 -06:00
parent 05fc3a220a
commit 2797c504b4
2 changed files with 6 additions and 9 deletions

View File

@ -8,7 +8,7 @@
<div class="description">{{ description }}</div><!-- <div class="description">{{ description }}</div><!--
--><div class="action-buttons"> --><div class="action-buttons">
<button mat-button class="action pct40" (click)="play()" ><i ofbicon>headset</i> Listen</button><!-- <button mat-button class="action pct40" (click)="play()" ><i ofbicon>headset</i> Listen</button><!--
--><button mat-button class="action pct50" (click)="download()" ><i ofbicon>file_download</i> Download</button><!-- --><a download="{{title}}" href="{{url}}" mat-button class="action pct50" ><i ofbicon>file_download</i> Download</a><!--
--><button mat-button class="action pct10" (click)="share()" ><i ofbicon>share</i> Share</button> --><button mat-button class="action pct10" (click)="share()" ><i ofbicon>share</i> Share</button>
</div><!-- </div><!--
--><div class="action-buttons" *ngIf="loggedIn"> --><div class="action-buttons" *ngIf="loggedIn">

View File

@ -64,14 +64,11 @@ router.get("/download/:id",function(req,res){
return; return;
} }
var file = finalStorage + sermon.file; var file = finalStorage + sermon.file;
console.log(file); if (fs.existsSync(file)){
file = 'https://static.danabsher.com/media/' + sermon.file; res.download(file);
res.download(file); } else {
// if (fs.existsSync(file)){ res.status(404).json({"status":404,"message":"Could not find the file associated with this sermon"});
// res.download(file); }
// } else {
// res.status(404).json({"status":404,"message":"Could not find the file associated with this sermon"});
// }
}); });
}); });