streamline file download

pull/91/head
Akhil Gupta 4 years ago
parent 3b8cf69abe
commit ceea6f3f0b

@ -131,7 +131,7 @@
{{if .DownloadPath}} {{if .DownloadPath}}
<a <a
class="button" class="button"
href="{{ removeStartingSlash .DownloadPath }}" href="/podcastitems/{{.ID}}/file"
download download
title="Download episode file" title="Download episode file"
><i class="fas fa-download"></i ><i class="fas fa-download"></i

@ -185,7 +185,7 @@
<a <a
v-if="item.DownloadPath" v-if="item.DownloadPath"
class="button" class="button"
:href="removeStartingSlash(item.DownloadPath)" :href="downloadFromServer(item)"
download download
title="Download episode file" title="Download episode file"
><i class="fas fa-download"></i ><i class="fas fa-download"></i
@ -422,6 +422,9 @@ var app = new Vue({
getEpisodeImage(item){ getEpisodeImage(item){
return "/podcastitems/"+item.ID+"/image" return "/podcastitems/"+item.ID+"/image"
}, },
downloadFromServer(item){
return "/podcastitems/"+item.ID+"/file"
},
changePlayedStatus(item){ changePlayedStatus(item){
changePlayedStatus(item.ID,!item.IsPlayed,()=>item.IsPlayed=!item.IsPlayed) changePlayedStatus(item.ID,!item.IsPlayed,()=>item.IsPlayed=!item.IsPlayed)
}, },

@ -241,7 +241,7 @@ func GetPodcastItemFileById(c *gin.Context) {
c.Header("Content-Type", "application/octet-stream") c.Header("Content-Type", "application/octet-stream")
c.File(podcast.DownloadPath) c.File(podcast.DownloadPath)
} else { } else {
c.Redirect(302, fmt.Sprintf("/%s", podcast.FileURL)) c.Redirect(302, podcast.FileURL)
} }
} }
} else { } else {

Loading…
Cancel
Save