diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py index 78a358876..0d33855a6 100644 --- a/api/funkwhale_api/music/views.py +++ b/api/funkwhale_api/music/views.py @@ -240,6 +240,7 @@ class TagViewSet(viewsets.ReadOnlyModelViewSet): class Search(views.APIView): max_results = 3 + permission_classes = [ConditionalAuthentication] def get(self, request, *args, **kwargs): query = request.GET['query'] diff --git a/changes/changelog.d/119.bugfix b/changes/changelog.d/119.bugfix new file mode 100644 index 000000000..b2e7ff71f --- /dev/null +++ b/changes/changelog.d/119.bugfix @@ -0,0 +1 @@ +Fixed forced redirection to login event with API_AUTHENTICATION_REQUIRED=False (#119) diff --git a/front/src/App.vue b/front/src/App.vue index b26959fe7..347f19e30 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -56,6 +56,9 @@ export default { }, methods: { openWebsocket () { + if (!this.$store.state.auth.authenticated) { + return + } let self = this let token = this.$store.state.auth.token // let token = 'test' diff --git a/front/src/components/audio/SearchBar.vue b/front/src/components/audio/SearchBar.vue index 988ff0a7d..99896d04b 100644 --- a/front/src/components/audio/SearchBar.vue +++ b/front/src/components/audio/SearchBar.vue @@ -30,6 +30,9 @@ export default { }, apiSettings: { beforeXHR: function (xhrObject) { + if (!self.$store.state.auth.authenticated) { + return xhrObject + } xhrObject.setRequestHeader('Authorization', self.$store.getters['auth/header']) return xhrObject }, diff --git a/front/src/components/library/Home.vue b/front/src/components/library/Home.vue index e4e22fc09..40f6808f9 100644 --- a/front/src/components/library/Home.vue +++ b/front/src/components/library/Home.vue @@ -20,7 +20,7 @@

Music requests

- +
diff --git a/front/src/components/library/Library.vue b/front/src/components/library/Library.vue index 6cd156493..c20922127 100644 --- a/front/src/components/library/Library.vue +++ b/front/src/components/library/Library.vue @@ -5,7 +5,7 @@ Artists Radios