Encode url in base64
All checks were successful
repod / nextcloud (push) Successful in 55s
repod / nodejs (push) Successful in 1m24s

This commit is contained in:
Michel Roux 2023-08-02 11:33:48 +02:00
parent 754dda0562
commit 68c6f8234e
4 changed files with 73 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<NcAppNavigationItem :loading="loading" <NcAppNavigationItem :loading="loading"
:title="feed ? feed.title : url" :title="feed ? feed.title : url"
:to="`/${url}`"> :to="toUrl">
<template #icon> <template #icon>
<NcAvatar v-if="feed" <NcAvatar v-if="feed"
:display-name="feed.author" :display-name="feed.author"
@ -50,6 +50,11 @@ export default {
feed: null, feed: null,
} }
}, },
computed: {
toUrl() {
return `/${btoa(this.url)}`
},
},
async mounted() { async mounted() {
try { try {
const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url })) const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url }))

View File

@ -5,7 +5,7 @@
:counter-number="feed.episode_count" :counter-number="feed.episode_count"
:details="formatTimeAgo(new Date(feed.lastpub))" :details="formatTimeAgo(new Date(feed.lastpub))"
:title="feed.title" :title="feed.title"
:to="`/${feed.url}`"> :to="toUrl(feed.url)">
<template #icon> <template #icon>
<NcAvatar :display-name="feed.author" <NcAvatar :display-name="feed.author"
:is-no-user="true" :is-no-user="true"
@ -66,6 +66,9 @@ export default {
showError(t('Could not fetch search results')) showError(t('Could not fetch search results'))
} }
}, 200), }, 200),
toUrl(url) {
return `/${btoa(url)}`
},
formatTimeAgo, formatTimeAgo,
generateUrl, generateUrl,
}, },

View File

@ -14,7 +14,7 @@ const router = new Router({
component: Discover, component: Discover,
}, },
{ {
path: '/:feedUrl', path: '/:url',
component: Feed, component: Feed,
}, },
], ],

View File

@ -1,10 +1,70 @@
<template> <template>
<span>oui</span> <fragment>
<NcLoadingIcon v-if="loading" />
<NcEmptyContent v-if="failed" :title="t('Error loading feed')">
<template #icon>
<Alert />
</template>
</NcEmptyContent>
<div v-if="feed" class="header">
<NcAvatar :display-name="feed.author"
:is-no-user="true"
:url="feed.imageUrl" />
<div class="infos">
<h1>{{ feed.title }}</h1>
<a :href="feed.link" target="_blank">
{{ feed.author }}
</a>
<i>{{ feed.description }}</i>
</div>
<NcAppNavigationNew :text="t('Subscribe')">
<template #icon>
<Plus :size="20" />
</template>
</NcAppNavigationNew>
</div>
</fragment>
</template> </template>
<script> <script>
import { NcAppNavigationNew, NcAvatar, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'
import Alert from 'vue-material-design-icons/Alert.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
export default { export default {
name: 'Feed', name: 'Feed',
components: {}, components: {
Alert,
NcAvatar,
NcAppNavigationNew,
NcEmptyContent,
NcLoadingIcon,
Plus,
},
data() {
return {
failed: false,
loading: true,
feed: null,
}
},
computed: {
url() {
return atob(this.$route.params.url)
},
},
async mounted() {
try {
const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url }))
this.feed = podcastData.data.data
} catch (e) {
this.failed = true
console.error(e)
} finally {
this.loading = false
}
},
} }
</script> </script>