diff --git a/api/funkwhale_api/music/factories.py b/api/funkwhale_api/music/factories.py index c8f4bf322dbb6be91383f022e52f5e027a096714..9bcc4350ffae3e56ddef431b9c33960b9899364a 100644 --- a/api/funkwhale_api/music/factories.py +++ b/api/funkwhale_api/music/factories.py @@ -89,7 +89,7 @@ class ImportJobFactory(factory.django.DjangoModelFactory): batch = factory.SubFactory(ImportBatchFactory) source = factory.Faker("url") mbid = factory.Faker("uuid4") - replace_if_duplicate = factory.Faker("boolean") + replace_if_duplicate = False class Meta: model = "music.ImportJob" diff --git a/front/src/store/instance.js b/front/src/store/instance.js index 555bd82391fe56a4ec5d18baa71e0e64dceabf35..dfd6a9db84e4156168b6b7ed20a6ac8375b69c03 100644 --- a/front/src/store/instance.js +++ b/front/src/store/instance.js @@ -54,19 +54,16 @@ export default { state.events = value }, instanceUrl: (state, value) => { + if (value && !value.endsWith('/')) { + value = value + '/' + } state.instanceUrl = value if (!value) { axios.defaults.baseURL = null return } - let apiUrl let suffix = 'api/v1/' - if (state.instanceUrl.endsWith('/')) { - apiUrl = state.instanceUrl + suffix - } else { - apiUrl = state.instanceUrl + '/' + suffix - } - axios.defaults.baseURL = apiUrl + axios.defaults.baseURL = state.instanceUrl + suffix } }, getters: { diff --git a/front/src/views/instance/Timeline.vue b/front/src/views/instance/Timeline.vue index 03bd5a53758373257239d054f6ffbead3569d9fe..a5647b7bf919759dc443d4f95d0def829ffb20d5 100644 --- a/front/src/views/instance/Timeline.vue +++ b/front/src/views/instance/Timeline.vue @@ -78,8 +78,11 @@ export default { // let token = 'test' const bridge = new WebSocketBridge() this.bridge = bridge + let url = this.$store.getters['instance/absoluteUrl'](`api/v1/instance/activity?token=${token}`) + url = url.replace('http://', 'ws://') + url = url.replace('https://', 'wss://') bridge.connect( - `/api/v1/instance/activity?token=${token}`, + url, null, {reconnectInterval: 5000}) bridge.listen(function (event) {