diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ddde5b79e6568b12e49ef6d37af368b481ac9b9..57b7dfc7f83ce2dfa7f95295c4f323d7e5f27108 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,7 @@ review_front: - yarn run i18n-compile # this is to ensure we don't have any errors in the output, # cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169 - - INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') + - VUE_APP_INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') - mkdir -p /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - cp -r dist/* /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG cache: diff --git a/changes/changelog.d/490.bugfix b/changes/changelog.d/490.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..da37bdf4bd25f51357f18ad5ab13bc65855046ec --- /dev/null +++ b/changes/changelog.d/490.bugfix @@ -0,0 +1 @@ +Ensure we always have a default api url set on first load to avoid displaying the instance picker (#490) diff --git a/front/src/App.vue b/front/src/App.vue index f80020e93931f376fb601a70dbd590569524dc13..c8134a4a0199d1fd1adf0f1b4066636cd6938635 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -124,12 +124,13 @@ export default { // used to redraw ago dates every minute self.$store.commit('ui/computeLastDate') }, 1000 * 60) - if (this.$store.state.instance.instanceUrl) { - this.$store.commit('instance/instanceUrl', this.$store.state.instance.instanceUrl) - this.$store.dispatch('auth/check') - this.$store.dispatch('instance/fetchSettings') - this.fetchNodeInfo() + if (!this.$store.state.instance.instanceUrl) { + let defaultInstanceUrl = process.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']() + this.$store.commit('instance/instanceUrl', defaultInstanceUrl) } + this.$store.dispatch('auth/check') + this.$store.dispatch('instance/fetchSettings') + this.fetchNodeInfo() }, methods: { fetchNodeInfo () { diff --git a/front/src/store/instance.js b/front/src/store/instance.js index 5610b0ec7fc48f69af1eb33180be7b49fbef351d..163c595e302a0997887862f913207b01be0bb3b2 100644 --- a/front/src/store/instance.js +++ b/front/src/store/instance.js @@ -14,7 +14,7 @@ export default { state: { maxEvents: 200, frontSettings: {}, - instanceUrl: process.env.INSTANCE_URL, + instanceUrl: process.env.VUE_APP_INSTANCE_URL, events: [], settings: { instance: {