refacto: encode url with components becuase of / in base 64
All checks were successful
repod / xml (push) Successful in 17s
repod / php (push) Successful in 1m0s
repod / nodejs (push) Successful in 2m18s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-01-11 21:41:37 +01:00
parent af30767ab6
commit 0bbe6dbf24
8 changed files with 18 additions and 7 deletions

View File

@ -12,6 +12,7 @@
<script> <script>
import { NcAppNavigationNewItem } from '@nextcloud/vue' import { NcAppNavigationNewItem } from '@nextcloud/vue'
import Plus from 'vue-material-design-icons/Plus.vue' import Plus from 'vue-material-design-icons/Plus.vue'
import { encodeUrl } from '../../utils/url.js'
export default { export default {
name: 'AddRss', name: 'AddRss',
@ -21,7 +22,7 @@ export default {
}, },
methods: { methods: {
addSubscription(feedUrl) { addSubscription(feedUrl) {
this.$router.push(btoa(feedUrl)) this.$router.push(encodeUrl(feedUrl))
}, },
}, },
} }

View File

@ -26,6 +26,7 @@ import AdaptativeList from '../Atoms/AdaptativeList.vue'
import Loading from '../Atoms/Loading.vue' import Loading from '../Atoms/Loading.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { debounce } from '../../utils/debounce.js' import { debounce } from '../../utils/debounce.js'
import { encodeUrl } from '../../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import moment from '@nextcloud/moment' import moment from '@nextcloud/moment'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
@ -75,7 +76,7 @@ export default {
} }
}, 200), }, 200),
toUrl(url) { toUrl(url) {
return `/${btoa(url)}` return `/${encodeUrl(url)}`
}, },
}, },
} }

View File

@ -5,6 +5,8 @@
</template> </template>
<script> <script>
import { encodeUrl } from '../../utils/url.js'
export default { export default {
name: 'TopItem', name: 'TopItem',
props: { props: {
@ -27,7 +29,7 @@ export default {
}, },
computed: { computed: {
toUrl() { toUrl() {
return `/${btoa(this.link)}` return `/${encodeUrl(this.link)}`
}, },
}, },
} }

View File

@ -34,6 +34,7 @@
import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue' import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue'
import Plus from 'vue-material-design-icons/Plus.vue' import Plus from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { decodeUrl } from '../../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
@ -68,7 +69,7 @@ export default {
}, },
computed: { computed: {
url() { url() {
return atob(this.$route.params.url) return decodeUrl(this.$route.params.url)
}, },
isSubscribed() { isSubscribed() {
return this.$store.state.subscriptions.subscriptions.includes(this.url) return this.$store.state.subscriptions.subscriptions.includes(this.url)

View File

@ -55,6 +55,7 @@ import Modal from './Modal.vue'
import PlayButton from 'vue-material-design-icons/Play.vue' import PlayButton from 'vue-material-design-icons/Play.vue'
import StopButton from 'vue-material-design-icons/Stop.vue' import StopButton from 'vue-material-design-icons/Stop.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { decodeUrl } from '../../utils/url.js'
import { formatTimer } from '../../utils/time.js' import { formatTimer } from '../../utils/time.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import moment from '@nextcloud/moment' import moment from '@nextcloud/moment'
@ -85,7 +86,7 @@ export default {
return this.$store.state.player.episode return this.$store.state.player.episode
}, },
url() { url() {
return atob(this.$route.params.url) return decodeUrl(this.$route.params.url)
}, },
}, },
async mounted() { async mounted() {

View File

@ -10,6 +10,8 @@
</template> </template>
<script> <script>
import { encodeUrl } from '../../utils/url.js'
export default { export default {
name: 'Infos', name: 'Infos',
computed: { computed: {
@ -19,7 +21,7 @@ export default {
}, },
methods: { methods: {
toUrl(url) { toUrl(url) {
return `/${btoa(url)}` return `/${encodeUrl(url)}`
}, },
}, },
} }

View File

@ -25,6 +25,7 @@ import { NcActionButton, NcAppNavigationItem, NcAvatar } from '@nextcloud/vue'
import Alert from 'vue-material-design-icons/Alert.vue' import Alert from 'vue-material-design-icons/Alert.vue'
import Delete from 'vue-material-design-icons/Delete.vue' import Delete from 'vue-material-design-icons/Delete.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { encodeUrl } from '../../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
@ -52,7 +53,7 @@ export default {
}, },
computed: { computed: {
toUrl() { toUrl() {
return `/${btoa(this.url)}` return `/${encodeUrl(this.url)}`
}, },
}, },
async mounted() { async mounted() {

2
src/utils/url.js Normal file
View File

@ -0,0 +1,2 @@
export const encodeUrl = (url) => encodeURIComponent(btoa(url))
export const decodeUrl = (url) => atob(decodeURIComponent(url))