From 482647dab9e638a4474e1f30a4609653fedb2ceb Mon Sep 17 00:00:00 2001 From: Agate Date: Fri, 28 Aug 2020 20:19:08 +0200 Subject: [PATCH 1/3] Fix #1210: Enforce authentication when viewing remote channels, profiles and libraries --- api/funkwhale_api/federation/tasks.py | 2 +- changes/changelog.d/1210.enhancement | 1 + front/src/views/auth/ProfileBase.vue | 7 ++++++- front/src/views/channels/DetailBase.vue | 4 ++++ front/src/views/library/DetailBase.vue | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 changes/changelog.d/1210.enhancement diff --git a/api/funkwhale_api/federation/tasks.py b/api/funkwhale_api/federation/tasks.py index 86bef50e1..c2bdfad34 100644 --- a/api/funkwhale_api/federation/tasks.py +++ b/api/funkwhale_api/federation/tasks.py @@ -429,7 +429,7 @@ def fetch(fetch_obj): ) except Exception: logger.exception( - "Error while fetching actor outbox: %s", obj.actor.outbox.url + "Error while fetching actor outbox: %s", obj.actor.outbox_url ) else: if result.get("next_page"): diff --git a/changes/changelog.d/1210.enhancement b/changes/changelog.d/1210.enhancement new file mode 100644 index 000000000..a41d714e5 --- /dev/null +++ b/changes/changelog.d/1210.enhancement @@ -0,0 +1 @@ +Enforce authentication when viewing remote channels, profiles and libraries (#1210) \ No newline at end of file diff --git a/front/src/views/auth/ProfileBase.vue b/front/src/views/auth/ProfileBase.vue index 353ab1581..2569e2ce0 100644 --- a/front/src/views/auth/ProfileBase.vue +++ b/front/src/views/auth/ProfileBase.vue @@ -93,7 +93,12 @@ export default { } }, created() { - this.fetch() + let authenticated = this.$store.state.auth.authenticated + if (!authenticated && this.domain && this.$store.getters['instance/domain'] != this.domain) { + this.$router.push({name: 'login', query: {next: this.$route.fullPath}}) + } else { + this.fetch() + } }, beforeRouteUpdate (to, from, next) { to.meta.preserveScrollPosition = true diff --git a/front/src/views/channels/DetailBase.vue b/front/src/views/channels/DetailBase.vue index be8481daf..f11196752 100644 --- a/front/src/views/channels/DetailBase.vue +++ b/front/src/views/channels/DetailBase.vue @@ -270,6 +270,10 @@ export default { }, async created() { await this.fetchData() + let authenticated = this.$store.state.auth.authenticated + if (!authenticated && this.$store.getters['instance/domain'] != this.object.actor.domain) { + this.$router.push({name: 'login', query: {next: this.$route.fullPath}}) + } }, methods: { async fetchData() { diff --git a/front/src/views/library/DetailBase.vue b/front/src/views/library/DetailBase.vue index a58a179be..efd0d18fc 100644 --- a/front/src/views/library/DetailBase.vue +++ b/front/src/views/library/DetailBase.vue @@ -148,6 +148,10 @@ export default { }, async created() { await this.fetchData() + let authenticated = this.$store.state.auth.authenticated + if (!authenticated && this.$store.getters['instance/domain'] != this.object.actor.domain) { + this.$router.push({name: 'login', query: {next: this.$route.fullPath}}) + } }, methods: { async fetchData() { From 89037a76dbd16ef85a6308cfcf90473a151289a8 Mon Sep 17 00:00:00 2001 From: Agate Date: Fri, 28 Aug 2020 20:41:42 +0200 Subject: [PATCH 2/3] Added link to origin pod for track, album, artist, profile, channel and library --- front/src/components/library/AlbumDropdown.vue | 15 +++++++++++++++ front/src/components/library/ArtistBase.vue | 16 ++++++++++++++++ front/src/components/library/TrackBase.vue | 14 ++++++++++++++ front/src/utils.js | 6 ++++++ front/src/views/auth/ProfileBase.vue | 8 ++++++++ front/src/views/channels/DetailBase.vue | 8 ++++++++ front/src/views/library/DetailBase.vue | 8 ++++++++ 7 files changed, 75 insertions(+) diff --git a/front/src/components/library/AlbumDropdown.vue b/front/src/components/library/AlbumDropdown.vue index 07b7b5a76..3cc42f6ef 100644 --- a/front/src/components/library/AlbumDropdown.vue +++ b/front/src/components/library/AlbumDropdown.vue @@ -20,6 +20,15 @@