2023-07-29 15:53:51 +00:00
|
|
|
<template>
|
2023-08-24 16:22:40 +00:00
|
|
|
<NcAppContent>
|
2023-12-23 21:49:23 +00:00
|
|
|
<Loading v-if="loading" />
|
2024-01-12 23:27:36 +00:00
|
|
|
<NcEmptyContent v-if="failed"
|
|
|
|
class="error"
|
|
|
|
:name="t('repod', 'Error loading feed')">
|
2023-08-02 09:33:48 +00:00
|
|
|
<template #icon>
|
|
|
|
<Alert />
|
|
|
|
</template>
|
|
|
|
</NcEmptyContent>
|
2023-08-23 08:11:39 +00:00
|
|
|
<Banner v-if="feed"
|
|
|
|
:author="feed.author"
|
2023-08-23 15:54:09 +00:00
|
|
|
:description="feed.description"
|
2023-08-23 08:11:39 +00:00
|
|
|
:image-url="feed.imageUrl"
|
|
|
|
:link="feed.link"
|
|
|
|
:title="feed.title" />
|
2024-01-12 23:27:36 +00:00
|
|
|
<Episodes v-if="feed" :title="feed.title" />
|
2023-08-24 16:22:40 +00:00
|
|
|
</NcAppContent>
|
2023-07-29 15:53:51 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-12-23 21:49:23 +00:00
|
|
|
import { NcAppContent, NcEmptyContent } from '@nextcloud/vue'
|
2023-08-02 09:33:48 +00:00
|
|
|
import Alert from 'vue-material-design-icons/Alert.vue'
|
2023-08-23 08:11:39 +00:00
|
|
|
import Banner from '../components/Feed/Banner.vue'
|
2023-08-30 07:27:12 +00:00
|
|
|
import Episodes from '../components/Feed/Episodes.vue'
|
2023-12-23 21:49:23 +00:00
|
|
|
import Loading from '../components/Atoms/Loading.vue'
|
2023-08-02 09:33:48 +00:00
|
|
|
import axios from '@nextcloud/axios'
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2024-01-12 23:10:37 +00:00
|
|
|
import { toUrl } from '../utils/url.js'
|
2023-08-02 09:33:48 +00:00
|
|
|
|
2023-07-29 15:53:51 +00:00
|
|
|
export default {
|
|
|
|
name: 'Feed',
|
2023-08-02 09:33:48 +00:00
|
|
|
components: {
|
|
|
|
Alert,
|
2023-08-23 08:11:39 +00:00
|
|
|
Banner,
|
2023-08-30 07:27:12 +00:00
|
|
|
Episodes,
|
2023-12-23 21:49:23 +00:00
|
|
|
Loading,
|
2023-08-24 16:22:40 +00:00
|
|
|
NcAppContent,
|
2023-08-02 09:33:48 +00:00
|
|
|
NcEmptyContent,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
failed: false,
|
|
|
|
loading: true,
|
|
|
|
feed: null,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
url() {
|
|
|
|
return atob(this.$route.params.url)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
try {
|
2023-08-24 10:48:10 +00:00
|
|
|
const podcastData = await axios.get(generateUrl('/apps/repod/podcast?url={url}', { url: this.url }))
|
2024-01-12 23:10:37 +00:00
|
|
|
|
2024-01-12 23:16:42 +00:00
|
|
|
if (podcastData.data.atomLink && podcastData.data.atomLink !== this.url) {
|
2024-01-12 23:10:37 +00:00
|
|
|
this.$router.push(toUrl(podcastData.data.atomLink))
|
|
|
|
}
|
|
|
|
|
2023-08-29 06:53:15 +00:00
|
|
|
this.feed = podcastData.data
|
2023-08-02 09:33:48 +00:00
|
|
|
} catch (e) {
|
|
|
|
this.failed = true
|
|
|
|
console.error(e)
|
|
|
|
} finally {
|
|
|
|
this.loading = false
|
|
|
|
}
|
|
|
|
},
|
2023-07-29 15:53:51 +00:00
|
|
|
}
|
|
|
|
</script>
|
2024-01-12 23:27:36 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.error {
|
|
|
|
margin: 2rem;
|
|
|
|
}
|
|
|
|
</style>
|